File:Wiki.png

Created with brlcad-7.6.4, xwd, and The GIMP. Copyright (c) Archimedes Submerged 2006. Creative Commons Attribution license.

proc helix { p r t xoff } { list [expr ($p)*($t)+($xoff)] \ [expr ($r)*cos($t)] \ [expr ($r)*sin($t)] }
 * 1) helix calculates x,y,z coordinates of a helix
 * 2) which is oriented with its axis coinciding with X axis.
 * 3) For left-handed helix, use -p and -t.
 * 4) p -- pitch:  position along X axis is p*t + xoff
 * 5) r -- radius:  radius of outside.
 * 6) t -- theta:  angle of current point.
 * 7) xoff -- add to position along X axis after all multiplication.

proc pie { n i p r dT dX } { concat in $n$i.s arb6 \ [helix ($p) ($r) ($i+0.5)*($dT) ($dX*2) ] \ [helix ($p) ($r) ($i-0.5)*($dT) ($dX*2) ] \ [helix ($p) ($r) ($i-0.5)*($dT) ($dX)  ] \ [helix ($p) ($r) ($i+0.5)*($dT) ($dX)  ] \ [helix ($p) 0   ($i)*($dT)     ($dX*2) ] \ [helix ($p) 0   ($i)*($dT)     ($dX)   ] }
 * 1) Create a piece-of-pie-shaped arb6
 * 2) For left-handed helix, use -p and -dT.
 * 3) n -- name prefix
 * 4) i -- name of the arb6 is $n$i.s.  $i is number.
 * 5) p -- pitch of helix.  Position is p*t
 * 6) r -- radius of helix.
 * 7) dT -- dTheta.  Actual angle is $i*$dT
 * 8) dX -- thickness
 * 9) Each piece is dT radians wide and dX units thick.

set numpieces 400 set rhradius 10.0 set lhradius 15.0 set maxradius 15.0 set pitch 1.0 set dTheta 0.05 set thickness 0.1 for { set i 0 } { $i < $numpieces } {incr i} { eval [pie rh $i $pitch $rhradius $dTheta $thickness ] eval [pie lh $i -$pitch $lhradius -$dTheta $thickness ] }
 * 1) Create the pieces-of-pie.
 * 2) Pitch is $pitch
 * 3) Radius is $radius
 * 4) Each piece is 0.05 radians wide.

for { set i 0; set rh {}; set lh {} } { $i < $numpieces } {incr i} { set rh [concat $rh u rh$i.s] set lh [concat $lh u lh$i.s] }
 * 1) Create string listing all of the pieces-of-pie.

set height [expr ($pitch)*($dTheta)*($numpieces) + 1.5] in rh.outrcc.s rcc 0 0 0 $height 0 0 [expr $rhradius] in rh.inrcc.s rcc 0 0 0 $height 0 0 [expr ($rhradius)*0.99] in rh.shaft.s rcc 0 0 0 $height 0 0 [expr ($rhradius)*0.6] in lh.outrcc.s rcc 0 0 0 $height 0 0 [expr $lhradius] in lh.inrcc.s rcc 0 0 0 $height 0 0 [expr ($lhradius)*0.99] in lh.shaft.s rcc 0 0 0 $height 0 0 [expr ($lhradius)*0.8]
 * 1) Create a right circular cylinder forming the outside
 * 2) shell of the rotor.
 * 3) in name rcc vx vy vz hx hy hz r
 * 4) vxyz is vertex.  hxyz is height vector.  r is radius

in cutout.s arb8 \ 0 0 0 \  0 $maxradius 0  \ 0 $maxradius $maxradius \ 0 0 $maxradius  \ $height 0 0 \ $height $maxradius 0 \ $height $maxradius $maxradius \ $height 0 $maxradius
 * 1) Create a cut-away view.
 * 2) set maxradius small to eliminate the cut-away.
 * 3) set maxradius 0.1

r rh.shell.r u rh.outrcc.s - rh.inrcc.s - cutout.s r lh.shell.r u lh.outrcc.s - lh.inrcc.s - cutout.s
 * 1) Create the regions rh.shell.r and lh.shell.r

r rh.cutoutshell.r u rh.outrcc.s + cutout.s - rh.inrcc.s r lh.cutoutshell.r u lh.outrcc.s + cutout.s - lh.inrcc.s
 * 1) Create the regions rh.cutoutshell.r and lh.cutoutshell.r

eval r rh.pies.r $rh eval r lh.pies.r $lh
 * 1) Create the regions rh.pies.r and lh.pies.r

c rh.helix.c rh.pies.r - rh.shell.r - rh.shaft.s - cutout.s c lh.helix.c lh.pies.r - lh.shell.r - lh.shaft.s - cutout.s
 * 1) Create combinations rh.helix.c and lh.helix.c

c rh.helixcutout.c rh.pies.r + cutout.s - rh.cutoutshell.r - rh.shaft.s c lh.helixcutout.c lh.pies.r + cutout.s - lh.cutoutshell.r - lh.shaft.s
 * 1) Create combinations rh.helixcutout.c and lh.helixcutout.c

mater rh.helix.c plastic 255 0 0 0 mater lh.helix.c plastic 0 0 255 0
 * 1) mater region material-name r g b 0
 * 2) (last 0 means "Do not inherit colors or material type").

mater rh.shell.r glass 255 128 128 0 mater lh.shell.r glass 128 128 255 0

mater rh.helixcutout.c plastic 255 0 0 0 mater lh.helixcutout.c plastic 0 0 255 0

mater rh.cutoutshell.r glass 255 0 0 0 mater lh.cutoutshell.r glass 255 0 0 0

B rh.helix.c lh.helix.c rh.shell.r lh.shell.r rh.helixcutout.c lh.helixcutout.c
 * 1) B rh.helix.c lh.helix.c rh.shell.r lh.shell.r rh.helixcutout.c lh.helixcutout.c rh.cutoutshell.r lh.cutoutshell.r

proc killHelix {} { global numpieces for { set i 0 } { $i < $numpieces } {incr i} { kill rh$i.s	kill lh$i.s   } kill rh.outrcc.s lh.outrcc.s   kill rh.inrcc.s lh.inrcc.s    kill rh.shaft.s lh.shaft.s    kill cutout.s    kill rh.shell.r lh.shell.r    kill rh.pies.r lh.pies.r    kill rh.helix.c lh.helix.c    kill rh.cutoutshell.r lh.cutoutshell.r    kill rh.helixcutout.c lh.helixcutout.c }