|
|
I seem to be having difficulties predicting the results of this loop.
I _wanted_ to get a matrix of holes that were 3,5,7,7,7,5,3 in both the
X and Y directions, but I get 4 extra holes on the top row - ("top"
before z-rotation)
[object T30H is just a cylinder place-holder for a mounting screw]
Is there an obvious error someone can point out?
Thanks,
#declare Intercom_Button = union {
difference {
box {<0, 0, 0>, <5, 5, -0.125> pigment {Gray80} }
union {
#declare Holes = 0.429;
#declare X=1;
#while (X<8)
#declare Y=1;
#while (Y<8)
#if (Y=1 & (X<3 | X>5) )
#declare Y=Y+1;
#end
#if (Y=2 & (X=1 | X=7) )
#declare Y=Y+1;
#end
#if (Y=6 & (X=1 | X=7) )
#declare Y=Y+1;
#end
#if (Y=7 & (X<3 | X>5) )
#declare Y=Y+1;
#end
cylinder {<X*Holes, Y*Holes, -0.25>, <X*Holes, Y*Holes, 0.25>, 0.125
pigment {Black}}
#declare Y=Y+1;
#end
#declare X=X+1;
#end
rotate z*45 translate x*1.75}
}
sphere { <4, 2, 0>, 0.5 pigment {Gray50} }
object {T30H translate <0.5, 0.5, -0.125>}
object {T30H translate <0.5, 4.5, -0.125>}
object {T30H translate <4.5, 0.5, -0.125>}
object {T30H translate <4.5, 4.5, -0.125>}
}
Post a reply to this message
|
|