Text Compare
Produced: 12/22/2023 11:04:29 AM
   
Mode:  All  
Left file: C:\Program Files (x86)\SheetCam TNG\posts\Mach3 plasma.scpost  
Right file: C:\Program Files (x86)\SheetCam TNG\posts\Thermal Dynamics iCNC (1).scpost  
1 firstPierceTime = 0 --this is an extra delay added to the first pierce as needed by some machines +-    
2        
3        
4 function OnAbout(event) = 1 function OnAbout(event)
5    ctrl = event:GetTextCtrl()   2    ctrl = event:GetTextCtrl()
6    ctrl:AppendText("Mach3 plasma post processor\n")   3    ctrl:AppendText("Mach3 plasma post processor\n")
7    ctrl:AppendText("\n")   4    ctrl:AppendText("\n")
8    ctrl:AppendText("Generic plasma post for machines without THC\n")   5    ctrl:AppendText("Generic plasma post for machines without THC\n")
9    ctrl:AppendText("\n")   6    ctrl:AppendText("\n")
10    ctrl:AppendText("Modal G-codes and coordinates\n")   7    ctrl:AppendText("Modal G-codes and coordinates\n")
11    ctrl:AppendText("Comments enclosed with ( and )\n")   8    ctrl:AppendText("Comments enclosed with ( and )\n")
12    ctrl:AppendText("M03/M05 turn the torch on/off\n")   9    ctrl:AppendText("M03/M05 turn the torch on/off\n")
13    ctrl:AppendText("Incremental IJ\n")   10    ctrl:AppendText("Incremental IJ\n")
14 end   11 end
15     12  
16   <>    
17 --  revision 3/2/07      
18 --  Removed final safety move. This is now done in SheetCam      
19        
20 --   revision 7/10/05      
21 --   Added new arc handling      
22        
23 --   revision 11/7/05      
24 --   Moved torch to cut height when preheating      
25 --   Added dummy spindle speed to prevent Mach2 throwing a zero spindle speed error      
26        
27 --   revision 9/10/04      
28 --   Added preheat      
29        
30 --   revision 28/6/04      
31 --   Replaced startx,y,z with currentx,y,z      
32        
33 --   created 28/5/04      
34 --   Based on Mach2 metric.post   13 post.ForceExtension("eia")
35        
36        
37   = 14  
38 function OnInit()   15 function OnInit()
39     16  
40    post.SetCommentChars ("()", "[]")  --make sure ( and ) characters do not appear in system text   17    post.SetCommentChars ("()", "[]")  --make sure ( and ) characters do not appear in system text
41    post.Text (" (Filename: ", fileName, ")\n") <> 18    post.Text ("(Filename: ", fileName, ")\n")
42    post.Text (" (Post processor: ", postName, ")\n")   19    post.Text ("(Post processor: ", postName, ")\n")
43    post.Text (" (Date: ", date, ")\n")   20    post.Text ("(Date: ", date, ")\n")
44    if(scale == metric) then = 21    if(scale == metric) then
45       post.Text (" G21 (Units: Metric)\n") --metric mode <> 22       post.Text ("G21 (Units: Metric)\n") --metric mode
46    else = 23    else
47       post.Text (" G20 (Units: Inches)\n") --inch mode <> 24       post.Text ("G20 (Units: Inches)\n") --inch mode
48    end = 25    end
49    post.Text (" G53 G90 G91.1 G40\n F1\n S500\n") <> 26    post.Text ("G40\nG90\n")
50    bigArcs = 1 --stitch arc segments together = 27    bigArcs = 1 --stitch arc segments together
51    minArcSize = 0.05 --arcs smaller than this are converted to moves   28    minArcSize = 0.05 --arcs smaller than this are converted to moves
52    firstPierce = firstPierceTime; +-    
53 end = 29 end
54     30  
55 function OnNewLine() +-    
56    post.Text ("N")      
57    post.Number (lineNumber, "0000")      
58    lineNumber = lineNumber + 10      
59 end      
60   = 31  
61   +-    
62 function OnFinish() = 32 function OnFinish()
63    post.Text (" M05 M30\n") <> 33    post.Text ("M02\n")
64 end = 34 end
65     35  
66 function OnRapid()   36 function OnRapid()
    <> 37    if(math.hypot(currentX - endX, currentY - endY) < 0.001) then return end
67    post.ModalText (" G00")   38    post.Text ("G00")
68    post.ModalNumber (" X", endX * scale, "0.0000")   39    post.ModalNumber ("X", endX * scale, "0.0000")
69    post.ModalNumber (" Y", endY * scale, "0.0000")   40    post.ModalNumber ("Y", endY * scale, "0.0000")
70    post.ModalNumber (" Z", endZ * scale, "0.0000")   41 --   post.ModalNumber ("Z", endZ * scale, "0.0000")
71    post.Eol() = 42    post.Eol()
72 end   43 end
73     44  
74 function OnMove()   45 function OnMove()
    <> 46    if(math.hypot(currentX - endX, currentY - endY) < 0.001) then return end
75    post.ModalText (" G01")   47    post.Text ("G01")
76    post.ModalNumber (" X", endX * scale, "0.0000")   48    post.ModalNumber ("X", endX * scale, "0.0000")
77    post.ModalNumber (" Y", endY * scale, "0.0000")   49    post.ModalNumber ("Y", endY * scale, "0.0000")
78    post.ModalNumber (" Z", endZ * scale, "0.0000")   50 --   post.ModalNumber ("Z", endZ * scale, "0.0000")
79    post.ModalNumber (" F", feedRate * scale, "0.0###")   51    post.ModalNumber ("F", feedRate * scale, "0.0###")
80    post.Eol() = 52    post.Eol()
81 end   53 end
82     54  
83 function OnArc()   55 function OnArc()
84    if(arcAngle <0) then   56    if(arcAngle <0) then
85       post.ModalText (" G03") <> 57       post.Text ("G03")
86    else = 58    else
87       post.ModalText (" G02") <> 59       post.Text ("G02")
88    end = 60    end
89    post.NonModalNumber (" X", endX * scale, "0.0000") <> 61    post.NonModalNumber ("X", endX * scale, "0.0000")
90    post.NonModalNumber (" Y", endY * scale, "0.0000")   62    post.NonModalNumber ("Y", endY * scale, "0.0000")
91    post.ModalNumber (" Z", endZ * scale, "0.0000")   63 --   post.ModalNumber ("Z", endZ * scale, "0.0000")
92    post.Text (" I")   64    post.Text ("I")
93    post.Number ((arcCentreX - currentX) * scale, "0.0000") = 65    post.Number ((arcCentreX - currentX) * scale, "0.0000")
94    post.Text (" J") <> 66    post.Text ("J")
95    post.Number ((arcCentreY - currentY) * scale, "0.0000") = 67    post.Number ((arcCentreY - currentY) * scale, "0.0000")
96    post.ModalNumber (" F", feedRate * scale, "0.0###") <> 68    post.ModalNumber ("F", feedRate * scale, "0.0###")
97    post.Eol() = 69    post.Eol()
98 end   70 end
99     71  
100     72  
101 function OnPenDown()   73 function OnPenDown()
102    if (preheat > 0.001) then <> 74    if toolClass == "MarkerTool" then
103       post.ModalText (" G00")      
104       post.ModalNumber (" Z", cutHeight * scale, "0.0000")      
105       post.Text ("\n G04 P")   75       post.Text("M09\n")
106       post.Number (preheat,"0.###")      
107       post.Eol()      
108    end   76    else
109    post.ModalText (" G00")      
110    post.ModalNumber (" Z", pierceHeight * scale, "0.0000")      
111    post.Text ("\n M03\n")   77       post.Text("M15\n")
112    if (pierceDelay > 0.001) then      
113       post.Text (" G04 P")      
114       post.Number (pierceDelay + firstPierce,"0.###")      
115       firstPierce = 0      
116       post.Eol()      
117    end = 78    end
118 end   79 end
119     80  
120     81  
121 function OnPenUp()   82 function OnPenUp()
    <> 83    if toolClass == "MarkerTool" then
122    post.Text (" M05\n")   84       post.Text("M10\n")
123    if (endDelay > 0) then   85    else
124       post.Text (" G04 P")   86       post.Text("M16\n")
125       post.Number (endDelay,"0.###")      
126       post.Eol()      
127    end = 87    end
128 end   88 end
129     89  
130     90  
131 function OnNewOperation()   91 function OnNewOperation()
132    post.Text (" (Operation: ", operationName, ")\n") <> 92    post.Text ("(Operation: ", operationName, ")\n")
133 end = 93 end
134     94  
135 function OnComment()   95 function OnComment()
136   post.Text(" (",commentText,")\n") <> 96   post.Text("(",commentText,")\n")
137 end = 97 end
138     98  
139 function OnToolChange()   99 function OnToolChange()
140    post.Text (" M06 T") +-    
141    post.Number (tool, "0")      
142    post.ModalNumber(" F",feedRate * scale,"0.0###")      
143    post.Text ("  (", toolName, ")\n")      
144    if (plungeRate <= 0) then      
145       post.Warning("WARNING: Plunge rate is zero")      
146    end      
147    if (feedRate <= 0) then      
148       post.Warning("WARNING: Feed rate is zero")      
149    end      
150 end = 100 end
151     101  
152 function OnNewPart()   102 function OnNewPart()
153    post.Text(" (Part: ",partName,")\n"); <> 103    post.Text("(Part: ",partName,")\n");
154 end = 104 end
155     105  
156 function OnDrill()   106 function OnDrill()
    <> 107    if toolClass == "MarkerTool" then
      108       local ex = endX
      109       local ey = endY
      110       local siz = 6 / 2 --cross size is 6mm
      111      
      112       endX = ex + siz
157    OnRapid()   113       OnRapid()
      114       currentX = endX
      115       currentY = endY
158    OnPenDown()   116       OnPenDown()
      117       endZ = cutHeight
      118       OnMove()
      119       endX = ex - siz
      120       OnMove()
      121       OnPenUp()
      122       endZ = safeZ
      123       OnRapid()
      124       endX = ex
      125       endY = ey + siz
      126       OnRapid()
      127       OnPenDown()
      128       endZ = cutHeight
      129       OnMove()
      130       endY = ey - siz
      131       OnMove()
      132       OnPenUp()
      133       endZ = safeZ
      134       OnRapid()
      135       return
      136    end
      137    
      138    OnRapid()
      139    post.Text("M05\n")
      140 --[[   OnPenDown()
159    endZ = drillZ = 141    endZ = drillZ
160    OnMove()   142    OnMove()
161    OnPenUp()   143    OnPenUp()
162    endZ = safeZ   144    endZ = safeZ
163    OnRapid() <> 145    OnRapid()]]
164 end = 146 end