| 1 | #!/usr/bin/perl | ||
| 2 | |||
| 3 | use CNC::Cog; | ||
| 4 | use CNC::Cog::Gdcode; | ||
| 5 | use CNC::Cog::Gcode; | ||
| 6 | |||
| 7 | # process options. Use getopts if you like. | ||
| 8 | my %opt; | ||
| 9 | $opt{allowed}='p'; | ||
| 10 | @ARGV=grep { s/^-([$opt{allowed}])//?(($opt{$1}=1)&&0):1 } @ARGV; # set options allowed in opt | ||
| 11 | grep { m/^-/ } @ARGV and die "Illegal option in @ARGV"; | ||
| 12 | |||
| 13 | my ($g); | ||
| 14 | if ($opt{p}) | ||
| 15 | { | ||
| 16 | $g=new Gdcode("test.png",1.5,300,300); # this uses the GD module to generate a .png file size 1950 pixels square. | ||
| 17 | } | ||
| 18 | else | ||
| 19 | { | ||
| 20 | my $feed=3.0; # feed rate for cut. | ||
| 21 | $g=new Gcode("test.ngc",$feed); # and this produces gcode in the file test.ngc. | ||
| 22 | } | ||
| 23 | |||
| 24 | $c=newcogpair Cog(1.6,7,16); # Creates a pair of meshing wheels, with teeth module 1.6 (mm) one with 7 teeth, one with 16. | ||
| 25 | $c->{wheel}->hole(0.16); | ||
| 26 | $c->{wheel}->cutset(0.0625,4,-0.015); # cuttersize, passes, passdepth | ||
| 27 | |||
| 28 | $c->{wheel}->trepan(5,0.2,0.175,0.35,0.05,1.0,0.05); | ||
| 29 | # $spoken, # number of spokes | ||
| 30 | # $wos, # total width of spokes | ||
| 31 | # $bsf, # boss radius in inches | ||
| 32 | # $rsf, # rim size factor as proportion of pitch radius. | ||
| 33 | # $roe, # radius of window edge for trepan | ||
| 34 | # $wobf, # width at base factor, > 1 for narrower at spoke rim | ||
| 35 | # $rot, # rotation factor for inside of spokes relative to outside 1= 1 revolution 0 to 0.2 are good. | ||
| 36 | |||
| 37 | $c->{wheel}->bossindent(0.25,-0.01,1); # diameter of indent, depth of indent, how many passes, feedrate | ||
| 38 | |||
| 39 | $g->ginit(); | ||
| 40 | $c->{wheel}->cut($g,0.0,0.0,0.0); | ||
| 41 | $g->gend(); |