in this picture i wanna try to create one box and add to boxList and show all boxes on my screen. However ,in every timer cycle it creates one box and it makes it throw at boxList and update just the box position.it is not created multiple boxes through timer cycle.
This will fix it! Rename your output to boxes first.
import Rhino.Geometry as rg
self.pos = p
self.pos += rg.Vector3d(10, 10, 10)
sizex = rg.Interval(0, 10)
sizey = rg.Interval(0, 10)
sizez = rg.Interval(0, 10)
plane = rg.Plane(self.pos, rg.Vector3d(0,0,1))
return rg.Box(plane, sizex, sizey, sizez)
if __name__ == "__main__":
if reset or "agents" not in globals():
agents = 
ag = Agent(rg.Point3d(0, 0, 0))
ag = agents[-1].__copy__()
boxes =  # Output
if "agents" in globals():
for ag in agents:
The thing you got wrong is that your making the timer variable persistent - even though you don’t need it -, but your agent is only created at the first iteration, and after that only its position gets updated.
What you want to do instead is make a list that keeps track of the created agents persistent in globals().