I've seen it asked on here before about how to do a trial run without the torch firing. The normal answer is to turn off the plasma power supply and click the buttons to put DTHC into manual and turn it off. I was reading about Mach3 one day and discovered a useful feature. It is called Block Delete. It temporarily modifies the g-code to remove lines preceded by a "/" character. My research revealed it is usually used to skip part of a cutting routine such a hole on a part on a mill. On a mill, there may be a mechanical button to activate this function. It doesn't appear to be used for plasma cutting, but I have found it to be very useful.
To make it work slash characters must be inserted in the g-code before every line that will be toggled. The SheetCam post can be modified to accomplish this. The slash needs to be at the beginning of the line before the line number so it needs to be inserted in the OnNewLine function instead of in the actual line code.
Here's how I did it.
In the SheetCam post
in OnInit() add
addBDslash = "" --adds a slash to the lines that will be toggled with the Trial Run button (aka Block Delete)
this initializes the variable used to hold the slash character
in OnNewLine change
post.Text ("N")
to
post.Text (addBDslash,"N")
this will insert the slash or nothing depending on the value of the variable
add these two lines around the line that should be deleted
addBDslash = "/"
addBDslash = ""
for ex.
addBDslash = "/"
post.Text (" M03\n")
addBDslash = ""
This line will then be toggled with the button.
I recommend using this on M03,M04, M07, M08 and DTHC On command
the M05 and M09 do not need to be toggled because they are off commands. The DTHC off command doesn't need to be toggled either.
The slashes have no effect in the normal running of the code.
To add the button to the Mach3 screen
In the Mach3 screen editor
Add a button (or copy an existing button and change the properties)
Function: OEM Block Delete switch toggle
Text on ctrl: Trial Run
Add an LED (or copy an existing LED and change the properties)
Function: Block Delete On LED
Color: Led green (or another color if you prefer)
Blink: No (or Yes if you prefer)
Here's where I put mine.
When you run Mach3 and load some code with the slashes present if you click the button the LED will light and the g-code will reload with the slashed lines removed and blank lines in their place. Click the button again and the LED will go out and the g-code will reload with the slashed lines restored.
Hope someone else finds this as useful as I have.
Trial Run Button for Mach3
- djreiswig
- 4.5 Star Elite Contributing Member
- Posts: 2075
- Joined: Thu Nov 19, 2015 10:02 pm
- Location: SE Nebraska
Trial Run Button for Mach3
2014 Bulltear (StarLab) 4x8
C&CNC EtherCut
Mach3, SheetCam, Draftsight
Hypertherm PM65
Oxy/Acetylene Flame Torch
Pneumatic Plate Marker, Ohmic, 10 inch Rotary Chuck (in progress)
C&CNC EtherCut
Mach3, SheetCam, Draftsight
Hypertherm PM65
Oxy/Acetylene Flame Torch
Pneumatic Plate Marker, Ohmic, 10 inch Rotary Chuck (in progress)
-
- 3.5 Star Member
- Posts: 681
- Joined: Wed Nov 26, 2014 5:12 pm
Re: Trial Run Button for Mach3
In your for example you put this
for ex.
addBDslash = "/"
post.Text (" M03\n") is this supposed to be back slash or a forward slash???
addBDslash = ""
Thanks for posting this, it sounds like a good toggle to have.
for ex.
addBDslash = "/"
post.Text (" M03\n") is this supposed to be back slash or a forward slash???
addBDslash = ""
Thanks for posting this, it sounds like a good toggle to have.
- djreiswig
- 4.5 Star Elite Contributing Member
- Posts: 2075
- Joined: Thu Nov 19, 2015 10:02 pm
- Location: SE Nebraska
Re: Trial Run Button for Mach3
That one is a backslash. It simply ends the line. Sometimes they use post.Eol() on the next line instead of the \n. The work the same. That's not the important part, just to show what it might look like in your post. Just find the lines in your post that fire the torch and surround it with the two addBDslash lines.
I'm not a post editing expert, so you may have to play around with where you make the additions to get the end result to work correctly.
I'm not a post editing expert, so you may have to play around with where you make the additions to get the end result to work correctly.
2014 Bulltear (StarLab) 4x8
C&CNC EtherCut
Mach3, SheetCam, Draftsight
Hypertherm PM65
Oxy/Acetylene Flame Torch
Pneumatic Plate Marker, Ohmic, 10 inch Rotary Chuck (in progress)
C&CNC EtherCut
Mach3, SheetCam, Draftsight
Hypertherm PM65
Oxy/Acetylene Flame Torch
Pneumatic Plate Marker, Ohmic, 10 inch Rotary Chuck (in progress)
- East German
- 4 Star Elite Contributing Member
- Posts: 599
- Joined: Sat Jan 05, 2013 8:21 am
- Location: Stapelburg Germany
Re: Trial Run Button for Mach3
Hello,
This is a must have button!
Here is another way:
Make a LED on off Button and a LED on the screen, here ist the Code with User LED 1320:
If(GetUserLED (1320)=1) Then
SetUserLED(1320,0)
Else
SetUserLED(1320,1)
end if
In the Macro M3 this:
If (GetUserLED(1320)=0)Then
DoSpinCW()
End If
Is an easy way I have been working very well for years.
Peter
This is a must have button!
Here is another way:
Make a LED on off Button and a LED on the screen, here ist the Code with User LED 1320:
If(GetUserLED (1320)=1) Then
SetUserLED(1320,0)
Else
SetUserLED(1320,1)
end if
In the Macro M3 this:
If (GetUserLED(1320)=0)Then
DoSpinCW()
End If
Is an easy way I have been working very well for years.
Peter
Sorry for my language! The last English class was in 1982.
Homemade CNC Plasma-Watertable
MyPlasmCNC
Hypertherm Powermax 85
Machine Torch
Hypertherm Powermax 1100
Machine Torch
Homemade CNC Plasma-Watertable
MyPlasmCNC
Hypertherm Powermax 85
Machine Torch
Hypertherm Powermax 1100
Machine Torch
- djreiswig
- 4.5 Star Elite Contributing Member
- Posts: 2075
- Joined: Thu Nov 19, 2015 10:02 pm
- Location: SE Nebraska
Re: Trial Run Button for Mach3
Yes, but that only handles the torch fire. I have mine set up to also switch the DTHC and my scribe.
2014 Bulltear (StarLab) 4x8
C&CNC EtherCut
Mach3, SheetCam, Draftsight
Hypertherm PM65
Oxy/Acetylene Flame Torch
Pneumatic Plate Marker, Ohmic, 10 inch Rotary Chuck (in progress)
C&CNC EtherCut
Mach3, SheetCam, Draftsight
Hypertherm PM65
Oxy/Acetylene Flame Torch
Pneumatic Plate Marker, Ohmic, 10 inch Rotary Chuck (in progress)
- djreiswig
- 4.5 Star Elite Contributing Member
- Posts: 2075
- Joined: Thu Nov 19, 2015 10:02 pm
- Location: SE Nebraska
Re: Trial Run Button for Mach3
I discovered a small issue with my trial run function. Since the torch is running at cut height and the DTHC is not turned on, if the material is warped the torch will tend to drag. To keep this from happening I added an offset value to the post. Basically instead of zeroing the top of the material on a reference, the top of the material is set as a negative number causing the torch to run higher.
My post already has some custom post options for the ref distance and the switch offset, so I simply added another setting for the Z offset.
post.DefineCustomOption("Trial Run Z Lift", "trialZ", sc.unitLINEAR, 0, 127, 6.35)
(I set the range from 0 to 5 inches, defaulted to 0.25 inches. Adjust this to your preferences.)
Then in the Reference function I made the following change
This line after the referencing move
post.ModalText(" G92 Z0.0\n")
is replaced with
post.Text(" G92 Z -")
post.Number (trialZ * scale, "0.00")
post.Text(" (Trial Z Offset)\n")
addBDslash = "/"
post.ModalText(" G92 Z0.0\n")
addBDslash = ""
This sets Z to a negative number instead of zero after the probe or touchoff before raising raising to pierce height. This will add an extra line above the z zero line when not in trial run mode, but it has no affect since the second line resets the Z to zero. When the trial run button is selected, the second zero line is deleted and the first line keeps the Z above the material by the desired amount keeping the torch from dragging.
Hopefully this makes sense.
I did a couple of test runs today and it works great.
My post already has some custom post options for the ref distance and the switch offset, so I simply added another setting for the Z offset.
post.DefineCustomOption("Trial Run Z Lift", "trialZ", sc.unitLINEAR, 0, 127, 6.35)
(I set the range from 0 to 5 inches, defaulted to 0.25 inches. Adjust this to your preferences.)
Then in the Reference function I made the following change
This line after the referencing move
post.ModalText(" G92 Z0.0\n")
is replaced with
post.Text(" G92 Z -")
post.Number (trialZ * scale, "0.00")
post.Text(" (Trial Z Offset)\n")
addBDslash = "/"
post.ModalText(" G92 Z0.0\n")
addBDslash = ""
This sets Z to a negative number instead of zero after the probe or touchoff before raising raising to pierce height. This will add an extra line above the z zero line when not in trial run mode, but it has no affect since the second line resets the Z to zero. When the trial run button is selected, the second zero line is deleted and the first line keeps the Z above the material by the desired amount keeping the torch from dragging.
Hopefully this makes sense.
I did a couple of test runs today and it works great.
2014 Bulltear (StarLab) 4x8
C&CNC EtherCut
Mach3, SheetCam, Draftsight
Hypertherm PM65
Oxy/Acetylene Flame Torch
Pneumatic Plate Marker, Ohmic, 10 inch Rotary Chuck (in progress)
C&CNC EtherCut
Mach3, SheetCam, Draftsight
Hypertherm PM65
Oxy/Acetylene Flame Torch
Pneumatic Plate Marker, Ohmic, 10 inch Rotary Chuck (in progress)
-
- 1/2 Star Member
- Posts: 1
- Joined: Mon Dec 16, 2019 9:34 am
Re: Trial Run Button for Mach3
Hi djreiswig,
Liking what you have created but my small mind is struggling with changing my Mack3 Post Process following the guidelines above. I'm using Mach3 with a Hypertherm plasma cutter. The area I am not understanding is this bit:
addBDslash = "/"
post.Text (" M03\n")
addBDslash = ""
I have completed the easy bit by adding and changing the following:
in OnInit() add
addBDslash = ""
in OnNewLine change
post.Text ("N")
to
post.Text (addBDslash,"N")
If you can help steer me in the right direction that would be cool. I have attached the copy of my current post I have been modifying
Regards
B
Liking what you have created but my small mind is struggling with changing my Mack3 Post Process following the guidelines above. I'm using Mach3 with a Hypertherm plasma cutter. The area I am not understanding is this bit:
addBDslash = "/"
post.Text (" M03\n")
addBDslash = ""
I have completed the easy bit by adding and changing the following:
in OnInit() add
addBDslash = ""
in OnNewLine change
post.Text ("N")
to
post.Text (addBDslash,"N")
If you can help steer me in the right direction that would be cool. I have attached the copy of my current post I have been modifying

Regards
B
- Attachments
-
- Xtreme Plasma Cutting Tables Post - Drilling - M01 - Ohmic - Dry Run - 2021 - Rev. 1.zip
- (3.26 KiB) Downloaded 60 times
- Xtreme Plasma Cutting Tables Post - Drilling - M01 - Ohmic - Dry Run - 2021 - Rev. 1.zip
- (3.26 KiB) Downloaded 60 times
- djreiswig
- 4.5 Star Elite Contributing Member
- Posts: 2075
- Joined: Thu Nov 19, 2015 10:02 pm
- Location: SE Nebraska
Re: Trial Run Button for Mach3
That is just an example. You just need to surround whatever code you want the button to toggle with the two addbdslash lines. Your torch fire code may be different than mine.
I don't have time to look at your post right now, but I'll check it out when I get a minute.
I don't have time to look at your post right now, but I'll check it out when I get a minute.
2014 Bulltear (StarLab) 4x8
C&CNC EtherCut
Mach3, SheetCam, Draftsight
Hypertherm PM65
Oxy/Acetylene Flame Torch
Pneumatic Plate Marker, Ohmic, 10 inch Rotary Chuck (in progress)
C&CNC EtherCut
Mach3, SheetCam, Draftsight
Hypertherm PM65
Oxy/Acetylene Flame Torch
Pneumatic Plate Marker, Ohmic, 10 inch Rotary Chuck (in progress)