I can select edges of a brep within an ironpython script. I can see the highlighted selection in Rhino, if I execute time.sleep(5). After the script is finished, the selection dissapears. How can I keep the selection within Rhino after code completion?
Hi @dale,
I tried the following:
import scriptcontext
import rhinoscriptsyntax as rs
brep_id = rs.GetObject("select a poly surface", rs.filter.polysurface)
brep = rs.coercebrep(brep_id)
rhino_object = rs.coercerhinoobject(brep_id)
scriptcontext.doc.Objects.UnselectAll()
for edge in brep.Edges:
rhino_object.SelectSubObject(edge.ComponentIndex(),True, True)
While I wrapped up this simple example, I found out that I can use another overloaded method of SelectSubObject
, which has the additional bool argument persistentSelect
:
rhino_object.SelectSubObject(edge.ComponentIndex(),True, True, persistentSelect=True)
@daniel.kowollik yes, simply adding another True to the arguments should solve your issue.
import scriptcontext
import rhinoscriptsyntax as rs
brep_id = rs.GetObject("select a poly surface", rs.filter.polysurface)
brep = rs.coercebrep(brep_id)
rhino_object = rs.coercerhinoobject(brep_id)
scriptcontext.doc.Objects.UnselectAll()
for edge in brep.Edges:
rhino_object.SelectSubObject(edge.ComponentIndex(),True, True, True)
2 Likes