Search code examples
ironpythonrhino3d

RhinoCommon SelectSubObject


I am using RhinoPython along with RhinoCommon to attempt to select mesh vertices. Everything seems to work, but highlighted disappears after an instant. Could someone explain why? For example I use the following code to select the vertices connected a vertex:

import Rhino
import scriptcontext

if( __name__ == "__main__" ):
    go=Rhino.Input.Custom.GetObject()
    go.GeometryFilter=Rhino.DocObjects.ObjectType.MeshVertex
    go.SetCommandPrompt("Get mesh vertex")
    go.Get()
    objref = go.Object(0)
    go.Dispose()
    MeshObj = objref.Object()
    vertex=objref.GeometryComponentIndex.Index
    mesh=objref.Mesh()
    meTV=mesh.TopologyVertices
    round=meTV.ConnectedTopologyVertices(vertex)
    IT=Rhino.Geometry.ComponentIndexType.MeshTopologyVertex
    for i in round:
        CompInd=Rhino.Geometry.ComponentIndex(IT,i)
        MeshObj.SelectSubObject(CompInd,True,True)
    scriptcontext.doc.Views.Redraw()

I try to substitute MeshObj.SelectSubObject(CompInd,True,True) with MeshObj.HighlightSubObject(CompInd,True), but the result is the same. Thanks, g


Solution

  • Here is the reply from Steve... ...as far as I can tell it is impossible to keep subobject selection persistent after the completion of a command (or script). I'll let our developer who works in this part of the code know about your request so we can hopefully support this in the future.