[for information of a.m.c. readers, I recently bought a Bridgeport
mill without CNC controls]
I came to a realization that I can write perl scripts that would tell
me exactly how to turn my mill's handles, to get more or less any
compound curves I want. Backlash is an obvious issue that is easily
addressed without problems.
So, I wrote a script (attached) that would tell me how to mill out a
perfect 1/4 of a 1" diameter circle in a flat piece. The output of
this script is also attached, and is basically a series of dial
positions for the X and Y axes.
Then I printed it, walked to the mill, and turned machine handles
exactly as the script told me. In the end, voila, I had a perfect 1/4
of a circle.
Doing just one quarter of a circle allowed me not to deal with
backlash issue, which can be extremely easily addressed on Bridgeport
style mills (where dials can be released and turned without moving the
tables), but I just did not want the hassle.
I can post a photo of the result if anyone is interested.
It took me about 5 minutes, and would probably take less time after I
get more used to the process or have a helper read lines to me, or
maybe learn to turn handles with two hands one on each handle.
my $pi = 3.1415926;
my $r = 1/8; # 1/4" endmill
my $phi_start = 0;
my $phi_end = $pi/2;
my $phi_step = 2 * (2*$pi/360); # 2 degree
my $xmark = 0.001;
my $x_circle = 200; # 0.1"
my $ymark = 0.001;
my $y_circle = 200; # 0.1"
my $x0 = 0;
my $y0 = 0;
my $R = 1;
my $x_start = $x0 + ($R-$r)*cos( $phi_start );
my $y_start = $y0 + ($R-$r)*sin( $phi_start );
my $x_start_dial = 0;
my $y_start_dial = 0;
my $old_x_dial = $x_start_dial;
my $old_y_dial = $y_start_dial;
print "Set X dial to $x_start_dial\n";
print "Set Y dial to $y_start_dial\n";
for( my $phi = $phi_start + $phi_step; $phi 0, Y => 30
Move X => 198, Y => 61
Move X => 196, Y => 91
Move X => 192, Y => 121
Move X => 187, Y => 151
Move X => 181, Y => 181
Move X => 175, Y => 11
Move X => 167, Y => 41
Move X => 158, Y => 70
Move X => 148, Y => 99
Move X => 137, Y => 127
Move X => 125, Y => 155
Move X => 112, Y => 183
Move X => 98, Y => 10
Move X => 83, Y => 37
Move X => 68, Y => 63
Move X => 51, Y => 89
Move X => 33, Y => 114
Move X => 15, Y => 138
Move X => 196, Y => 162
Move X => 176, Y => 185
Move X => 155, Y => 7
Move X => 133, Y => 29
Move X => 111, Y => 50
Move X => 88, Y => 70
Move X => 64, Y => 89
Move X => 40, Y => 107
Move X => 15, Y => 125
Move X => 189, Y => 142
Move X => 163, Y => 157
Move X => 136, Y => 172
Move X => 109, Y => 186
Move X => 81, Y => 199
Move X => 53, Y => 11
Move X => 25, Y => 22
Move X => 196, Y => 32
Move X => 167, Y => 41
Move X => 137, Y => 49
Move X => 107, Y => 55
Move X => 77, Y => 61
Move X => 47, Y => 66
Move X => 17, Y => 70
Move X => 187, Y => 72
Move X => 156, Y => 74
I like what you did, however you may want to consider
learning a bit about spreadsheets. You can do this sort of thing
on a spredsheet with much better control ( resolution and such ) and
a whole lot easier.
I would, indeed, be interested to know. Note though that I can easily
change the step (resolution) of the process with my script, all I need
is to change variable $phi_step. The more resolution, the more manual
work (and more accuracy).
I am at least a half decent perl programmer.
I am going to try to expand these scripts to perform arbitrary
compound curve calculations (figure out where the center of an endmill
should go to produce a certain curve, taking the curve as a
Note that not all curves can be made with a round endmill of a given
diameter. Think about a heart shape cut from outside.
I also plan to add some features to address the backlash issue.
Whenever X or Y feed direction changes, I have to print a reminder to
the operator to fix backlash (ie lock the table, turn the handle in
the other direction to eat all backlash, then adjust the dial to be at
previous position, then unlock the table).
I also want to do something so that I do not have to use the printer
-- that is, being my Linux laptop closer to the mill.
Scripts are more flexible than spreadsheets.
Forgot to add. Depending on the curvature, iteration step and whether
X movements are performed before or after Y movements, an adjustment
should be also made, or else the curve wil be a little different. This
is all high school math, mostly, just needs to be done correctly.
Retrofit your Bridgeport for CNC. I recently completed a retrofit on my
Chinese Bridgeport clone. I did not change to ball screws (too expensive). I
am using steppers, Gecko 203V drivers and Mach3 software. The cost was about
$1,500. Let me know if you want more details. BTW, this was my third CNC
I am definitely interested. One page I saw was Richard Kinch's
bridgeport conversion. I would like to know more about it. I think
that software can compensate for backlash of regular screws, perhaps
with the exception of when the endmill grabs material etc.
Let me know what you did, thanks. Maybe you have some photos? Did you
use a stock kit or did you put it all together yourself?
Seems like your a perl scripter who's looking for a script to write.
Even though your script looks like its miles long, its actually very
compact. Not a fan of strict or my, but that doesn't add much.
What you need is a purpose for your scripts.
And screw the guys saying use excel or spreadsheets, they work just fine,
but perl is better. You can get to things excel wont do, but you will never
get to something perl cant do.
Im not interested in cutting a circle on a bridgeport, but your thinking
in the right direction. Keep posting your programs please.
One suggestion, make it more user friendly for those who dont program, have
it prompt you for input such as degrees, endmill size, etc... Then make it
an executable using perl2exe.
Especially once you want to go further (complex curves, step computed
automatically to allow for a given accuracy/finish etc).
What I think I want is to eventually write a script that would read
config lines. Every line will say what shape to cut (assuming X-Y
outside arc R=2 x0=1.4 y0=3.6 angle1=43 angle2=68 depth=1.14
That would mean cut an arc from the outside radius 2, center in
(1.4,3.6), starting angle 43, ending angle 68. Mill depth 1.14".
(I would have a library of curves adding as needed).
It would output instructions like in my original post, saying
- move to point such and such (using a DRO)
- lower quill to 1.14"
- set dials to such and such
- and then many instructions to turn the dials.
So all I would have to do is position the part, do exactly as the
script says, with looking at the part completely optional. ;)
I want it to read a config file, I think.
I may make it into a module on CPAN, I already have my Net::eBay
module available on CPAN.
The nice thing here is that I can experiment all I want at low cost
I have no understanding of CNC hardware and doing the above, may get
me a little more understanding of the process (and would let me make
any parts I want, though slowly).
The boss wanted our haas mill to probe an electrode, and then send to the
edm the distance in x-y-z it was off location, PERL!!!!
Using the haas print, my perl script was able to get that data, and convert
it to the format the edm needed, then saved it on the edm using the network
in whats called a measurement file..
It worked great...but nobody would use it, the owner is still pissed a year
or two later. (I just lead the horse to water, I dont hold his head under
water till he drinks)
But who cares, it was good training. And now i can say I connected a haas
directly to an agie edm.(useless skill for the moment). But go try to buy
something to do that?
Very interesting. Note also that for many shapes, round endmills
smooth out the resulting curve, even if X and Y movements are not
completely synchronized. The removed material is the union of all
circles that occurred on the way.
Somewhere I either read or was told this is how NC was started. Some
Aerospace company was milling complex curves and was using a manual
machine with 3 machinists, one on the X hand wheel, one on the Y hand
wheel and one reading movements off a printout. Each hand wheel guy
would try to move his increment in the same amount of time the other
guy did. One might move .003 the other .001 For accuracy, speed or
both it then went from the "computer" just printing out the moves to
actually making the moves.
Remove 333 from email address to reply.