Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: enytned1 on July 30, 2007, 06:56:28 PM

Title: Ellipse macro for Mach users
Post by: enytned1 on July 30, 2007, 06:56:28 PM
Here is a macro I wrote for cutting an ellipse(oval).  I already tested this out on my Mach3 controlled CNC router and it works great.  I wrote this macro about 10 years ago
when I was playing around with Fanuc macro B programming.  I use it at work for quick cuts.  It normally uses IF and WHILE commands so I replaced this with a sub call.  Just fill in your lenth, width, board thickness, center position etc.  If you make the width and depth the same you will make a circle.

O0001
(ELLIPSE-MAIN)
(BY-ALEKSANDER-KACPERSKI)
#1=12.   ( BOARD WIDTH X )
#2=6.   ( BOARD DEPTH Y )
#3=1.  ( BOARD THICKNESS Z )
#4=10.   ( WIDTH X ELLIPSE )
#5=6.  ( DEPTH Y ELLIPSE )
#6=.5    ( ANGLE INCREMENT )
#7=[#4/2]  ( CENTER POSITION X )
#8=[#5/2]  ( CENTER POSITION Y )
#10=.125   ( DEPTH OF CUT )
#11=[360/#6]
(-------------------------------)
G40 G80 G69 G20
G49
T103
M6
G52 X0. Y0. Z0.
G0 G90 G54 X[#4/2. + #7] Y#8 S16200 M3
G43 Z[#3+2.] H3
G1 Z[#3-#10] F30.
#9=#6
M98 P2 L#11
G0 Z2.
G90 G0 X0. Y10.
G49
G52 X0. Y0. Z0.
M30
%

O0002
(ELLIPSE-SUB)
(BY-ALEKSANDER-KACPERSKI)
G1 X[#4 * COS[#9] / 2. + #7] Y[#5 * SIN[#9] / 2. + #8]
#9=[#9+#6]
M99
%

Thanks
Alek K
Title: Re: Ellipse macro for Mach users
Post by: poppabear on July 31, 2007, 07:19:23 AM
Alek,

And other Mach Users, here is a Wizard based on Aleks wonderful script, to make life easier for us lazy people......
Unzip the folder: Ellipse Wizard.zip and copy and paste the "Ellipse Wizard folder" into machs "Addons", then from in Mach under Wizards you can open and use it.

Scott
Title: Re: Ellipse macro for Mach users
Post by: enytned1 on July 31, 2007, 06:00:17 PM
Just to inform those of you who are interested in the true power of this program.  First make your ellipse length and width value the same for this example.  Then follow the steps below.  Also If you make the length and width of the ellipse different you will get even more shapes, just use your imagination.  All of this has already been tested on my router.


Enter 45 in #6 and you will get a Octagon.
#6=45
or
#6=360/8



Enter 60 in #6 and you will get a Pentagon.
#6=60.   
or
#6=360/5



Enter 90 in #6 and you will get a Rectangle.
#6=90.   
or
#6=360/4



Enter 120 in #6 and you will get a Triangle.
#6=120.    ( ANGLE INCREMENT )
or
#6=360/3