Help with scripting

rhino
rhinopython
ghpython
python

(Mohamed Al Boush) #1

Hello everyone,
I’m new to scripting through Python, but for a first try I think I’m doing a progress…hopefully!!
I’m trying to create a spiral staircase, and it’s almost done. I’m having a problem creating a loop for the posts on the rails (which appear as lines in the photo) and creating surfaces for the steps.

Could anyone help?!

(the problem is in the end of the file)

Spiral Staircase.py (4.1 KB)

UPDATE:
I managed to create the steps with (NurbsSurface.CreateFromCorners)
The remaining problem is the posts on the rails, and here is the coding the I wrote for it:
posts = [ ]
for i in range(0, 49):
posts.append(rs.AddPipe(lineStepList5[i], rs.CurveDomain(lineStepList5[stepsCount-1])[0], radius2/3))

which only works if I applied it to one line like this:
posts = rs.AddPipe(lineStepList5[49], rs.CurveDomain(lineStepList5[stepsCount-1])[0], radius2/3)


(Giulio Piacentino) #2

Did you manage to fix this?
It seems you have the solution there. I know, sometimes debugging is painful…

Thanks,

Giulio


Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com


(Mohamed Al Boush) #3

yes, I fixed it. The solution was adding a 0 at the end, which till the moment I don’t understand actually. :sweat_smile:
But thanks anyway :slight_smile:


(Giulio Piacentino) #4

The [0] means ‘first item in a list’. That probably means that a function in your file returns a list or a tuple, and you need to use the first item.

Thanks,

Giulio


Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com