i am trying to perform a persistent sub-object selection in a script using RhinoObject.SelectSubObject
method, but cannot get a persistent selection of a mesh edge. Here is my code, which prints 1 (object is selected) for the selection state instead of 2 (object is selected persistently):
import Rhino
import scriptcontext
import rhinoscriptsyntax as rs
def TestEdgeSelection():
mesh_id = rs.GetObject("Select mesh", 32, True, False)
if not mesh_id: return
obj = rs.coercerhinoobject(mesh_id, True, True)
index_type = Rhino.Geometry.ComponentIndexType.MeshTopologyEdge
comp_index = Rhino.Geometry.ComponentIndex(index_type, 0)
state = obj.SelectSubObject(comp_index, True, True)
scriptcontext.doc.Views.Redraw()
print "Selection State:", state
TestEdgeSelection()
I can see the highlighting for a nanosecond, but then the mesh edge gets unselected. The rhino common SDK helpfile somehow states this:
Reports if an object can be selected
but i am not sure if this is a copy & paste typo, because there is a SubObjectSelectable
method with the same help text which provides the functionality to check selection state.
Is there a way to get persistent selection somehow ? I would like to perform the scripted pre-selection for the _UnweldEdge
command.
c.