Path Rules and Code Snippets
-
- Posts: 11
- Joined: Mon Jun 15, 2015 8:46 pm
Path Rules and Code Snippets
Hi
I want to use a path rule to insert a code snippet at the start of a plasma cut and then insert another one at the end. This is what I want but don't think can happen:
Code Snip1
M3 S1
.
.
.
M5
Code Snip2
I think SheetCam can only do this with path rules:
M3 S1
Code Snip1
.
.
.
Code Snip2
M5
I can live with this. So I get that I use the On Start rule but how do I tell it to use the length of the cut? It seems to want a number and not a variable or expression.
The next question is can the post processor see either active path rules or code snippets when it is running? Which variables or functions do I use to do this?
John
I want to use a path rule to insert a code snippet at the start of a plasma cut and then insert another one at the end. This is what I want but don't think can happen:
Code Snip1
M3 S1
.
.
.
M5
Code Snip2
I think SheetCam can only do this with path rules:
M3 S1
Code Snip1
.
.
.
Code Snip2
M5
I can live with this. So I get that I use the On Start rule but how do I tell it to use the length of the cut? It seems to want a number and not a variable or expression.
The next question is can the post processor see either active path rules or code snippets when it is running? Which variables or functions do I use to do this?
John
-
- Posts: 162
- Joined: Tue Feb 25, 2014 6:53 am
Re: Path Rules and Code Snippets
John
This guy ErikMc says his path rule code snippets are put BEFORE M3 so I asked him a couple of times what post processor he is using:
https://www.forum.cncdrive.com/viewtopi ... 8&start=20
He says it's a post Les made for him. I've asked him to upload his post but don't know if he's going to help. He's been active on the UCCNC forum today but no reply to my request yet.
I've asked Les about this in a post a few days ago but still waiting for some feedback. UCCNC was doing some strange things with THC enabling at the position where the path rule was placing M205 (THC on) just after the pierce. That's why I'm interested to see if the path rules (or the PP) can be made to insert path rule code snippets before M3 and after M5.
Keith.
This guy ErikMc says his path rule code snippets are put BEFORE M3 so I asked him a couple of times what post processor he is using:
https://www.forum.cncdrive.com/viewtopi ... 8&start=20
He says it's a post Les made for him. I've asked him to upload his post but don't know if he's going to help. He's been active on the UCCNC forum today but no reply to my request yet.
I've asked Les about this in a post a few days ago but still waiting for some feedback. UCCNC was doing some strange things with THC enabling at the position where the path rule was placing M205 (THC on) just after the pierce. That's why I'm interested to see if the path rules (or the PP) can be made to insert path rule code snippets before M3 and after M5.
Keith.
-
- Posts: 257
- Joined: Thu Feb 26, 2015 12:11 am
Re: Path Rules and Code Snippets
why don't you edit the post processor to add in m205 before M3?
-
- Posts: 162
- Joined: Tue Feb 25, 2014 6:53 am
Re: Path Rules and Code Snippets
Any idea how I can do that with the path rules "On Small Shapes" and "On Small Circles" so if I wanted a code snippet before M3 and after M5, it would do it automatically.
Keith
Keith
- Les Newell
- Site Admin
- Posts: 3677
- Joined: Thu May 11, 2006 8:12 pm
Re: Path Rules and Code Snippets
I will look into adding an option to have rules insert the snippet before firing the torch.
-
- Posts: 162
- Joined: Tue Feb 25, 2014 6:53 am
Re: Path Rules and Code Snippets
Awesome stuff.Les Newell wrote: ↑Tue Jun 25, 2019 9:50 am I will look into adding an option to have rules insert the snippet before firing the torch.
Thanks Les.
Keith
-
- Posts: 257
- Joined: Thu Feb 26, 2015 12:11 am
Re: Path Rules and Code Snippets
Keithmancavedweller wrote: ↑Sun Jun 23, 2019 11:55 am Any idea how I can do that with the path rules "On Small Shapes" and "On Small Circles" so if I wanted a code snippet before M3 and after M5, it would do it automatically.
Keith
My approach to this was to add a text box which to define a custom tool parameter and then use that as an optional switch to turn off THC before whatever the process was that you did not want it to operate against.
An example would have been (as I like to have a look and what CandCNC do in their post processors [no harm in looking + learning]) to use an if statement such that if Toolxxxx||Toolxxx then provide the parameterThe following functions should only be called at post load time.
This means that they should be outside any other function definition.
DefineVariable(varName,units,min,max)
Define a variable name for use in the ‘set variable’ dialog.
varName = variable name
units. One of the following: sc.unitTEXT, sc.unitLINEAR, sc.unitANGULAR, sc.unitFEED, sc.unitRPM, sc.unitTIME, sc.unitPERCENT, sc.unitPITCH,
sc.unit0DECPLACE, sc.unit1DECPLACE, sc.unit2DECPLACE, ,sc.unit3DECPLACE, sc.unit4DECPLACE note the unitxDECPLACE units display
a number without units with a precision of the given number of decimal places
min minimum value (ignored for text)
max maximum value (ignored for text)
DefineCustomOption(caption,varName,units,min,max, default)
Adds an option to the post options.
caption is a label that is displayed next to the input box.
The rest of the syntax is as DefineVariable above.
ShowCustomOptions(caption)
Show an options dialog containing the options defined using DefineOption.
Caption is displayed in the dialog box title.
If no options have been defined this function has no effect.
DefineCustomToolParam(toolClass,caption,varName,units,default,min,max)
Adds an extra parameter to a tool definition.
toolClass is the tool class name. See the toolClass variable for a description of tool classes
default is the default value. Note that values are always in METRIC for linear units, RADIANS for angular units and a decimal fraction for percentage e.g 0.1 = 10%
The rest of the syntax is as DefineVariable above.
https://www.candcnc.net/downloads/
that way it is optional (you could associate it with another inside / outside offset etc).
With small circles or arcs, I have this within one of my post processors I created:
Code: Select all
function OnArc()
if (endX == CurrentX and endY == CurrentY) then return end
if(endX < materialX1 and endY < materialX1) or (endX > materialX2 and endY > materialX2) then return end
local radius = math.hypot(currentX - arcCentreX, currentY - arcCentreY)
len = radius * math.abs(arcAngle)
dist = dist + len
if (radius < slowRadius) then
feed = slowPercent * feedRate
ThcLockOn()
else
feed = feedRate
minTHCdist = feed / 180 -- 0.333 second of motion
if (minTHCdist > len) then
ThcLockOff()
else
ThcLockOn()
end
end
if(arcAngle < 0) then
post.Text (" G3")
else
post.Text (" G2")
end
post.NonModalNumber (" X", (endX + offX) * scale, "0.0000")
post.NonModalNumber (" Y", (endY + offY) * scale, "0.0000")
post.ModalNumber (" Z", (endZ + offZ) * scale, "0.0000")
post.Text (" I")
post.Number (((arcCentreX + offX) - currentX) * scale, "0.0000")
post.Text (" J")
post.Number (((arcCentreY + offY) - currentY) * scale, "0.0000")
post.ModalNumber (" " .. rotaryAxis, endA, "0.0000")
post.NonModalNumber (" F", feed * scale, "0.0###")
post.Eol()
end
but its a snippet without a leadin.... that is all it really is.... as it only operates based upon what arc radius it is sent.
So the code snippet is more advanced.
-
- Posts: 162
- Joined: Tue Feb 25, 2014 6:53 am
Re: Path Rules and Code Snippets
Thanks Rob,
but path rules simplify things immensely and for small shapes it would be a lot simpler to have the optional tick box Les is suggesting.
I don't want to have to pick out every tiny shape and put it on a different layer for example. I do however use custom variables and conditional post processing for other things.
Keith.
but path rules simplify things immensely and for small shapes it would be a lot simpler to have the optional tick box Les is suggesting.
I don't want to have to pick out every tiny shape and put it on a different layer for example. I do however use custom variables and conditional post processing for other things.
Keith.
-
- Posts: 162
- Joined: Tue Feb 25, 2014 6:53 am
Re: Path Rules and Code Snippets
Hi Les,Les Newell wrote: ↑Tue Jun 25, 2019 9:50 am I will look into adding an option to have rules insert the snippet before firing the torch.
any update on this or is it still some time away.
Cheers,
Keith
-
- Posts: 162
- Joined: Tue Feb 25, 2014 6:53 am
Re: Path Rules and Code Snippets
Bump.mancavedweller wrote: ↑Mon Aug 19, 2019 6:32 amHi Les,Les Newell wrote: ↑Tue Jun 25, 2019 9:50 am I will look into adding an option to have rules insert the snippet before firing the torch.
any update on this or is it still some time away.
Cheers,
Keith
- Les Newell
- Site Admin
- Posts: 3677
- Joined: Thu May 11, 2006 8:12 pm
Re: Path Rules and Code Snippets
The development version of SheetCam puts code at the start before M3 but code at the end will always be before M5.
-
- Posts: 162
- Joined: Tue Feb 25, 2014 6:53 am
Re: Path Rules and Code Snippets
Fantastic, thank Les, that will do nicely.
Keith.
Keith.