Hi All,
For a project, I want to add grasshopper rectangles after each click on the button in my user interface (Blue circle). Now, with a loop I can add multiple rectangles to a list in a while loop, until the user puts it to stop by typing “N” (in green).
However, this program only shows all rectangles after the loop has stopped. Is there also a way to create a rectangle at each click on the button, and after the python component add this new rectangle to a list of already created ones?
Hope to hear from you, thanks for your help!
JS
Code:
sc.doc = ghdoc
corridors = []
stop = False
while stop == False:
plane = rs.WorldXYPlane()
Rhino.RhinoApp.ReleaseMouseCapture()
x1 = rs.GetPoint("Select first point of corridor")
print(x1) # Tip: print(...)
x2 = rs.GetPoint("Select second point of corridor")
print(x2)
Rhino.RhinoApp.ReleaseMouseCapture()
rs.Redraw()
corridors.append(rs.AddRectangle(plane,x1,x2))
more_corridors = rs.GetString("more corridors? (if yes type 'Y', if no type 'N')")
if more_corridors == 'Y' or more_corridors == 'y':
continue
else:
stop = True