i have a problem with the THC.
The THC does not turn off.
the code is M38 THC on an M39 THC off.
Could it be that I have to insert this command into the post processor for it to work?
and this is my postprocessor.
function OnAbout(event)
ctrl = event:GetTextCtrl()
ctrl:AppendText(“START post processor\n”)
ctrl:AppendText(“\n”)
ctrl:AppendText(“Non modal G-codes\n”)
ctrl:AppendText(“Modal coordinates\n”)
ctrl:AppendText(“No comments\n”)
ctrl:AppendText(“Incremental\n”)
end
function OnInit()
post.Text(“%\n”)
if(scale == metric) then
post.Text (“G71\n”) --metric mode
else
post.Text (“G70\n”) --inch mode
end
post.Text (“G91\nG40\nG92X0Y0\n”)
bigarcs = 1 --stitch arc segments together
minArcSize = 0.2 --arcs smaller than this are converted to moves
curx =0
cury =0
firstmove = 1
end
function OnFinish()
OnPenUp()
endX = 0
endY = 0
OnRapid()
post.Text (“M30\n”)
end
function OnRapid()
if(firstmove == 1) then
firstmove=0
return
end
if (math.hypot(endX - currentX, endY - currentY) < 0.01) then return end
post.Text(“G0”);
doxy()
post.Eol()
end
function OnMove()
if (math.hypot(endX - currentX, endY - currentY) < 0.01) then return end
post.Text(“G1”);
doxy()
– post.ModalNumber(“F”, feedRate * scale, “0”)
post.NonModalNumber(“F”, feedRate * scale, “0”)
post.Eol()
end
function doxy()
tmp = (endX * scale) - curx
tmp = math.toint(tmp * 1000)/1000
curx = curx + tmp
if(tmp ~=0) then
post.NonModalNumber(“X”,tmp,“0.0##”)
end
tmp = (endY * scale) - cury
tmp = math.toint(tmp * 1000)/1000
cury = cury + tmp
if(tmp ~=0) then
post.NonModalNumber(“Y”,tmp,“0.0##”)
end
end
function OnArc()
if(arcAngle <0) then
post.Text (“G03”)
else
post.Text (“G02”)
end
doxy()
if((arcCentreX - currentX) ~=0) then
post.NonModalNumber (“I”, (arcCentreX - currentX) * scale, “0.0##”)
end
if((arcCentreY - currentY) ~=0) then
post.NonModalNumber (“J”, (arcCentreY - currentY) * scale, “0.0##”)
end
–post.ModalNumber(“F”, feedRate * scale, “0”)
post.NonModalNumber(“F”, feedRate * scale, “0”)
post.Eol()
end
function OnPenDown()
post.Text(“M50\n”)
end
function OnPenUp()
post.Text (" M08\n")
end
function OnNewOperation()
post.Text (" (Operation: ", operationName, “)\n”)
end
function OnComment()
post.Text(" (“,commentText,”)\n")
end
function OnNewPart()
post.Text(" (Part: “,partName,”)\n");
end
Is this right?
function OnFinish()
OnPenUp()
endX = 0
endY = 0
OnRapid()
post.Text(“M39\n”) – THC OFF
post.Text (“M30\n”)
end
function OnRapid()
if(firstmove == 1) then
firstmove=0
return
end
if (math.hypot(endX - currentX, endY - currentY) < 0.01) then return end
post.Text(“G0”);
doxy()
post.Eol()
end
function OnMove()
if (math.hypot(endX - currentX, endY - currentY) < 0.01) then return end
post.Text(“M38\n”) – THC ON
post.Text(“G1”);
doxy()
– post.ModalNumber(“F”, feedRate * scale, “0”)
post.NonModalNumber(“F”, feedRate * scale, “0”)
post.Eol()
post.Text(“M39\n”) – THC OFF
end