Wierd Z axis offset issue

Having problems with or questions about SheetCam? Post them here.
Post Reply
finyuk2005
Posts: 12
Joined: Wed Mar 27, 2024 5:06 pm

Wierd Z axis offset issue

Post by finyuk2005 »

I have been re-powering a Plasma table recently, at the stage of first test cut, starting to get the hang of things now,
but I am having a strange issue where after zeroing the z axis off the material, the torch then seems to stay about 10mm higher than it should at the pierce and cut heights as well as the rapids heights.
I did do a bit of copy pasting of the G31 top of material routine from one post processor into another that is supposed to be for my torch height controller (Razordance THC), so it is possible i have added something i shouldnt in the post processor code.
Unless there is a tool offset setting somewhere else in sheetcam or mach3 that i have overlooked?

cheers for any help!!
finyuk2005
Posts: 12
Joined: Wed Mar 27, 2024 5:06 pm

Re: Wierd Z axis offset issue

Post by finyuk2005 »

I have got the Z axis zeroing perfectly when using MDI in mach 3, (g31 z-100 f200) and then (g92 z0),
Also I am running the program without the THC clicked on in mach3 and the plasma cutter switched off, so just a dry run, not sure if that would cause the strange offset?
finyuk2005
Posts: 12
Joined: Wed Mar 27, 2024 5:06 pm

Re: Wierd Z axis offset issue

Post by finyuk2005 »

here is the first few bits of the gcode, I cant see anything wrong here, but i am just a beginner!

N0040 G21 (Units: Metric)
N0050 G53 G90 G91.1 G40
N0060 F1
N0070 S500
N0080 G31 Z-100 F400
N0090 G92 Z0
N0100 (Part: smallcleats-Sketch)
N0110 (Operation: Inside Offset, inside, T1: Plasma inside, 10mm)
N0120 M06 T1 F600.0 (Plasma inside, 10mm)
N0130 G00 Z20.0000
N0140 X-52.9423 Y119.7730
N0150 Z3.6000
N0160 G31 Z -100 F400.0
N0170 G92 Z0.0000
N0180 G00 Z3.6000
N0190 M03
N0200 G04 P0.7
N0210 G01 X-52.9423 Y119.7730 Z1.5000 F100.0
N0220 G02 X-50.2270 Y119.7730 I1.3576 J-1.3576 F600.0
N0230 X-50.2270 Y119.7730 I-4.7730 J-4.7730
N0240 X-50.2270 Y117.0577 I-1.3576 J-1.3576
finyuk2005
Posts: 12
Joined: Wed Mar 27, 2024 5:06 pm

Re: Wierd Z axis offset issue

Post by finyuk2005 »

this is the post processor

function OnAbout(event)
ctrl = event:GetTextCtrl()
ctrl:AppendText("Mach3 + razordance plasma post processor\n")
ctrl:AppendText("\n")
ctrl:AppendText("Modal G-codes and coordinates\n")
ctrl:AppendText("Comments enclosed with ( and )\n")
ctrl:AppendText("M03/M05 turn the torch on/off\n")
ctrl:AppendText("Incremental IJ\n")
end


-- revision 3/2/07
-- Removed final safety move. This is now done in SheetCam

-- revision 7/10/05
-- Added new arc handling

-- revision 11/7/05
-- Moved torch to cut height when preheating
-- Added dummy spindle speed to prevent Mach2 throwing a zero spindle speed error

-- revision 9/10/04
-- Added preheat

-- revision 28/6/04
-- Replaced startx,y,z with currentx,y,z

-- created 28/5/04
-- Based on Mach2 metric.post

post.DefineCustomToolParam("PlasmaTool", "Voltage", "voltage", sc.unit0DECPLACE,0,300)

voltage = 0

function OnInit()

post.SetCommentChars ("()", "[]") --make sure ( and ) characters do not appear in system text
post.Text (" (Filename: ", fileName, ")\n")
post.Text (" (Post processor: ", postName, ")\n")
post.Text (" (Date: ", date, ")\n")
if(scale == metric) then
post.Text (" G21 (Units: Metric)\n") --metric mode
else
post.Text (" G20 (Units: Inches)\n") --inch mode
end
post.Text (" G53 G90 G91.1 G40\n F1\n S500\n")

post.Text (" G31 Z-100 F400\n G92 Z0\n") --zero z axis

dist = 9999999
refdistance = 500 * scale
switchoffset = 0
bigArcs = 1 --stitch arc segments together
minArcSize = 0.05 --arcs smaller than this are converted to moves
end

function OnNewLine()
post.Text ("N")
post.Number (lineNumber, "0000")
lineNumber = lineNumber + 10
end


function OnFinish()
post.Text (" M05 M30\n")
end

function OnRapid()
post.ModalText (" G00")
post.ModalNumber (" X", endX * scale, "0.0000")
post.ModalNumber (" Y", endY * scale, "0.0000")
post.ModalNumber (" Z", endZ * scale, "0.0000")
post.Eol()
end

function OnMove()
post.ModalText (" G01")
post.ModalNumber (" X", endX * scale, "0.0000")
post.ModalNumber (" Y", endY * scale, "0.0000")
post.ModalNumber (" Z", endZ * scale, "0.0000")
post.ModalNumber (" F", feedRate * scale, "0.0###")
post.Eol()
end

function OnArc()
if(arcAngle <0) then
post.ModalText (" G03")
else
post.ModalText (" G02")
end
post.NonModalNumber (" X", endX * scale, "0.0000")
post.NonModalNumber (" Y", endY * scale, "0.0000")
post.ModalNumber (" Z", endZ * scale, "0.0000")
post.Text (" I")
post.Number ((arcCentreX - currentX) * scale, "0.0000")
post.Text (" J")
post.Number ((arcCentreY - currentY) * scale, "0.0000")
post.ModalNumber (" F", feedRate * scale, "0.0###")
post.Eol()
end


function OnPenDown()
if(dist >= (refdistance/scale)) then
dist = 0
post.ModalText(" G31 Z -100")
post.ModalNumber (" F", 400 * scale, "0.0###")
post.Eol()
post.ModalText(" G92")
post.NonModalNumber(" Z", switchoffset, "0.0000")
post.Eol()
post.CancelModalNumbers()
end
if (preheat > 0.001) then
post.ModalText (" G00")
post.ModalNumber (" Z", cutHeight * scale, "0.0000")
post.Text ("\n G04 P")
post.Number (preheat,"0.###")
post.Eol()
end
post.ModalText (" G00")
post.ModalNumber (" Z", pierceHeight * scale, "0.0000")
post.Text ("\n M03\n")
if (pierceDelay > 0.001) then
post.Text (" G04 P")
post.Number (pierceDelay,"0.###")
post.Eol()
end
end


function OnPenUp()
post.Text (" M05\n")
if (endDelay > 0) then
post.Text (" G04 P")
post.Number (endDelay,"0.###")
post.Eol()
end
end


function OnNewOperation()
post.Text (" (Operation: ", operationName, ")\n")
end

function OnComment()
post.Text(" (",commentText,")\n")
end

function OnToolChange()
post.Text (" M06 T")
post.Number (tool, "0")
post.ModalNumber(" F",feedRate * scale,"0.0###")
post.Text (" (", toolName, ")\n")
if (plungeRate <= 0) then
post.Warning("WARNING: Plunge rate is zero")
end
if (feedRate <= 0) then
post.Warning("WARNING: Feed rate is zero")
end
if(voltage > 0) then
post.ModalNumber (" S", voltage, "0")
post.Eol()
end
end

function OnNewPart()
post.Text(" (Part: ",partName,")\n");
end

function OnDrill()
OnRapid()
OnPenDown()
endZ = drillZ
OnMove()
OnPenUp()
endZ = safeZ
OnRapid()
end
User avatar
Les Newell
Site Admin
Posts: 3668
Joined: Thu May 11, 2006 8:12 pm

Re: Wierd Z axis offset issue

Post by Les Newell »

I can't see anything obviously wrong. The code looks correct:

Code: Select all

N0160 G31 Z -100 F400.0  probe surface
N0170 G92 Z0.0000 Zero Z axis
N0180 G00 Z3.6000 Move to pierce height
N0190 M03 Torch on
N0200 G04 P0.7 pierce delay
N0210 G01 X-52.9423 Y119.7730 Z1.5000 F100.0 Move to cut height
Do you have torch height control? If so, try disabling it.
finyuk2005
Posts: 12
Joined: Wed Mar 27, 2024 5:06 pm

Re: Wierd Z axis offset issue

Post by finyuk2005 »

I do have a torch height controller, and i am fairly sure it is turned off, i will have another play after my dinner!
thanks for having a look at that code for me, its good to have another pair of eyes look over it!
cheers
finyuk2005
Posts: 12
Joined: Wed Mar 27, 2024 5:06 pm

Re: Wierd Z axis offset issue

Post by finyuk2005 »

Well i had another play around and cant seem to get that program to work, Im fairly sure its something to do with the post processor,
I did try another simple test drawing that was using a very generic plasma post processor with no probe routine so i just manually zero'd the Z axis to the top of the plate, and that one ran fine, went to the correct pierce and cut heights,
So i think i just need to get to grips with post processors properly!
cheers
finyuk2005
Posts: 12
Joined: Wed Mar 27, 2024 5:06 pm

Re: Wierd Z axis offset issue

Post by finyuk2005 »

So i have found the problem i think!
I just removed the G31 routine i had put in the OnInit() function, but have been able to keep it in the OnPenDown bit,

I think i was just being lazy and hoping to get it to probe and zero the z axis on its own at the start of the program,
I will just have to remember to drop the torch down close to the top of the plate and zero z axis before i hit cycle start!

happy days, one step closer to cutting something! :lol:
OldHippie62
Posts: 23
Joined: Fri May 08, 2020 9:18 pm
Location: SIlverton, OR

Re: Wierd Z axis offset issue

Post by OldHippie62 »

Does your machine have a Floating head? If so, you might want to check what your Switch Offset is set at. Option->Machine->Post Processor-> Set Custom Post Option.
finyuk2005
Posts: 12
Joined: Wed Mar 27, 2024 5:06 pm

Re: Wierd Z axis offset issue

Post by finyuk2005 »

Looking for some help again!!
Same issue, but i think a different cause, although probably still post processor related!

I have changed to a different, more simple Torch Height controller and am using "Mach3 flame with THC - G31" post processor, which i havent modified apart from setting the distance variable from 500 to 250mm between probings
I am back to getting the issue where the probe hits ok, but for some reason the G92 code sets the Z to -10mm or there abouts, meaning when it rises up to pierce height of 4mm, it is more like 15ish mm.

Sometimes the Z axis starts moving down to probe as the X&Y are moving towards the first probing position still, and the torch ends up hitting the plate, Like the timing is all off.

I have seen people talk about adding small delays before and after the G31 and the G92 lines, but am unsure how to do this

I have read that the plugin for my motion controller can have issues with later versions of mach3 and that downgrading to .028 instead of .062 should be more stable.

I also read about using an M31 macro rather than G31, and CSlabs even have a page on this;
https://en.cs-lab.eu/technical-support/ ... ve-to-g31/

my only issue with this is that i am a complete moron and know nothing about macros, how they work or how to make a post processor call them!

can anyone help me implement the macros thing?
The next thing to try would be downgrading mach to an older version, and failing that, i am tempted to give SimCNC a try, its bound to work better with their own motion controller! All the little bugs and crashes that seem to happen with mach3 is getting tiresome!

thanks very much for any help!
Post Reply