It is currently Mon Oct 22, 2018 1:29 pm

 

Trial Run Button for Mach3

Share tips and tricks you know of in this forum. Plasma cutting, material handling, metal finishing, marketing, or anything that you feel is helpful.
djreiswig
Elite Contributing Member
Elite Contributing Member
Posts: 346
Joined: Thu Nov 19, 2015 10:02 pm

Trial Run Button for Mach3

Postby djreiswig » Mon Dec 11, 2017 9:50 pm

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.

Trial Run button.jpg

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.

You do not have access to download this dxf file.
Become a Contributing Member to gain access to the thousands of files shared by our members. Click Here

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)

Old Iron
Elite Contributing Member
Elite Contributing Member
Posts: 439
Joined: Wed Nov 26, 2014 5:12 pm

Re: Trial Run Button for Mach3

Postby Old Iron » Mon Dec 11, 2017 10:48 pm

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.

djreiswig
Elite Contributing Member
Elite Contributing Member
Posts: 346
Joined: Thu Nov 19, 2015 10:02 pm

Re: Trial Run Button for Mach3

Postby djreiswig » Mon Dec 11, 2017 11:07 pm

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.
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)

User avatar
East German
Elite Contributing Member
Elite Contributing Member
Posts: 390
Joined: Sat Jan 05, 2013 8:21 am
Location: Stapelburg Germany

Re: Trial Run Button for Mach3

Postby East German » Tue Dec 12, 2017 3:58 am

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
Sorry for my language! The last English class was in 1982.

Homemade CNC Plasma-Watertable with Mach 3
Triple Beast + Leadschine Drive
Hypertherm Powermax 85
Machine Torch + PriceCNC THC
Hypertherm Powermax 1100
Machine Torch + Proma THC

djreiswig
Elite Contributing Member
Elite Contributing Member
Posts: 346
Joined: Thu Nov 19, 2015 10:02 pm

Re: Trial Run Button for Mach3

Postby djreiswig » Tue Dec 12, 2017 8:22 am

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)

djreiswig
Elite Contributing Member
Elite Contributing Member
Posts: 346
Joined: Thu Nov 19, 2015 10:02 pm

Re: Trial Run Button for Mach3

Postby djreiswig » Sat Dec 16, 2017 10:05 pm

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.
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)


Return to “Tech Tips”

Who is online

Users browsing this forum: No registered users and 2 guests

Easyscriber engrave attachment for Hypertherm torch's