Python only outputs the final shape in my list

Hello. I’m currently trying to use Python to create some steps leading up to a building. So far, I am able to create each individual step as the number of steps increases but it only outputs the final step. For example, when trying to generate 2 steps, it’ll only output the second step and not include the first step
with it. I’ve tried putting the steps in a list so it will output the previous steps as the number of them increases but I can’t figure out how to do so. Could I get some guidance please?

Python (6.3 KB)

"""Grasshopper Script"""

import rhinoscriptsyntax as rs

liststeps = list()
startPoint = rs.CreatePoint([0, 0, (number_of_steps-1)])

i = 0
while i < number_of_steps:
    step_circle = rs.AddCircle(startPoint, (radius-number_of_steps+1))
    boundary = rs.AddPlanarSrf(step_circle)
    line = rs.AddLine(startPoint, [0, 0, number_of_steps])  
    extrusion = rs.ExtrudeSurface(boundary, line)
    i += 1

The steps obscure each other, as each one is identical, but set the “Number of steps” slider to a value higher than one.

Thank you for your reply James. Do you mind explaining how I can differentiate each step so it outputs all of them in the list?

they are all in the list. but since your algo always calculates the same geometrical properties, they overlap.

so make sure you include a variable that changes as you iterate to create each step

circular (7.5 KB)

Make the radius or start point depend on i

Ah ok I see now. Thank you for pointing that out. Much appreciated.

1 Like

Thank you. I am now able to keep the original steps :grinning:

1 Like