Python Script_Divide Curve and Add lines

python

(OmKar) #1

Hello,
I have started learning python with rhino.
Here is simple problem which i am unable to solve
##############################################

import rhinoscriptsyntax as rs

c1 = rs.AddCurve(rs.GetPoints(“create Points for curve”), 3)
c2 = rs.OffsetCurve(c1,rs.GetPoint(“Direction of offset”),rs.GetReal(“offset”))

division = rs.GetInteger(“No.of divsion”)
div1 = rs.DivideCurve(c1,division,True,True)

div2 = rs.DivideCurve(c2,division,True,True)

lines = [div1,div2]

lineID = rs.AddLine(lines[0],lines[1])

################################################

Any help is appreciated, I dont understand where I am going wrong.


(Lando Schumpich) #2

try this:

    import rhinoscriptsyntax as rs

    c1 = rs.AddCurve(rs.GetPoints('create Points for curve'), 3)
    c2 = rs.OffsetCurve(c1,rs.GetPoint('Direction of offset'),rs.GetReal('offset'))

    division = rs.GetInteger('No.of divsion')

    div1 = rs.DivideCurve(c1,division,True,True)
    div2 = rs.DivideCurve(c2,division,True,True)

    for i in range(0, division + 1, 1):
        rs.AddLine(div1[i], div2[i])

(OmKar) #3

thanks! :slight_smile: