Help with Mach3 plasma post

Hi Everybody,

I am trying to modify a Mach3 plasma post for SheetCAM to add a function that would reference the torch every time it starts cutting a new part. I have written a macro (call it M100, for example) that references the torch and when executed it works just fine.
Say you have a bunch of nested parts on the plate; what I would like to see happening when you run the program is (in this sequence):

  • the machine moves to the first cut
  • references the torch (M100)
  • starts doing the inside cuts then cuts out the outside perimeter on the first part
  • moves over to the starting point on the first cut of next part
  • references the torch again (M100) and the cycle continues on and on.

Looking at the post I have noticed this function:
function OnNewPart()
post.Text(" (Part: “,partName,”)\n");
end

and added the M100 to it so it now reads:
function OnNewPart()
post.Text(" (Part: “,partName,”)\n")
post.Text (" M100 ")
end

It kinda works with the exception that it issues the M100 before the torch is turned off. Here’s an example of the wrong Gcode sequence:
.
.
.
N0370 G01 Y5.0000 (machine finishes the cut on first part)
N0380 (Part: Square1 Duplicate 1)
N0390 M100 (references the torch)
N0400 (Operation: Outside Offset, 0, T1: Jet tool) (this is part #2)
N0410 M05 (M05 turns torch off)
N0420 G04 P800 (waits 800ms after torch is turned off)
N0430 G00 Z0.5000 (lifts to clearance plane)
N0440 X2.9560 Y8.9560 (moves over to the starting point of first cut on part #2)

Correct sequence should be
.
.
.
N0370 G01 Y5.0000 (machine finishes the cut on first part)
N0380 M05 (M05 turns torch off)
N0390 G04 P800 (waits 800ms after torch is turned off)
N0400 G00 Z0.5000 (lifts to clearance plane)
N0410 (Part: Square1 Duplicate 1)
N0420 (Operation: Outside Offset, 0, T1: Jet tool) (this is part #2)
N0430 X2.9560 Y8.9560 (moves over to the starting point of first cut on part #2)
N0440 M100 (references the torch)

Attached is the post with the small mod added to the function OnNewPart() line.

Any suggestions would be highly appreciated.
Mach3 plasma.scpost (4.03 KB)

Nobody has any suggestions? If you can think of something pls help.

Thank you

Try this:

function OnPenDown()
   post.Text(" M100\n")
   post.ModalText (" G00")
   post.Text(" Z")
   post.Number (pierceHeight  * scale, "0.0000")
   post.Eol()
end

This will trigger a probe just before the cut then move to pierce height.

Thanks Les.
The solution you suggested will trigger the probe every time it starts a new cut. What I wanted to do (if possible) was to trigger the probe every time the machine starts cutting a new part.
When I saw function OnNewPart() in the post I thought it will do the trick. In fact it does something, but not entirely correct; it triggers the probe at the end of the last cut while the torch is still on. Check the G code below:

N0370 G01 Y5.0000 ((machine finishes the cut on first part))
N0380 (Part: Square1 Duplicate 1)
N0390 M100 ((triggers the probe))
N0400 (Operation: Outside Offset, 0, T1: Jet tool) ((this is part #2))
N0410 M05 ((M05 turns torch off))
N0420 G04 P800 ((waits 800ms after torch is turned off))
N0430 G00 Z0.5000 ((lifts to clearance plane))
N0440 X2.9560 Y8.9560 ((moves over to the starting point of first cut on part #2))

For ease of understanding I have added my comments within double brackets (( )).

I see what you mean. For plasma you could end up with too much distance between probes if you are cutting larger parts with a number of holes.
The Mach3 THC with scriber post does a reference based on distance. It will only probe if the cut distance from the last probe is greater than a given amount. This way if you have a lot of cuts close together it will limit the number of probing cycles.

There are times when the torch does not need to lift between the end of the last part and the start of the next part (e.g chaining). SheetCam only knows if it needs to lift the torch after it has started the new part, which is why OnNewPart triggers with the torch still down.

Anyway here is how you could get it to probe every part:
In function OnNewPart() add this line:

   doProbe = true

Your OnPenDown should look like this:

function OnPenDown()
   if not doProbe then return end
   doProbe = false
   post.Text(" M100\n")
   post.ModalText (" G00")
   post.Text(" Z")
   post.Number (pierceHeight  * scale, "0.0000")
   post.Eol()
end

Hi Les,
That did the trick, thanks a bunch for the help.
I am aware of the scriber post where you can specify the reference distance, but most of the times the parts are small. When cutting larger parts with a bunch of inside holes, it makes sense to use the THC with scriber post.
Again, thanks a million times.

Just curious where is pierceheight defined? I am not sure I understand the probe code at all. For instance with my torch the probe can go down about .100" after the torch touches the metal before the probe switch is toggled.

pierceHeight is defined in your tool definition. Referencing depends on your machine setup. For example CTECH has a macro M100 that does the referencing. The post spits out an M100 and the M100 macro does the work of finding the top of the work and zeroing the Z axis.
Most of the SheetCam posts generate a probing or homing cycle then apply the switch offset. Take a look at the ‘Mach3 THC with scriber’ post. At the start of the post are a number of configuration options that allow you to define the probing cycle and switch offset. This is where your 0.1" offset would go.

By the way the best way I have found to measure your switch offset is to place a hefty sheet of steel on the machine then place a sheet of paper on top. Touch the torch on the paper then slowly jog down until the switch trips. Zero your Z axis then slowly jog up while pulling gently on the paper. Stop when the paper slides out from under the torch. Your Z axis DRO now shows the exact switch offset.