Hi,
I am facing an issue that the usual Rhino ExtendSrf command supports trimmed surfaces while the one in RhinoCommon and Python Script does not. When I use it script the surface will be untrimmed so I need to use rs.Command(“_ExtrudeSrf”) and the edge need to be preselected.
I have found some resources that gives idea however it does not work. I found the following topic and the last message from clement includes a solution when the user select the surface-edge.
In my situation, the script will sleect the edge by a given Index number. I came up with the following script steps however the edge remains unselected.
import Rhino
import scriptcontext
import rhinoscriptsyntax as rs
# Get object:
ge = Rhino.Input.Custom.GetObject()
ge.SetCommandPrompt("Select edges")
ge.GeometryFilter = Rhino.DocObjects.ObjectType.Surface
ge.EnableUnselectObjectsOnExit(False)
ge.SubObjectSelect = False
ge.EnableUnselectObjectsOnExit(False)
ge.EnablePreSelect(True, True)
ge.Get()
# ObjRef -> RhinoObject
rh_object = ge.Object(0).Object()
number = 2
index_type = Rhino.Geometry.ComponentIndexType.BrepEdge
comp_index = Rhino.Geometry.ComponentIndex(index_type, number)
rh_object.SelectSubObject(comp_index, True, True)
rs.Command("_ExtendSrf " + "1")
Idea 2:
import Rhino
import scriptcontext
import rhinoscriptsyntax as rs
# Get object:
ge = Rhino.Input.Custom.GetObject()
ge.SetCommandPrompt("Select edges")
ge.GeometryFilter = Rhino.DocObjects.ObjectType.Surface
ge.EnableUnselectObjectsOnExit(False)
ge.SubObjectSelect = False
ge.Get()
# Return -> ObjRef
obj_ref = ge.Object(0)
# ObjRef -> Return: RhinoObject
rh_object = obj_ref.Object()
number = 2
edge = obj_ref.Brep().Edges[number]
edge_index = edge.EdgeIndex
index_type = Rhino.Geometry.ComponentIndexType.BrepEdge
comp_index = Rhino.Geometry.ComponentIndex(index_type, number)
rh_object.SelectSubObject(comp_index, True, True)
rs.Command("_ExtendSrf " + "1")