Learn Python Scripting v0109.gh (12.1 KB)
I am learning GH Python.
I like to output geometry (curves, surface from loft) from the script component, but I keep getting “1. Data conversion failed from Goo to Curve” error.
How can I get the geometry?
ptMatrix = {}
for z in range(zMax):
for y in range(yMax):
for x in range(xMax):
ptMatrix[(x,y,z)] = (x*gap,y*gap,z*gap)
curvesdict = {}
for i in range(yMax):
curvesdict[i] = []
for y in range(yMax):
for x in range(xMax-1):
for z in range(zMax-1):
pt1 = ptMatrix[(x,y,z)]
pt2 = ptMatrix[(x+1,y,z)]
pt3 = ptMatrix[(x+1,y,z+1)]
pt4 = ptMatrix[(x,y,z+1)]
pts = [pt1,pt2,pt3,pt4,pt1]
crv = rs.AddCurve(pts)
curvesdict[y].append(crv)
# results = list[curvesdict.values()]
loft = [ ]
for i in range(len(curvesdict[0])):
curves = [curvesdict[y][i] for y in range(yMax)]
loft.append(rs.AddLoftSrf(curves))
results = loft