Mach3 plasma floating head macro

Mach3 and Mach4 questions, tips and topics can be posted here
Post Reply
ralphieboy127
Posts: 7
Joined: Sun Dec 16, 2018 9:41 am

Mach3 plasma floating head macro

Post by ralphieboy127 » Mon Jul 19, 2021 10:07 am

Hello All,
I was reading a post on here (can't find it now) about a floating head plasma that used on screen DROS to set the pierce and cut height. I would like also do that in Mach3, I am currently using a floating head with a homemade macro.
It works really great, I am using the spindle delay feature for my pierce delay with an on screen DRO to adjust the pierce delay, I would like to also put the pierce and cut height on a screen DRO as well to easily adjust (instead of modifying my macro each time) is there anyone out there that might be able to help me with this? If you have any other suggestions as far as any possibly speed changes.
Thank you, Ralph
Here is the macro I am using now:

M14 TO FIRE THE TORCH
Code "G00 Z-50 F7000"
Code "G31 Z-85 F800"
Sleep(500)'Delay in M/S
Code "G92 Z-3.8"
Code "G00 Z0.0000"
Code "M03"
Code "G01 Z-2.0 F1500"

M15 TO STOP THE TORCH
Code "M05 G92.1 G00 Z-45 F7000"

This macro is called M14 on my machine so when a cut is required I use M14 (which includes M03 to fire the torch)
It sends the torch down to -50mm at a fast pace, then slows it up to -85 (it will always hit the material between -60 and -80mm) my Z axis homes in the up position at about 75mm from the table.

User avatar
acourtjester
Elite Contributing Member
Elite Contributing Member
Posts: 5490
Joined: Sat Jun 02, 2012 6:04 pm
Location: Pensacola, Fla

Re: Mach3 plasma floating head macro

Post by acourtjester » Mon Jul 19, 2021 12:12 pm

You should be able to use a different post processor to handle these thing as an automatic operation no macro. One thing is the G31 is a probe command and you should be using a G28 for floating head switch, that will give you a switch offset line in the code
DIY 4X4 Plasma/Router Table
Hypertherm PM65 Machine Torch
Drag Knife and Scribe
Miller Mig welder
13" metal lathe
Small Mill
Everlast PowerTig 255 EXT

robertspark
Elite Contributing Member
Elite Contributing Member
Posts: 1411
Joined: Mon Jun 12, 2017 6:43 pm

Re: Mach3 plasma floating head macro

Post by robertspark » Mon Jul 19, 2021 3:34 pm

You can use a macro to automate the process if you wish (difference between 6 and 2 three's.... same destination....)

I see what you are doing... I presume you are using G28 to home the axis to the top / highest point on the Z-axis furtherest away from the table / material.

That is fine, lots of guys do do that (such as in Linuxcnc for instance + with the Neuron THC).

However..... you do need to consider the difference between "Work" co-ordinates and "Machine" co-ordinates.

Your macro works in "Work" co-ordinates {which is fine, but there is a catch} G92 provides an offset to the Work-Coordinates...... your M15 tries to clear this with G92.1

But if you stopped the cut part way through it would not run the G92.1 and your torch will crash when you next run
Code "G00 Z-50 F7000"

The fix (correct way to do what you are trying to do) is use G53.... Move in Machine Coordinates, these NEVER change, until you next home the machine again and reset the machine co-ordinates again

instead of adding an M14, and M15 you can just edit M3 and M5 to add in the following code which will then do what you want it to without having to use G92.1 to clear the temporary offset (G92).

Edit M3 Macro to amend / add the following code

Code: Select all

Code "G53 G00 Z-50" 'move to clearance height
Code "G31 Z-85 F800"
Sleep(500)'Delay in M/S
Code "G92 Z0.0" 'you may want to set the switch offset here as -0.6 or something similar
Code "G00 Z3.8" ' rise to pierce height
DoSpinCW() 
Code "G01 Z1.5 F1500" ' drop to cut height
Edit M5 Macro to amend / add the following code

Code: Select all

DoSpinStop() 
Code "G53 G00 Z-50" 'retract to clearance height

The clearance height has been set as the same number (50mm below the Z-axis home) so that the torch does not rise to -45, then drop to -50 and then probe..... you may as well use the same clearance height.

Also G00 / G0 is a rapid linear gocode move, it does not use a feedrate as it uses the rapid feedrate stored within Mach3.

Also consider the switch offset if you are using a floating head with a mechanical switch as it won't have a Zero offset

I don't know what plasma cutter you are using but the Hypertherms tend to use 1.5mm cut height (technically a bit higher as its 1/16" (0.0625" / 1.5875mm))

Like Tom says, you can do all this within the post processor too..... but the destination is the same.

ralphieboy127
Posts: 7
Joined: Sun Dec 16, 2018 9:41 am

Re: Mach3 plasma floating head macro

Post by ralphieboy127 » Tue Jul 20, 2021 1:06 pm

WOW, I like it... I just have a few questions

I am not using G28, do I have to? I have a limit switch for the Z axis and I am homing in the up position (sound OK? It works really well)

This should ref the material for each cut, right? (just as I had it)

So it looks like the torch will have the same (unless I tweak it) up down motion between cuts?

When will the Z offset get cleared after each M5?

I was wondering what screen editor you were using? I am using Screen 4 (works ok but seems to crash a lot)





Thanks A Million for you help, Ralph

User avatar
acourtjester
Elite Contributing Member
Elite Contributing Member
Posts: 5490
Joined: Sat Jun 02, 2012 6:04 pm
Location: Pensacola, Fla

Re: Mach3 plasma floating head macro

Post by acourtjester » Tue Jul 20, 2021 3:39 pm

the purpose for the G28 or G31 is to find the metal surface for each start of a cut routine. this means it touches the surface which can be at different height due to warpage or crud on the grate the metal sits on. Your Z home does not see these things. Both work in a similar way, drop the torch tip to the metal and set Z to 0.0. The G28 has an extra step in that it corrects for any distance between the switch close and them back open (like backlash). The G31 (Ohmic sensor) is sensitive enough so that step is not needed. These make the pierce height always the same. And no the M5 only signals the end of cutting to shut off the torch. The G-code with then signal the Z to move up for clearance for rapid movement to the next cut location or back to X and Y 0.0
DIY 4X4 Plasma/Router Table
Hypertherm PM65 Machine Torch
Drag Knife and Scribe
Miller Mig welder
13" metal lathe
Small Mill
Everlast PowerTig 255 EXT

ralphieboy127
Posts: 7
Joined: Sun Dec 16, 2018 9:41 am

Re: Mach3 plasma floating head macro

Post by ralphieboy127 » Tue Jul 27, 2021 10:24 am

Well I tried everything, and still nothing is it because I am using Mach3 in simulate mode? it does have the license key installed, is there anything in general config I should have checked/unchecked? Here is my macro

'FLOATING HEAD PLASMA VB SCRIPT

Code "G53 G00 Z-50" 'move to clearance height
Code "G31 Z-85 F800" 'move to TOM
Sleep(500)'Delay in M/S
Code "G92 Z0.0" 'the switch offset value goes here
Z = GetUserDro (1200)'rise to pierce height equal to data entered in "pierce height" DRO 1200
P04 = GetOemDro (217)'delay time to pierce equal to data entered in "pierce delay" DRO 217
DoSpinCW()
Z = GetUserDro (1201)'drop to cut height equal data entered in "cut height" DRO 1201

User avatar
acourtjester
Elite Contributing Member
Elite Contributing Member
Posts: 5490
Joined: Sat Jun 02, 2012 6:04 pm
Location: Pensacola, Fla

Re: Mach3 plasma floating head macro

Post by acourtjester » Tue Jul 27, 2021 1:59 pm

Ok with Mach 3 when you select simulate mode that takes full control of that function. Example if you use the Up for the up THC and simulate with the key of T only the keyboard T will operate that function. It will ignore the G-code. to move the THC up, only if you hit the T key will it move. This is only an example of how the simulate works.
Your G-code is confusing, it looks like you home the Z at the top (OK) and then you have the command G53 to Z-50 (I assume you are using MM) as clearance height (rapid movement around the table). next you use the G31 (probe command) and a distance of -85. Are you sure the metal surface is always -85 MM from the Z home position. Both the G31 and G28 are hunting commands not a distance, meaning with your command it will move down -85 but should find the surface before that and signal mach with that probe touching the surface. If it is lower than that it will stop (I think with an error Probe not sensed). You then tell it that is Z 0.0. Which I assume you then move to your pierce height which most likely is not correct.
DIY 4X4 Plasma/Router Table
Hypertherm PM65 Machine Torch
Drag Knife and Scribe
Miller Mig welder
13" metal lathe
Small Mill
Everlast PowerTig 255 EXT

ralphieboy127
Posts: 7
Joined: Sun Dec 16, 2018 9:41 am

Re: Mach3 plasma floating head macro

Post by ralphieboy127 » Tue Jul 27, 2021 3:14 pm

I wanted to answer you in red but no luck...(as usual..LOL)...so I used all caps sorry.............


Your G-code is confusing, it looks like you home the Z at the top (OK) CORRECT

and then you have the command G53 to Z-50 (I assume you are using MM) as clearance height (rapid movement around the table). CORRECT

next you use the G31 (probe command) and a distance of -85. Are you sure the metal surface is always -85 MM from the Z home position. CORRECT

Both the G31 and G28 are hunting commands not a distance, meaning with your command
it will move down -85 but should find the surface before that and signal Mach with that probe touching the surface. CORRECT

If it is lower than that it will stop (I think with an error Probe not sensed). You then tell it that is Z 0.0. Which I assume you then move to your pierce height which most likely is not correct. IF IT MISSES THE MATERIAL FOR WHATEVER REASON: IT WILL HIT A LIMIT SWITCH AROUND -90 MM AND THE MACHINE WILL STOP

Is it possible to pull the "pierce" and "cut height from the DROs that I put on my page?

Thanks, Ralph

Post Reply

Return to “Mach3 & Mach4 CNC”

Industry Pros use FastCut CNC