Is there a method in rhinocommon or RhinoScriptSyntax to sketch a curve

I was wondering if there is a method in rhinocommon or RhinoScriptSyntax to sketch a curve。Just like the command _sketch on toolbar.

thanks.

Hi @kyxiang1,

The Sketch command can be scripted using rs.Command. Does this help?

– Dale

Thank you for your reply. But the message shows that ‘module’ object has no attribute ‘Sketch’. I’m in Rhino python editor. Did I input the command wrong?

1537248945(1)[quote=“dale, post:2, topic:71044, full:true”]

Hi @kyxiang1, _Sketch is a built in Rhino command. You might try like below:

import Rhino
import scriptcontext
import rhinoscriptsyntax as rs

def SampleSketch():
    
    cmd = "_Sketch"
    rc = rs.Command(cmd, False)
    if not rc: return
    
    new_curve_ids = rs.LastCreatedObjects(select=True)
    
if __name__=="__main__":
    SampleSketch()

_
c.

@clement, thank you very much. It really works. I made mistakes in using “rs.Command”.