How to duplicate preselected (ctrl+shift) polysurface edges in Python?

I am trying to achieve something like “DupEdge” rhino command on preselected edges with script. Can anyone point me in the right direction?

if you use dupEdge and then ctrl C and ctrl V doesn’t work? I think I’m missing something haha

Hi Diego. I am looking for a way to duplicate preselected polysurface edges in the Python Script.

Hi @spineribjoint1,

See the sample below:

import Rhino
import scriptcontext as sc

go = Rhino.Input.Custom.GetObject()
go.SetCommandPrompt("Select edges to duplicate")
go.GeometryFilter = Rhino.DocObjects.ObjectType.Curve
go.GeometryAttributeFilter = Rhino.Input.Custom.GeometryAttributeFilter.EdgeCurve
go.GetMultiple(1, 0)
if go.CommandResult() == Rhino.Commands.Result.Success:
    for i in range(go.ObjectCount):
        objref = go.Object(i)
        edge = objref.Edge()
        if edge:
            curve = edge.DuplicateCurve()
            sc.doc.Objects.AddCurve(curve)
    sc.doc.Views.Redraw()

– Dale

Thank you @dale,

Works perfect. This is a big help.