Problem with AddBox

Hello there,
So I am having a small problem with this piece of code: I was trying to create some boxes, but I keep getting this message : Message: unable to create brep from box
However, when I replace the BoxHeight value with a number, the code is working. I can’t use the value of i to create elements ?

import rhinoscriptsyntax as rs
for i in range(10):
    BoxHeight = i
    corners = [(0,0,0),(0.5,0,0),(0.5,0.5,0),(0,0.5,0),(0,0,BoxHeight),(0.5,0,BoxHeight),(0.5,0.5,BoxHeight),(0,0.5,BoxHeight)]
    Box = rs.AddBox(corners)

Thank you for your help in advance !

Well, i starts out at 0. Rhino won’t let you create a box with 0 height, it’s invalid.

If you run this:

for i in range(1,10)

your script runs fine.

HTH, --Mitch

Oh, great ! Thanks for the fast answer !

Sure no problem. If you want your first box to be world 0 you can also use:

for i in range(10):
    BoxHeight = i+1