You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there an existing issue for this feature request?
I have searched the existing issues
Is your feature request related to a problem?
N/A
Which printers will be beneficial to this feature?
All
Describe the solution you'd like
PrusaSlicer added the ability to declare global and local variable names within Custom GCode scripts. From what I can see, this has not been ported over.
The advantage of the new macro language is it allows for regex matching (Perl syntax) and global scope assignment. For a worked example of where you'd use this:
Note: global vars are only available after they're declared, so Start G-Code is the best place to declare them if you need them everywhere.
{test_var} ; Should output 5 as the calculated value. Passed from the global declaration in the Start GCode.
; PSLICER-PLACEHOLDER-REGEX
{if printer_notes=~/.*PRINTER_VENDOR_PRUSA3D.*/};Printer is Prusa{endif}
; PSLICER-COMBINED-DEMO
{varb + vara} ; Test output, should be 55 as A = 35, B = 20 from Start G-Code declaration.
{
if printer_notes=~/.*MY_DEMO_TEST.*/ then
varb = 50;
endif
}
{varb + vara} ; Should be 85, as we updated the global B variable in the last section. But only if we put the text MY_DEMO_TEST in the printer notes.
Example Description:
A few examples are intertwined here:
Output a globally declared math expression {test_var}
If printer_notes contains the string PRINTER_VENDOR_PRUSA3D, output the comment ";Printer is Prusa"
Output the addition of the globally declared varb and vara
If printer_notes contains the string MY_DEMO_TEST, change the global varb to 50
Reoutput the prior varb + vara expression, if printer_notes has the MY_DEMO_TEST it should be 85, else it should be the prior 55.
Where might you use this? Custom value overrides. You can put keyword flags into any note fields (machine, filament, project) and your G-Code scripts will express the logic. For example, maybe you want a quick way to override the Z-Offset based on the platename (or project name), you could do a Regex lookup for your own formatted syntax (e.g. {{Z-0.15}} and have that z offset expressed.
Describe alternatives you've considered
No alternatives appear to exist for the new syntax.
_May not be all of it, just what I was able to find. Additionally, this may not contain all of the RegEx logic as PrusaSlicer also has a RegEx processor in Print Settings -> Output Settings -> Other.
Is there an existing issue for this feature request?
Is your feature request related to a problem?
N/A
Which printers will be beneficial to this feature?
All
Describe the solution you'd like
PrusaSlicer added the ability to declare global and local variable names within Custom GCode scripts. From what I can see, this has not been ported over.
The advantage of the new macro language is it allows for regex matching (Perl syntax) and global scope assignment. For a worked example of where you'd use this:
Note: global vars are only available after they're declared, so Start G-Code is the best place to declare them if you need them everywhere.
Example Scripts:
Start G-Code:
Pause G-Code (can be any section):
Example Description:
A few examples are intertwined here:
Where might you use this? Custom value overrides. You can put keyword flags into any note fields (machine, filament, project) and your G-Code scripts will express the logic. For example, maybe you want a quick way to override the Z-Offset based on the platename (or project name), you could do a Regex lookup for your own formatted syntax (e.g. {{Z-0.15}} and have that z offset expressed.
Describe alternatives you've considered
No alternatives appear to exist for the new syntax.
Additional context
Documentation:
Code:
_May not be all of it, just what I was able to find. Additionally, this may not contain all of the RegEx logic as PrusaSlicer also has a RegEx processor in Print Settings -> Output Settings -> Other.
PrusaSlicer generated .3mf and .gcode attached.
Example-NewMacroLang-Shape-Box.3mf.zip
The text was updated successfully, but these errors were encountered: