Custom plasma probing code??

I’m looking at testing a new initial height sensing method on my plasma table, it currently uses G28.1 I think and the Z-limit as the response input from the floating z switch. Not sure if this is a Mach3 code or a SheetCam post code change?

I want to trigger the Aux-B relay before lowering the Z to probe and release Aux-b relay after a good probe.

SO the sequence would be

Probe request, Z is already at safety height as normal,
Trigger Aux-B relay
Lower head until Z-Lim is tripped
Lift head back to safety height
Release Aux-B relay
Lower head to pierce height allowing for offset as normal,
Continue to M3 etc

Trouble is, while i can do the mechanicals, i have little knowledge of how to achieve the control in my case.
I can tweak the G-code post processor in sheet cam pretty well though :slight_smile:

Any tips?

Maybe it’s this simple???
Small changes to post file, lines marked XXXXXX

   if (refHome) then
      post.ModalText(" G28.1 Z")
      post.Number(plungeSafety * scale, "0.00")
	  if (verbose == true) then
	  post.Text ("  (Start Touch-Off )")
      post.ModalText(" G31 Z -100")
	  post.ModalNumber (" F", refFeed * scale, "0.0###")
   post.ModalText(" G92 Z0.0\n")
    if (switchOffset == 0)  then
       -- do nothing
      post.ModalText (" G00")
      post.Text(" Z")
      post.Number (switchOffset * scale, "0.000")
	  if (verbose == true) then
      post.Text(" (Switch Offset Lift)")
	  post.ModalText(" G92 Z0.0\n")

Produces G-code like this…

N0210 G00 X36.000 Y17.475 Z15.000
N0220 M900 (Check for Z active)
N0230 M08 (Turn on extract fan)
N0240 M07 (Insert probe switch) XXXXXXXXXX
N0250 G28.1 Z3.00 (Start Touch-Off )
N0260 G92 Z0.0
N0270 M09 (Retract probe switch)XXXXXXXXXX
N0280 G00 Z3.400 (Switch Offset Lift)
N0290 G92 Z0.0
N0300 G00 Z3.8000
N0310 M03
N0320 G01 Z1.500 F1300.0
N0330 S20 (DTHC is ON)
N0340 G01 Y11.475 F4100.0

I think that will work?
The idea is to fire an air cylinder to insert a small, very accurate switch under the plasma tip to sense plate height without pressing down on the plate and causing it to deflect.

That looks like it would work. Something to think about - While I use LinuxCNC for control, I can (and do) use a subroutine for touch-off. In my SheetCAM post, I only have one line for touch-off:

 o<TouchOff> call

That way, if I make any mechanical changes to my table’s setup, I don’t have to re-program all current jobs. All I have to do is make my changes in the one “TouchOff” file for all future cycles.

Just though I would throw that out if you also have this option.


very nice idea, i’m guessing that would be a custom macro in mach3?

this would then be replaced with a single call in the post??

I’m not sure how Mach does things, sorry.

Yes, a single call will initiate the routine. Part of my post looks simply like this:

function Reference&#40;&#41;
   firstRef = false
   post.ModalText&#40;" o<TouchOff> call\n"&#41;

When the code is loaded in LinuxCNC, LinuxCNC looks for the file named “touchoff” and internally replaces “o call” with the contents of the file. LinuxCNC will throw out an error if the file cannot be found.

The main reason I started using this method was for floating head switch location - In case there is a small offset change if I would need to replace the switch someday, I didn’t want to update all current jobs.

yes that does sound like a mach custom macro, i’ll do some research.

i have already been caught multiple times by changes in switch offset :frowning:

Yes - I have been there, done that :wink:

Seems like a mach subroutine would be better, just a bit more reading to so, appears that mach prefers g-code to macro code so getting it into g-code and using the M98 (heightsense.tap) call is best

sorted - got the software working with a mach subroutine and a mach brain, full details here…,31543.10.html

All i have to do is the hardware but that will wait until i return to work.

I have modded the sheet cam post to call the subroutine rather than perform the G28.1 itself - this gets the initial height setting relative to the machine and not the code file so when the switch offset changes i only have one place to update it and the code will run as it did before - nice.