post processor resources
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
- sliptonic
- Veteran
- Posts: 3459
- Joined: Tue Oct 25, 2011 10:46 pm
- Location: Columbia, Missouri
- Contact:
Re: post processor resources
There's definitely something wrong with the lead in/out dressup. It doesn't play well with an operation like face profile that his doing both the outer profile and the holes.
I disabled the holes and created a separate operation profiling the edge of the top left pocket and added the dressup to both. I also manually set the start points for both.
Those paths below look reasonable. The workflow, of course, is far from ideal.
I'll add a bug report for the leadin/out dressup.
I'm also going to add a feature request to re-implement the draft-snapper to make it easier to apply start points to a path.
I disabled the holes and created a separate operation profiling the edge of the top left pocket and added the dressup to both. I also manually set the start points for both.
Those paths below look reasonable. The workflow, of course, is far from ideal.
I'll add a bug report for the leadin/out dressup.
I'm also going to add a feature request to re-implement the draft-snapper to make it easier to apply start points to a path.
Re: post processor resources
If that helps in resolving this bug it does not work well in edge profiling when I add a second hole to the base geometry.
Also Another question plz if I am not bugging you too much. From your image I can see your curve is smooth. On mine the curve is like a rough polygon. Can I adjust this resolution somewhere? Or is it something else? (I am considering that the tool diameter may also affect this?)
Also Another question plz if I am not bugging you too much. From your image I can see your curve is smooth. On mine the curve is like a rough polygon. Can I adjust this resolution somewhere? Or is it something else? (I am considering that the tool diameter may also affect this?)
- sliptonic
- Veteran
- Posts: 3459
- Joined: Tue Oct 25, 2011 10:46 pm
- Location: Columbia, Missouri
- Contact:
Re: post processor resources
Yep. For now, you would need to add a separate operation for each hole. Not ideal but the best we can do for now.
Not bugging me at all. We're getting at real bugs and that's real progress.Also Another question plz if I am not bugging you too much.
I could totally give you a hard time about not checking the FAQ but that's probably not fair. The answer wasn't there until a couple hours ago. It came up in another thread today and got addedFrom your image I can see your curve is smooth. On mine the curve is like a rough polygon. Can I adjust this resolution somewhere? Or is it something else? (I am considering that the tool diameter may also affect this?)
Re: post processor resources
haha! And I was pretty sure I have read it!
So the post processor gives some errors
Code: Select all
PathPost.DEBUG: about to postprocess job: Job
PathPost.DEBUG: obj: Profile_Faces
grbl_post gcode postprocessor loaded.
grbl_plasma_post gcode postprocessor loaded.
grbl_plasma_post gcode postprocessor loaded.
PathPost.DEBUG: about to postprocess job: Job
PathPost.DEBUG: obj: Profile_Faces
post: grbl_plasma(/home/pomo/Freecad_Git/Grapples/01_Hardware/Mechanical_Parts/CADbrace plate lid upper.gcode, )
grbl_plasma_post gcode postprocessor loaded.
Show editor = 1
postprocessing...
No machine found in this project
Running the Python command 'Path_Post' failed:
Traceback (most recent call last):
File "/usr/lib/freecad/Mod/Path/PathScripts/PathPost.py", line 259, in Activated
(fail, rc) = self.exportObjectsWith(postlist, job)
File "/usr/lib/freecad/Mod/Path/PathScripts/PathPost.py", line 192, in exportObjectsWith
gcode = processor.export(objs, filename, postArgs)
File "/usr/lib/freecad/Mod/Path/PathScripts/PathPostProcessor.py", line 104, in export
return self.script.export(obj, filename, args)
File "/usr/lib/freecad/Mod/Path/PathScripts//post/grbl_plasma_post.py", line 191, in export
gcode += parse(obj)
File "/usr/lib/freecad/Mod/Path/PathScripts//post/grbl_plasma_post.py", line 273, in parse
if c.Parameters[param] < z_check:
local variable 'z_check' referenced before assignment
Re: post processor resources
It looks as if you are quoting one of your own posts. I am grateful, that you don't cite blindly the whole post, but you have to be careful which quote tags you delete. Using the right quote tags is useful, because the small arrow is a link to the cited post.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
- sliptonic
- Veteran
- Posts: 3459
- Joined: Tue Oct 25, 2011 10:46 pm
- Location: Columbia, Missouri
- Contact:
Re: post processor resources
It's trying to compare the Z value to the z_check value but z_check doesn't exist yet.
Add z_check=0 at the beginning of the parse() function.
Attached my version but still stressing that I haven't actually tested it.
Add z_check=0 at the beginning of the parse() function.
Attached my version but still stressing that I haven't actually tested it.
- Attachments
-
- grbl_post.py
- (11.28 KiB) Downloaded 55 times
Re: post processor resources
No worries As I dry run this logic I can see that it will put a "code that zeroes Z" twice in a row, as the tool descends twice.
I am attaching the post processor the SheetCAM uses in case someone can understand better how to implement this. It also has a scriber, just ignore it.
Code: Select all
--************************************************
--*** Set these values up to suit your machine ***
--************************************************
--this is the distance between each torch reference in MILLIMETRES
refDistance = 250
--this is the reference feed rate in mm/min
refFeed = 500
--Put your switch offset value here in MILLIMETRES
--Put a sheet of metal on your machine and place a sheet of paper on top.
--Slowly jog the torch down onto the paper until the touch-off switch just operates.
--Zero the Z axis then pull gently on the paper and slowly jog up until the paper slides out.
--The Z axis position is your switch offset.
switchOffset = 1.5
--Scriber X,Y,Z offsets in MILLIMETRES. Do not use inches here even if you want inch code
--Use the special code 'nil' on the Z axis to disable it.
--In that case no Z values will be output at all while scribing.
--e.g scriberZ = nil
scriberX = 110
scriberY = 220
scriberZ = nil
--scriber axis. Leave this as nil if the scriber is fixed to the same axis as the torch
--scriberAxis = "A"
scriberAxis = nil
--this is an extra delay added to the first pierce as needed by some machines
firstPierceTime = 0
--************************************************
--*** End of settings ***
--************************************************
function OnAbout(event)
ctrl = event:GetTextCtrl()
ctrl:AppendText("plasma MP1000-THC post processor with engraver\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("M08/M09 turn the engraver on/off\n")
ctrl:AppendText("Incremental IJ - set in mach2\n")
ctrl:AppendText("The torch is referenced at cut start and every 500mm of movement thereafter\n")
ctrl:AppendText("Designed for use with Mach3 and CandCNC MP1000-THC and Floating head Touch-n-Go\n")
ctrl:AppendText("Post variables:\n")
ctrl:AppendText("refDistance - set the distance between each reference\n")
ctrl:AppendText("refFeed - set the feed rate when referencing\n")
ctrl:AppendText("switchOffset - set your net switch offset amount \n")
ctrl:AppendText("Scriber uses any tool number\n")
end
-- created 1/1/06
-- Based on plasma1.post
-- Modified 21/6/2010
-- added option for 'nil' plate marker z
-- Added support for plate marker tool type as well as tool number based plate marker
-- Modified 4/11/2010
-- Added: Reference the torch on the first pen down if the plate marker is the first tool used.
post.DefineVariable("refDistance",sc.unitLINEAR,0,1e17)
post.DefineVariable("refFeed",sc.unitFEED,0,1e17)
post.DefineVariable("switchOffset",sc.unitLINEAR,-1e17,1e17)
function OnInit()
offX = 0
offY = 0
offZ = 0
post.SetCommentChars ("()", "[]") --make sure ( and ) characters do not appear in system text
if(scale == metric) then
post.Text (" G21\n") --metric mode
else
post.Text (" G20\n") --inch mode
end
post.Text (" F1\n G53 G90 G40\n")
minArcSize = 0.2 --arcs smaller than this are converted to moves
firstRef = true
currentZAxis = "Z"
dist = 9999999
lastz = 0
thcstate = 1
firstPierce = firstPierceTime;
end
function OnNewLine()
post.Text ("N")
post.Number (lineNumber, "0000")
lineNumber = lineNumber + 10
end
function OnFinish()
endZ = safeZ
OnRapid()
endX = 0
endY = 0
offX = 0
offY = 0
offZ = 0
OnRapid()
post.Text (" M05 M30\n")
end
function OnRapid()
if(endX > 1e17 and endY > 1e17) then return end
local len = math.hypot((endX + offX)-currentX , (endY + offY)-currentY)
dist = dist + len
post.ModalText (" G00")
post.ModalNumber (" X", (endX + offX) * scale, "0.0000")
post.ModalNumber (" Y", (endY + offY) * scale, "0.0000")
if(offZ and firstRef == false and currentZ ~= safeZ) then
post.ModalNumber (" " .. currentZAxis, (endZ + offZ) * scale, "0.0000")
end
post.Eol()
end
function OnMove()
local len = math.hypot(endX - currentX , endY - currentY)
dist = dist + len
post.ModalText (" G01")
post.ModalNumber (" X", (endX + offX) * scale, "0.0000")
post.ModalNumber (" Y", (endY + offY) * scale, "0.0000")
if(offZ) then
post.ModalNumber (" " .. currentZAxis, (endZ + offZ) * scale, "0.0000")
end
post.ModalNumber (" F", feedRate * scale, "0.0###")
post.Eol()
end
function OnArc()
local radius = math.hypot(currentX - arcCentreX, currentY - arcCentreY)
dist = dist + radius * math.abs(arcAngle)
if(arcAngle <0) then
post.ModalText (" G03")
else
post.ModalText (" G02")
end
post.ModalNumber (" X", (endX + offX) * scale, "0.0000")
post.ModalNumber (" Y", (endY + offY) * scale, "0.0000")
if(offZ) then
post.ModalNumber (" " .. currentZAxis, (endZ + offZ) * scale, "0.0000")
end
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(toolClass == "MarkerTool") then
if (firstRef) then
Reference()
post.ModalText (" G00")
post.Text(" Z")
post.Number (safeZ * scale, "0.0000")
post.Eol()
offX = scriberX
offY = scriberY
offZ = scriberZ
post.ModalNumber (" X", (currentX + offX) * scale, "0.0000")
post.ModalNumber (" Y", (currentY + offY) * scale, "0.0000")
post.Eol()
end
if (offZ) then
post.ModalNumber (" " .. currentZAxis, (currentZ + offZ) * scale, "0.0000")
post.Eol()
end
post.Text(" M08\n")
else
if(dist >= refDistance) then
dist = 0
Reference();
end
post.ModalText (" G00")
post.Text(" Z")
post.Number (pierceHeight * scale, "0.0000")
post.Eol()
if (preheat > 0) then
post.Text ("\n G04 P")
post.Number (preheat,"0.0##")
post.Eol()
end
post.Text ("\n M03\n")
end
if (pierceDelay + firstPierce > 0.001) then
post.Text (" G04 P")
post.Number (pierceDelay + firstPierce,"0.0##")
firstPierce = 0
post.Eol()
end
end
function Reference()
firstRef = false
post.ModalText(" G38.2 z")
post.Number(-50 * scale, "0.0##")
post.ModalNumber (" F", refFeed * scale, "0.0###")
post.Eol()
post.ModalText(" G92 Z0.0\n")
post.ModalText (" G00")
post.Text(" Z")
post.Number (switchOffset * scale, "0.0000")
post.Eol()
post.ModalText(" G92 Z0.0\n")
end
function OnPenUp()
if(toolClass == "MarkerTool") then
post.Text(" M09\n")
else
post.Text (" M05\n")
end
if (endDelay > 0) then
post.Text (" G04 P")
post.Number (endDelay,"0.###")
post.Eol()
end
end
function OnToolChange()
if (toolClass == "MarkerTool") then
if(scriberAxis and scriberAxis ~= currentZAxis) then
endZ = safeZ
OnRapid()
currentZAxis = scriberAxis
end
if(firstRef ~= true) then
offX = scriberX
offY = scriberY
offZ = scriberZ
end
else
if(scriberAxis and scriberAxis == currentZAxis) then
endZ = safeZ
OnRapid()
currentZAxis = "Z"
end
offX = 0
offY = 0
offZ = 0
end
end
function OnDrill()
OnRapid()
currentX = endX
currentY = endY
OnPenDown()
endZ = drillZ
OnMove()
OnPenUp()
endZ = safeZ
OnRapid()
end
function OnComment()
post.Text(" (",commentText,")\n")
end
Of course the workflow now is not ideal (Freecad --> SVG export, import to SheetCAM --> CAM), and I would like to support to remove the middle man (SVG), but my coding knowledge is non-existing. Let me know if I can help in some other way.
-
- Posts: 5
- Joined: Mon Sep 21, 2020 3:25 pm
Re: post processor resources
Hi there
I do apologise if it is not the right thing to do to revive this thread but I have a related question.
I am trying to adapt a post processor to us FreeCad Path with a Torchmate CNC plasma controller.
All I basically need to do to make the thing work is remove any Z values from the code. I have tried to figure out how to do this by editing the grbl post processor but I just cannot work it out.
The other thing that would be useful to be able to do is to adapt the drilling toolpath so that the machine uses a G00 to go to a co-ordinate and then an M50 to fire the torch followed by a dwell time then an M51 to turn off the torch.
This function would allow effectively using the plasma cutter as a spot drill which would be a gamechanger for CNC plasma operators, there are some workarounds but none of them very elegant.
Just to note that the Torchmate controller that I use has no need for any setup code it can easily be used with just G00 and G01 because the controller runs a macro to turn on and off the torch when it sees a G01 (feedrate move, all other times M51, torch off). That is to say if I could export GCode without headers or commands like G90 or G17 then this is ideal for Torchmate.
Anyway, I can't thank you all enough for the work that you do and I do apologise if I am hijacking this thread.
I do apologise if it is not the right thing to do to revive this thread but I have a related question.
I am trying to adapt a post processor to us FreeCad Path with a Torchmate CNC plasma controller.
All I basically need to do to make the thing work is remove any Z values from the code. I have tried to figure out how to do this by editing the grbl post processor but I just cannot work it out.
The other thing that would be useful to be able to do is to adapt the drilling toolpath so that the machine uses a G00 to go to a co-ordinate and then an M50 to fire the torch followed by a dwell time then an M51 to turn off the torch.
This function would allow effectively using the plasma cutter as a spot drill which would be a gamechanger for CNC plasma operators, there are some workarounds but none of them very elegant.
Just to note that the Torchmate controller that I use has no need for any setup code it can easily be used with just G00 and G01 because the controller runs a macro to turn on and off the torch when it sees a G01 (feedrate move, all other times M51, torch off). That is to say if I could export GCode without headers or commands like G90 or G17 then this is ideal for Torchmate.
Anyway, I can't thank you all enough for the work that you do and I do apologise if I am hijacking this thread.
Re: post processor resources
Hello,Beresford Romeo wrote: ↑Sun Apr 11, 2021 3:31 pm Hi there
I do apologise if it is not the right thing to do to revive this thread but I have a related question.
I am trying to adapt a post processor to us FreeCad Path with a Torchmate CNC plasma controller.
All I basically need to do to make the thing work is remove any Z values from the code. I have tried to figure out how to do this by editing the grbl post processor but I just cannot work it out.
The other thing that would be useful to be able to do is to adapt the drilling toolpath so that the machine uses a G00 to go to a co-ordinate and then an M50 to fire the torch followed by a dwell time then an M51 to turn off the torch.
This function would allow effectively using the plasma cutter as a spot drill which would be a gamechanger for CNC plasma operators, there are some workarounds but none of them very elegant.
Just to note that the Torchmate controller that I use has no need for any setup code it can easily be used with just G00 and G01 because the controller runs a macro to turn on and off the torch when it sees a G01 (feedrate move, all other times M51, torch off). That is to say if I could export GCode without headers or commands like G90 or G17 then this is ideal for Torchmate.
Anyway, I can't thank you all enough for the work that you do and I do apologise if I am hijacking this thread.
I had a bit of free time this morning so I've knocked up the attached post-processor which might work for you. Be aware though that I don't have suitable hardware to test it on so it's very much use at your own risk. If you place it in your FreeCAD Macro directory then FreeCAD should pick it up and you'll then need to select it as the post-processor in your Job's output tab.
Hope this helps.
- Attachments
-
- torch_post.py
- (15.97 KiB) Downloaded 51 times
-
- Posts: 5
- Joined: Mon Sep 21, 2020 3:25 pm
Re: post processor resources
Hi there
I am so grateful for your help. Thanks so much.
I did manage to get a grbl post processor to work well enough to do what I wanted to do with a bit of manual added code. I will persevere with this in the hope that with your help I can get something working and tested because there a quite a few Torchmate users out there who can benefit from it.
I also have a Tormach CNC mill which I will need to adapt a post processor for and I assume that a lot of Tormach users would like to be able to use FreeCAD since the Autodesk Fusion 'disappointment'.
I am so grateful for your help. Thanks so much.
I did manage to get a grbl post processor to work well enough to do what I wanted to do with a bit of manual added code. I will persevere with this in the hope that with your help I can get something working and tested because there a quite a few Torchmate users out there who can benefit from it.
I also have a Tormach CNC mill which I will need to adapt a post processor for and I assume that a lot of Tormach users would like to be able to use FreeCAD since the Autodesk Fusion 'disappointment'.