algorithmic modeling for Rhino
Hi,
I am new in python scripting and I was trying to do a simple exercise just to understand better the procedures. I know that there are already some functions to do it but just to practice I was trying to do it own my own. Therefore, can I get some advice how to finish this script? The only thing I am missing is how I should select the points from the list to create the mean curves...
Thank you.
import rhinoscriptsyntax as rs
curve01 = rs.GetObject("Select First Curve")
curve02 = rs.GetObject("Select Second Curve")
numOfCurves = rs.GetInteger("Insert Number of Curves", 5)
curveRes = rs.GetInteger("Number of Control Points", 20)
ptRef = []
ptCurve01 = rs.DivideCurve(curve01, curveRes - 1, False, True)
ptCurve02 = rs.DivideCurve(curve02, curveRes - 1, False, True)
for i in range(0, len(ptCurve01)):
refLine = rs.AddLine(ptCurve01[i], ptCurve02[i])
myPoints = rs.DivideCurve(refLine, numOfCurves - 1, False, True)
ptRef.append(myPoints)
for i in range (0, len(ptRef)):
for j in range (0, numOfCurves):
pt = rs.AddPoint(ptRef[i][j])
myPts.append[pt]
rs.AddCurve(pt)
Tags:
Hi Dioniso, this could be a way to do it:
import rhinoscriptsyntax as rs
curve01 = rs.GetObject("Select First Curve")
curve02 = rs.GetObject("Select Second Curve")
numOfCurves = rs.GetInteger("Insert Number of Curves", 5) - 1
curveRes = rs.GetInteger("Number of Control Points", 20)
ptCurve01 = rs.DivideCurve(curve01, curveRes - 1, False, True)
ptCurve02 = rs.DivideCurve(curve02, curveRes - 1, False, True)
myPts = []
for i in range(0, len(ptCurve01)):
refLine = rs.AddLine(ptCurve01[i], ptCurve02[i])
myPoints = rs.DivideCurve(refLine, numOfCurves, False, True)
myPts += myPoints
for i in range(0, numOfCurves):
rs.AddCurve([e for e in myPts if myPts.index(e) % 5 == i])
You're welcome,
uh sorry... the "myPts.index(e) % 5" should be ... "myPts.index(e) % (numOfCurves + 1)"
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by