How to specify drape area by scripting for rs.Command("_Drape",0)

Hi.
I am trying to write script which can drape automatically by specifying all required parameter such as x,y coordinate of drape area and spacing etc. Can anyone tell me how to write those script in python?

Thank you in advance.

Hi Katsuya,

create eg. a sphere with radius 10 at the world origin and switch to shaded top view. Then try running this script from the python editor:

import Rhino
import scriptcontext
import rhinoscriptsyntax as rs
    
def DrapeTest():
    # drape options
    a = "AutoSpacing=Yes"
    b = "Spacing=5"
    c = "AutoDetectMaxDepth=No"
    # 3d points
    pt0 = Rhino.Geometry.Point3d(0,0,0)
    pt1 = Rhino.Geometry.Point3d(20,20,0)
    # command
    cmd = "_Drape {0} {1} {2} {3} {4}".format(a,b,c,pt0,pt1)
    result = rs.Command(cmd, True)
    if result:
        drape_srf = rs.LastCreatedObjects(select=True)[0]
    else:
        print "No result"
    
DrapeTest()

c.

1 Like