Notifications
Clear all

[Closed] <Edit_Poly>set/getSelection question

I’m trying to get an edge array on an object, extrude selected faces in Edit_Poly mode, then get a revised edge array.

s = sphere()
convertToPoly(s)
polyop.setFaceSelection s #{24,25,26}
polyop.setEdgeSelection s #all
eArray = polyop.getEdgeSelection s
print eArray.count
m = Edit_Poly()
addmodifier s m
m.setOperation #ExtrudeFace
m.extrudeFaceHeight = 5
m.setSelection #Edge -- calls for a second Arg here... what?
mArray = m.getSelection #Edge
print mArray.count

What I’m not getting is how to create the revised edge array. It’s obviously something basic I’m overlooking. Help, please? Many thanks.

2 Replies
s = sphere()
 convertToPoly(s)
 polyop.setFaceSelection s #{24,25,26}
 polyop.setEdgeSelection s #all
 eArray = polyop.getEdgeSelection s
 print eArray.count
 m = Edit_Poly()
 addmodifier s m
 max modify mode --switch command panel to modify tab 
 select s --select the object
 m.setOperation #ExtrudeFace --set the operation to extrude face
 m.extrudeFaceHeight = 5 --set the height
 m.commit() --we have to commit the extrusion before the new edges can be seen as part of the object
 m.setSelection #Edge #{1..(m.getNumEdges())} --select all edges from 1 to the new last edge
 mArray = m.getSelection #Edge --get the selection bitarray - should be the same as above - #{1..256}
 print mArray.count --and should have 256 bits

Not sure what “revised selection” means, but if you want ALL edges, you just have to pass a bitarry with bits set from 1 to the number of edges. It would have been easier if there was a #all flag for it, but there isn’t.

Thanks yet again, Bobo. Greatly appreciated. With luck the quality of my questions will improve.