|
![](/i/fill.gif) |
I like using macros for objects with variable parameters
Bonus example:
Bendable nail
#macro Nail (Dia,Len,Bend,BLen,Dirn)
union{
union{
cylinder{<0,1,0> <0,0,0> 1.5*Dia}
cylinder{<0,0,0> <0,-(Len-BLen-1.5*Dia*pi*Bend/360),0> Dia/2}
torus{0.25 Dia/2 scale<1,0.2,1> translate <0,-2,0>}
torus{0.25 Dia/2 scale<1,0.2,1> translate <0,-3,0>}
torus{0.25 Dia/2 scale<1,0.2,1> translate <0,-4,0>}
translate <-1.5*Dia,Len-BLen-1.5*Dia*pi*Bend/360,0>
rotate<0,0,-Bend>
translate <1.5*Dia,BLen,0>
}
#if (mod(Bend,360)>0)
difference{
torus{1.5*Dia Dia/2 rotate<90,0,0>}
plane{y 0}
plane{-y 0 rotate<0,0,-Bend>}
translate <1.5*Dia,BLen,0>
}
#end
cylinder{<0,3*Dia,0> <0,BLen,0> Dia/2}
difference{
cylinder{<0,0,0> <0,3*Dia,0> Dia/2}
plane{-z 0 rotate <12, 0,0>}
plane{-z 0 rotate <10, 90,0>}
plane{-z 0 rotate <12,180,0>}
plane{-z 0 rotate <10,270,0>}
}
rotate 90*<Dirn.z+Dirn.y-abs(Dirn.y),0,-Dirn.x>
}
#end
-tgq
"Martin Thoma" <mar### [at] radiok2r de> wrote in message
news:3C077F11.3339D552@radiok2r.de...
> Thanx, but how can I give soemthing like paramters to it? For example, I
have a
> complex object, which sometime has a part of it drawn and sometimes not.
Is it
> possible to make this in one define?!
>
> Martin
>
>
>
Post a reply to this message
|
![](/i/fill.gif) |