Mach 3 Macro based program

Mach3 and Mach4 questions, tips and topics can be posted here
Post Reply
User avatar
pertneer
2.5 Star Member
2.5 Star Member
Posts: 193
Joined: Sun Oct 31, 2010 4:05 pm
Location: 127.0.0.1

Mach 3 Macro based program

Post by pertneer »

I spent the better part of the morning creating a simpler way to just a circle. I recently did a macro at work on a production CNC Mill that did Helical circular interpolation or varying diameters and depth. I looked into Mach3 to see if this kind of thing was even a possibility. I was excited to see that they did, although not to the same extent that high end machining centers are capable of( no conditional statements). So if this interests you keep reading.

First is the program that holds the variables I use in the macro. This is the program that you run:

Code: Select all

(Inside Circle Program)
(Date: 25/10/2014 Pertneer)
#100 = 2.0 (Circle Radius)
#101 = 0.0 (X Position of circle)
#102 = 0.0 (Y Position of circle)
#103 = 75.0 (Fast feed rate)
#104 = 45.0 (Small Radius Feed Rate)
#110 = .064 (Kerf Width)
#111 = .135 (Switch Offset)
#112 = .15 (Pierce Height)
#113 = 40.0 (Touch Off Feed Rate)
#114 = .500 (Clearance Height)
#115 = .06 (Cut Height)
#116 = .4 (Pierce Delay)
#120 = [#100 - [#110/2]]
#130 = [#100 - [#110]]
M98 (O0002.tap)
M30
You change these setting to match what circle you are interested in cutting. You can also do the following to cut more than one circle at a time:

Code: Select all

(Inside Circle Program)
(Date: 25/10/2014 Pertneer)
#100 = 2.0 (Circle Radius)
#101 = 0.0 (X Position of circle)
#102 = 0.0 (Y Position of circle)
#103 = 75.0 (Fast feed rate)
#104 = 45.0 (Small Radius Feed Rate)
#110 = .064 (Kerf Width)
#111 = .135 (Switch Offset)
#112 = .15 (Pierce Height)
#113 = 40.0 (Touch Off Feed Rate)
#114 = .500 (Clearance Height)
#115 = .06 (Cut Height)
#116 = .4 (Pierce Delay)
#120 = [#100 - [#110/2]]
#130 = [#100 - [#110]]
M98 (O0002.tap)
#100 = 4.0 (Circle Radius)
#101 = 6.0 (X Position of circle)
#102 = 0.0 (Y Position of circle)
#120 = [#100 - [#110/2]]
#130 = [#100 - [#110]]
M98 (O0002.tap)
M30
I would have done this for both internal and external but the lack of conditional statements makes this difficult(I may add this to a separate macro later and upload here). I added as much flexibility as possible to allow use with different Plasma cutters, consumables, and material.

This next code is placed in the subroutines directory within the Mach3 install directory. So if Mach3 is installed in C:/Mach then the location of this directory is C:/Mach/subroutines.

Code: Select all

O0002(Filename: O0002.tap)
(Inside Circle Macro)
(Date: 25/10/2014 Pertneer)
(Variables)
(#100 = Radius)
(#101 = X location)
(#102 = Y Location)
(#103 = Fast feed rate)
(#104 = Small Radius Feed Rate)
(#110 = Kerf Width)
(#111 = Switch Offset)
(#112 = Pierce Height)
(#113 = Touch Off Feed Rate)
(#114 = Clearance Height)
(#115 = Cut Height)
(#116 = Pierce Delay)
G20 (Units: Inches)
G53 G90 G40
G55
F1
(Part: circle)
(Process: Inside Offset, MODEL, T160: 45A, .16thick .064 Kerf)
G00 X[[#110]*-1] Y[[#100 - [#110*1.5]]*-1] (Radius * .064 = X dimension; Radius * .904 = Y dimension)
G28.1 Z0.12 F[#113]
G92 Z0.0
G00 Z[#111]
G92 Z0.0
G00 Z[#112]
M03
G04 P[#116]
G01 Z[#115] F[#113]
G03 X[#101] Y[[#120]*-1] I[#110] J0.0000 F[#104]
I0.0000 J[#120] F[#103]
X[#110/2] Y[[#130]*-1] I0.0000 J[#110/2] F[#104]
M05
G00 Z[#114]
X[#101] Y[#102]
M05
M99
This is the working end of the Macro. I took the output from Sheetcam and created this macro to cut any size of hole that you want. My plan is to add an external circle and then work on a Macro to do a square as well. Hope you find this useful and inspiring to the power of a CNC.
4'x8' CNC Plasma w/Water Table Running a Powermax 65 :D
CandCNC, Mach3, SheetCam, Millwrite Plasma V6
User avatar
pertneer
2.5 Star Member
2.5 Star Member
Posts: 193
Joined: Sun Oct 31, 2010 4:05 pm
Location: 127.0.0.1

Re: Mach 3 Macro based program

Post by pertneer »

External Circles programs:
Macro:

Code: Select all

N0010 (Filename: circle_outside.tap)
N0020 (Post processor: MP1000-THC - scriberPertneer.scpost)
N0030 (Date: 26/10/2014)
N0040 G20 (Units: Inches)
N0050 G53 G90 G40
N0060 G55
N0070 F1
N0080 (Part: circle)
N0090 (Process: Outside Offset, MODEL, T160: 45A, .16thick .064 Kerf)
N0100 G00 X[#110] Y[[#100 + [#110*1.5]]*-1]
N0110 G28.1 Z0.12 F[#113]
N0120 G92 Z0.0
N0130 G00 Z[#111]
N0140 G92 Z0.0
N0150 G00 Z[#112]
N0160 M03
N0170 G04 P[#116]
N0180 G01 Z[#115] F[#113]
N0190 G03 X0.0000 Y[[#125]*-1] I[[#110]*-1] J0.0000 F[#104]
N0200 G02 I-0.0000 J[#100+[#110/2]] F[#103]
N0210 G03 X[[#110/2]*-1] Y[[#135]*-1] I0.0000 J[[#110/2]*-1] F[#104]
N0220 M05
N0230 G00 Z[#114]
N0240 X[#101] Y[#102]
N0250 M05 M30
Running program:

Code: Select all

(Test Program)
(Date: 25/10/2014)
#100 = 2.0 (Circle Radius)
#101 = 0.0 (X Position of circle)
#102 = 0.0 (Y Position of circle)
#103 = 75.0 (Fast feed rate)
#104 = 45.0 (Small Radius Feed Rate)
#110 = .064 (Kerf Width)
#111 = .135 (Switch Offset)
#112 = .15 (Pierce Height)
#113 = 40.0 (Touch Off Feed Rate)
#114 = .500 (Clearance Height)
#115 = .06 (Cut Height)
#116 = .4 (Pierce Delay)
#120 = [#100 - [#110/2]]
#125 = [#100 + [#110/2]]
#130 = [#100 - [#110]]
#135 = [#100 + #110]
M98 (O0001.tap)
M30
4'x8' CNC Plasma w/Water Table Running a Powermax 65 :D
CandCNC, Mach3, SheetCam, Millwrite Plasma V6
dustywill
2.5 Star Member
2.5 Star Member
Posts: 214
Joined: Wed Oct 24, 2012 10:29 am
Location: Auburn, AL
Contact:

Re: Mach 3 Macro based program

Post by dustywill »

I'll be the first to thank you for the work. Too cool. I have not played with macros very much, but understand the concept. I don't have time to try and digest the G code right now, but what I saw was fairly straight forward with your commenting. Thanks.
Precision Plasma 4x8 v-rail
C&CNC dragon cut 620
Hypertherm Powermax 45
Auburn, AL
www.facebook.com/decorativemetalworks
Largemouthlou
4 Star Member
4 Star Member
Posts: 1385
Joined: Mon Aug 30, 2010 5:56 am
Location: Palm Bch Gardens Fl
Contact:

Re: Mach 3 Macro based program

Post by Largemouthlou »

Thank you, I only glanced at this this morning have to run back out to work. I must say I need to look at it closer.
1250 hypertherm
4 X 8 Precision Plasma
CandCnC electronics
User avatar
pertneer
2.5 Star Member
2.5 Star Member
Posts: 193
Joined: Sun Oct 31, 2010 4:05 pm
Location: 127.0.0.1

Re: Mach 3 Macro based program

Post by pertneer »

Your welcome, I am just glad someone finds some amount of interest in this. I will post more as I create them. Have plans for a bolt hole circle one also.
4'x8' CNC Plasma w/Water Table Running a Powermax 65 :D
CandCNC, Mach3, SheetCam, Millwrite Plasma V6
Post Reply

Return to “Mach3 & Mach4 CNC”