[Closed] How to create modifier that will be select open edges?
Hi! I want to understand how modifiers are created. Can someone help me and explain how to create simple modifier that will select open edges and update this selection after the base geometry changes?
-- http://forums.cgsociety.org/t/max-2016-simplemeshmod-test/1691192/7
plugin simpleMeshMod testmod
name:"SelectOpenEdges"
classID:#(0x56266d29, 0x7131ccaa)
(
on modifyMesh do
(
setEdgeSelection mesh (meshop.getOpenEdges mesh)
mesh
)
)
p = plane widthsegments:20 lengthsegments:20
select p
max modify mode
addModifier p (Edit_Mesh())
subObjectLevel = 2
modPanel.addModToSelection (testmod())
modPanel.addModToSelection (Twist angle:90 axis:0)
with animate on
(
at time 0 p.widthsegs = 20
at time 0 p.lengthsegs = 20
at time 100 p.widthsegs = 4
at time 100 p.lengthsegs = 4
)
playAnimation()
Great, thanks! Did you get the classID using genClassID or is it an existing class? And how to use this for editable poly objects, without converting to edit_mesh?
I just used the example from another thread so I didn’t generate class id. It must be unique, so perhaps using genClassID is a good idea.
It doesn’t require any conversion whatsoever. You can apply it to a shape like any other modifier and it will work as expected.
No matter what was below the stack the result of this modifier is Editable Mesh and not PolyMeshObject and it is something we have no control over (at least not in maxscript).
Serejah, what I actually meant was if there is a way to use the polyop functions in this code.
miauu, thanks, but it’s too difficult for me to figure out such a code so far, I could not find the part responsible for recalculation after changing the geometry
Press Get Stack Selection in edit poly mod. Dunno if it is possible to update selection automatically
I used edit_poly just to check, with other modifiers everything works fine, thanks! But what about polyop functions?
mesh variable that you access from inside simpleMeshMod is of the trimesh class, so obviously polyop functions can’t work with it. Polyop functions expect node as the first argument and not the polymesh anyway