Plasmac Post Processors

More
07 May 2021 16:40 - 07 May 2021 20:00 #208231 by txtrone
Replied by txtrone on topic Plasmac Post Processors
Nevermind
Last edit: 07 May 2021 20:00 by txtrone.

Please Log in or Create an account to join the conversation.

More
19 Jul 2021 12:20 #215319 by RNJFAB
Replied by RNJFAB on topic Plasmac Post Processors
where is the Sheetcam post processor ?

Please Log in or Create an account to join the conversation.

More
19 Jul 2021 12:21 #215320 by phillc54
Replied by phillc54 on topic Plasmac Post Processors
It comes with SheetCam, so it should be in the PP list.

Please Log in or Create an account to join the conversation.

More
21 Jul 2021 10:20 #215479 by robertspark
Replied by robertspark on topic Plasmac Post Processors
This keeps getting me (as I'm a hobby user and flit in and out of cnc + plasma, mill, lathe etc as I need to), and I also use EstlCAM estlcam.de/ , and Ezilathe www.cnczone.com/forums/downloads.php?do=file&id=21 for mill + lathe / turn.

Sheetcam post processor for Plasmac

Version 0.2 is installed with sheetcam  (I'll try to update it if it gets updated / added to)

below is the code of the post processor (unedited as listed within sheetcam, you may need to customise the first section to your setup).
-- *****************************************************************************
-- * USER OPTIONS: change to suit                                              *
-- *                                                                           *
-- * cParms & pmx485 show custom PlasmaC parameters in the SheetCam tool file. *
-- * They are read by PlasmaCs materialverter to import parameters into the    *
-- * PlasmaC material file from a SheetCam toolset file.                       *
-- * If you have useTool enabled they are also used to generate temporary      *
-- * material file entries.                                                    *
-- *                                                                           *
-- * NOTE: For best results set the plunge rate to 0 in your tool definitions  *
-- *                                                                           *
-- * The PlasmaC GCode parser will remove line numbers so they don't show in   *
-- * in the GUI but if enabled here they will appear in any GCode file saved   *
-- * from SheetCam.                                                            *
-- *****************************************************************************

--Use true or false to enable or disable these features
cParms      = true -- set to true to show basic custom parameters
pmx485      = false -- set to true to show RS485 parameters
lineNumbers = false -- set to true to show linenumbers
noArcs      = false -- set to true to convert arcs to line segments

useTool     = true -- Set to true to use SheetCam's tool table to generate a temporary material file entry


-- *** DO NOT CHANGE ANYTHING BELOW THIS LINE **********************************

revNum  = '0.2'

if cParms then
   post.DefineCustomToolParam('PlasmaTool', 'Puddle jump height', 'pjHeight', sc.unit1DECPLACE, 0, 0, 200)
   post.DefineCustomToolParam('PlasmaTool', 'Puddle jump delay', 'pjDelay', sc.unit2DECPLACE, 0, 0, 9)
   post.DefineCustomToolParam('PlasmaTool', 'THC enable', 'thcEnable', sc.unitBOOLEAN, 1, 0, 1)
   post.DefineCustomToolParam('PlasmaTool', 'Cut voltage', 'cutVolts', sc.unit0DECPLACE, 99, 0, 200)
end

if pmx485 then
   post.DefineCustomToolParam('PlasmaTool', 'Cut current', 'cutAmps', sc.unit0DECPLACE, 45, 10, 200)
   post.DefineCustomToolParam('PlasmaTool', 'Gas pressure', 'gasPressure', sc.unit0DECPLACE, 0, 0, 150)
   post.DefineCustomToolParam('PlasmaTool', 'Cut mode', 'cutMode', sc.unit0DECPLACE, 1, 1, 3)
end

function OnAbout(event)
   ctrl = event:GetTextCtrl()
   ctrl:AppendText('For a PlasmaC configuration on LinuxCNC\n\n')
   ctrl:AppendText('Revision: ' .. revNum)
end

function OnInit()
   post.SetCommentChars ('();', '[]:')  --ensure ( ) characters do not appear in system text
   post.Text (';     file name: ', fileName, '\n')
   post.Text ('; date and time: ', os.date('%a') , ' ', os.date('%b') , ' ', os.date('%d') , ' ', os.date('%Y') , '    ', time, '\n')
   post.Text ('; postprocessor: ', postName, ' rev: ', revNum, '\n')
   post.Text (';\n')
   post.Text (';begin pre-amble\n')

   if scale == metric then
     minimumMove = '0.000001'
     post.Text (' G21 (units: metric)\n') --metric mode
     units = 'mm'
     precision = '0.###'
   else
     post.Text (' G20 (units: inches)\n') --inch mode
     minimumMove = '0.00000004'
     units = '"'
     precision = '0.#####'
   end
   post.Text (' G40 (cutter compensation: off)\n')
   post.Text (' G90 (distance mode: absolute)\n')
   post.Text (' M52 P1 (adaptive feed: on)\n') 
   post.Text (' M65 P2 (enable THC)\n')
   post.Text (' M65 P3 (enable torch)\n')
   post.Text (' M68 E3 Q0 (velocity 100%)\n')
   if scale == metric then
     post.Text (' G64 P0.254 Q0.025 (tracking tolerances: 0.254mm)\n') 
   else
     post.Text (' G64 P0.01 Q0.001 (tracking tolerances: 0.01")\n') 
   end
   post.Text (';end pre-amble\n')
   bigArcs = 1 --stitch arc segments together
   minArcSize = 0.2 --arcs smaller than this are converted to moves
   cutLength = 0
   pierces = 0
   spots = 0
   scribes = 0
   scribeLength = 0
   oldTool = -1
   toolNum = -1
end

function OnNewLine()
   if lineNumbers then
      post.Text ('N')
      post.Number (lineNumber, '00000')
      lineNumber = lineNumber + 10
   end
end

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

function OnToolChange()
   local name
   post.Text (';\n;begin material setup\n')
   if toolClass == 'MarkerTool' then
      toolNum = 1
      name = "scriber"
   else
      toolNum = 0
      name = "plasma"
   end
   if toolNum ~= oldTool then
     post.Text (' T', toolNum, ' M6 (select ', name, ' tool)\n')
     post.Text (' G43 H0 (apply tool offsets)\n')
     oldTool = toolNum
   end
   if useTool then
      post.Text(" (o=0")
      post.NonModalNumber(", ph=", pierceHeight * scale, precision)
      post.NonModalNumber(", pd=", pierceDelay, precision)
      post.NonModalNumber(", ch=", cutHeight * scale, precision)
      post.NonModalNumber(", fr=", GetFeedRate() * scale, precision)
      if thcEnable then
         post.NonModalNumber(", th=", thcEnable, "0")
      end
      if cutAmps then
         post.NonModalNumber(", ca=", cutAmps, "0")
      end
      if cutVolts then
         post.NonModalNumber(", cv=", cutVolts, "0")
      end
      post.NonModalNumber(", pe=", endDelay, precision)
      if gasPressure then
         post.NonModalNumber(", gp=", gasPressure, precision)
      end
      if cutMode then
         post.NonModalNumber(", cm=", cutMode, "0")
      end
      if pjHeight then
         post.NonModalNumber(", jh=", pjHeight, precision)
      end
      if pjDelay then
         post.NonModalNumber(", jd=", pjDelay, precision)
      end
      post.Text(")\n")
   else
      post.Text (' M190 P' , tool,' (',string.lower(toolName), ' material)\n')            
      post.Text (' M66 P3 L3 Q2 (wait for valid change)\n')         
   end
   post.Text (' F#<_hal[plasmac.cut-feed-rate]>\n')
   post.Text (';end material setup\n')
end

function OnPenDown()
   if toolClass == 'MarkerTool' then
      post.Text (' M3 $1 S1 (marker start)\n')
      scribeLength = scribeLength + entityLength
      scribes = scribes + 1
   else
      post.Text (' M3 $0 S1 (plasma start)\n')
      cutLength = cutLength + entityLength
      pierces = pierces + 1
   end
end

function OnPenUp()
   if toolClass == 'MarkerTool' then
      post.Text (' M5 $1 (marker end)\n')
      post.Text (' G4 P1 (pause for scribe retract)\n')
   else
      post.Text (' M5 $0 (plasma end)\n')
   end
end

function OnRapid()
    if math.hypot(endX - currentX, endY - currentY) < 0.001 then
        return
    end
    post.Text (' G0')
    post.NonModalNumber (' X', endX * scale, precision)
    post.NonModalNumber (' Y', endY * scale, precision)
    post.Text ('\n')
end

function OnMove()
   if math.hypot(endX - currentX, endY - currentY) < 0.001 then
     return
   end
   post.Text (' G1')
   post.NonModalNumber (' X', endX * scale, precision)
   post.NonModalNumber (' Y', endY * scale, precision)
   post.Text ('\n')
end

function OnArc()
   if noArcs then
      post.ArcAsMoves(0.25)
      return
   end
   if(arcAngle < 0) then
       post.Text (' G3')
   else
       post.Text (' G2')
   end
   post.NonModalNumber (' X', endX * scale, precision)
   post.NonModalNumber (' Y', endY * scale, precision)
   post.Text (' I')
   post.Number ((arcCentreX - currentX) * scale, precision)
   post.Text (' J')
   post.Number ((arcCentreY - currentY) * scale, precision)
   post.Text ('\n')
end

function GetFeedRate()
   local pts = sc.Parts.Get()
   local pt = pts:op_index(partIndex):GetParentPart()
   local op = pt.operations:op_index(operationIndex):DynamicCast("OperationWithRoundTool")
   if not op then
      return feedRate --Current op does not have a feed rate
   end
   return op.feedRate:op_get() --Get the operation's feed rate
end


function OnSetFeed()
   if not operationIndex or feedRate == plungeRate then
      return
   end
   local toolFeed = GetFeedRate()

   local ratio = 0.001
   if toolFeed > 0 then
      ratio = feedRate / toolFeed
   end
   if ratio < 0.1 then
      ratio = 0.1
   end 
   if ratio > 1 then
      ratio = 1
   end
   post.ModalNumber(" M67 E3 Q", ratio * 100, "0")
   post.Eol()
end


function OnDrill()
   if toolClass == "DrillTool" then
      post.Error("Drilling is not currently supported")
   end
   OnRapid()
   post.Text (' M3 $2 S1 (spot start)\n')
   post.Text (' G91 (relative distance mode)\n')
   post.Text (' G1 X', minimumMove, ' (tiny move)\n')
   post.Text (' G90 (absolute distance mode)\n')
   post.Text (' M5 $2 (spot end)\n')
   spots = spots + 1
end

function OnFinish()
   post.Text (' ;\n ;begin post-amble\n')
   if toolNum > 0 then
      post.Text (' T0 M6 (select torch)\n')
      post.Text (' G43 H0 (apply tool offsets)\n')
      post.Text (' M65 P0\n')
   end
   post.Text (' G40 (cutter compensation: off)\n')
   post.Text (' G90 (distance mode: absolute)\n')
   post.Text (' M65 P2 (enable THC)\n')
   post.Text (' M65 P3 (enable torch)\n')
   post.Text (' M68 E3 Q0 (velocity 100%)\n')
   post.Text (' M5 $-1 (backup stop)\n')
   post.Text (' ;end post-amble\n')
   post.Text (' ;\n')
   post.Text (' ;begin statistics\n')
   if spots > 0 then
     post.Text('\n ;  Spots = ', spots, '\n')
   end
   if pierces > 0 then
     post.Text('\n ;Pierces = ', pierces, '\n')
   end
   if cutType == 'Cutting' then
     post.Text('\n ;   Cuts = ', pierces , ',    Length = ')
     post.Number (cutLength * scale, '0.00')
     post.Text (units, '\n')
   end
   if scribes > 0 then
     post.Text('\n ;Scribes = ', scribes , ',    Length = ')
     post.Number (scribeLength * scale, '0.00')
     post.Text (units, '\n')
   end
   post.Text (' ;end statistics\n')
   post.Text (' ;\n')
   post.Text (' M30 (end program)\n')
end

Please Log in or Create an account to join the conversation.

More
21 Jul 2021 11:32 - 21 Jul 2021 11:33 #215488 by snowgoer540
Replied by snowgoer540 on topic Plasmac Post Processors
What was the rationale for posting the sheetcam post processor code here?  

It was removed from the forum because it comes with sheetcam now and is maintained by Les, and thus sheetcam is the single "source of truth".  To post it here only compounds the problem of people finding random sheetcam post processors on this forum, at various revisions, using them, and having issues.  

Plus someone (you) has to maintain the code you posted against what Les puts out in sheetcam updates.  Which if someone needs the sheetcam post processor for PlasmaC, that means they already have sheetcam, and thus will get the updates already.

It would highly recommend removing the code from here.  
Last edit: 21 Jul 2021 11:33 by snowgoer540.

Please Log in or Create an account to join the conversation.

More
21 Jul 2021 13:21 #215494 by robertspark
Replied by robertspark on topic Plasmac Post Processors
I find it useful posting it here.

Please Log in or Create an account to join the conversation.

Moderators: phillc54
Time to create page: 0.098 seconds
Powered by Kunena Forum