algorithmic modeling for Rhino
Hi all,
I'm a beginner using python and also in the programming world. I got into a problem I cannot find the reason why it does not work, so maybe some of you can give me a hand.Thanks in advance.
I have two lists of planar curves each list lying in a plane. Both planes are parallel and separated x distance. I would like to make a loft between the curves of list 1 with the corresponding curves of list 2. I made a loop to automate this:
curves1=[]
curves2=[]
lofts = []
for i in range (0,int(N)):
....loft=rs.AddLoftSrf ([curves1[i],curves2[i]])
....lofts.append(loft)
To get the resulting list of lofts in grasshopper I do:
a=lofts
However the lofted surfaces do not appear in the rhino screen and in the a output of my python button it says: "Ironpython.Runtime.List" I know that the outcome must be a list, but why can't I see on display the lofted surfaces?
I realized that if I call a= lofts[0], the lofted surface "0" appears (so the list is working), but I would like to get all of them without calling them one by one.
Any help will be welcome!
Tags:
Hi allanimals,
rs.AddLoftSrf() function returns a list of lofted surface identifier that you created.
So what you are doing with each iteration is: adding a list (with a single item in it: identifier of a surface) to a "lofts" list. It's a list of lists, and Grasshopper does not understand that.
You can solve this by appending only the resulting surface identifier itself, instead of a list:
import rhinoscriptsyntax as rs
lofts = []
for i in range (0, int(N)):
loft=rs.AddLoftSrf([curves1[i],curves2[i]])
lofts.append(loft[0])
a=lofts
Please attach your .3dm and .gh files next time. Thank you.
Hi djordje,
Thank you very much for the explanation and solution. It works now perfectly.
This was my first post. Next time I will upload all the files.
Welcome to
Grasshopper
© 2025 Created by Scott Davidson.
Powered by