Hi,
Can you post the full script? It makes it easier to troubleshoot.
roty(pi/2) is indeed the command you want, so probably there is just some slight typo or unexpected interaction (the order you apply transformations can matter). I would just apply it once at the end, not in the loop. My guess is that your rotation is being applied before the intersection applies or something.
However, you can also just form the chain on the x-axis directly. Instead of ellipse which is 2D, you can just use ellipsoid intersected with xrange. Something like:
SetGridsize(100, 100, 50)
SetCellsize(1e-6/100, 1e-6/100, 1e-6/50)
r1:=200e-9
r2:=500e-9
r3:=150e-9
shape1:=ellipsoid(r1, r2, r3).intersect(xrange(0,100e-9))
shapebase:=ellipsoid(r1, r2, r3).intersect(xrange(0,100e-9))
for i := 0; i < 10; i++ {
theta := i * pi / 10
shape1 = shape1.add(shapebase.rotx(i*pi/10).transl(i*150e-9,0,0))
m.SetInShape(shapebase.rotx(i*pi/10).transl(i*150e-9,0,0),uniform(0, cos(theta), sin(theta)))
}
setgeom(shape1)
save(m)
Of course you can adjust r1,r2,r3, and the intersect range etc accordingly. This might be a bit easier, but either way should ultimately be equivalent.
Best regards,
Josh L.