# 6-23-2001 @myt=localtime(time); $ts=$myt[4]+1; #create time string $ts.="/$myt[3]/0"; $ts.=($myt[5]-100); #year, this will fail in 2010 print "(--------- G-code generated by DRL-REC.pl on $ts ------ )\n"; print "(THIS PROGRAM CREATES A CIRCULAR PATTERN OF HOLES) \n"; $pi=3.14159; # -------------------------------- #HOW DEEP $zdepth=0.20; #SIZE OF THE CIRCLE $radius=0.65; $degdrill=10; #OFFSET $xoff=0.0;$yoff=0.0; # -------------------------------- $holes=360/$degdrill; $astep=2*$pi/$holes; #yes, this is the perimeter, not diameter $diam=2*$pi*$radius; $dh=$diam/$holes; print "(OffsetX=$xoff, OffsetY=$yoff)\n"; print "(Radius is $radius, Perimeter is $diam, Drill every $degdrill Degress)\n"; print "(Number of holes: $holes Perimeter/Holes is $dh) \n"; print "F100\n"; print "G01\n\n"; print "X $xoff Y $yoff\n"; print "G81 z-$zdepth \n\n"; #we don't start at 0, because it gets drilled at 360 deg. for ($angle=$astep;$angle<(2*$pi);$angle+=$astep) { $x=cos($angle)*$radius; $y=sin($angle)*$radius; $x=int(($x+$xoff)*10000);$x=$x/10000; $y=int(($y+$yoff)*10000);$y=$y/10000; print "X$x Y$y \nG81 \n"; } print "x0 y0 \n"; print "(--------------- end of DRL-CIR.PL -------- )\n";