| 1 | #!/usr/bin/perl | ||
| 2 | |||
| 3 | # This contains the cog cutting functions. | ||
| 4 | use CNC::Cog; # This contains the jpeg output functions | ||
| 5 | use CNC::Cog::Gdcode; # and this the gcode output functions | ||
| 6 | use CNC::Cog::Gcode; # Actually you only need one of these. | ||
| 7 | |||
| 8 | $c=newcogpair Cog(3.0,7,18); # make a pinion and a wheel module 3, | ||
| 9 | # with 7 and 18 teeth. | ||
| 10 | # you can use CNC::Cog or Cog here. | ||
| 11 | |||
| 12 | $c->cutset({cuttersize=>0.125,passes=>3,passdepth=> -0.025 }); | ||
| 13 | |||
| 14 | $c->{wheel}->hole(0.125); | ||
| 15 | $c->{pinion}->hole(0.25); | ||
| 16 | |||
| 17 | my $feed=3; | ||
| 18 | #my $g=new gcode("test.ngc",$feed,5); # for gcode out use this line | ||
| 19 | # output file, feed rate, tool number for offset commands | ||
| 20 | my $g=new Gdcode("test.png",4.50 ,1300,1300);# for jpg use this line | ||
| 21 | # file, size in inches horizontally, x and y size in pixels | ||
| 22 | # You can use CNC::Cog::Gdcode or Gdcode here | ||
| 23 | $g->ginit(); | ||
| 24 | |||
| 25 | $c->{wheel}->cut($g,0,-0.75,0); # x,y,z. | ||
| 26 | $c->{pinion}->cut($g,0,1.25,0); | ||
| 27 | |||
| 28 | $g->gend(); # finalise graphics operations, write files etc. |