blj1884
Posts: 45
Joined: Mon Jan 30, 2017 8:34 am

Tool Change Scripting Bug

This is put in the Pre-Tool Change Script:

{IF "NEWTOOL=0"}G91
{IF "NEWTOOL=0"}G1 T0 E5.0000 F480
{IF "NEWTOOL=0"}G90

I also tried it this way, but without documentation wno know if the entire if then syntax has changed depending on where you use it?
{IF "NEWTOOL==0"}G91
{IF "NEWTOOL==0"}G1 T0 E5.0000 F480
{IF "NEWTOOL==0"}G90

No matter what the NEWTOOL is, it puts the code in?

G91
G1 T0 E5.0000 F480
G90
T0


G91
G1 T0 E5.0000 F480
G90
T1
parallyze
Posts: 354
Joined: Fri Jun 05, 2015 4:18 am

Re: Tool Change Scripting Bug

blj1884 wrote: Wed Sep 27, 2023 6:02 am This is put in the Pre-Tool Change Script:

{IF "NEWTOOL=0"}G91
{IF NEWTOOL=0} G91

Should do the trick. No v5 here, but can't remember putting conditionals inside quotation marks in the past...
blj1884
Posts: 45
Joined: Mon Jan 30, 2017 8:34 am

Re: Tool Change Scripting Bug

parallyze wrote: Wed Sep 27, 2023 7:37 am
blj1884 wrote: Wed Sep 27, 2023 6:02 am This is put in the Pre-Tool Change Script:

{IF "NEWTOOL=0"}G91
{IF NEWTOOL=0} G91

Should do the trick. No v5 here, but can't remember putting conditionals inside quotation marks in the past...
So your suggestion works, but I have to remove the white space or it looks like this in the gcode:
G91
G1 T0 E5.0000 F480
G90
T0


So This way works:
{IF NEWTOOL=0}G91
{IF NEWTOOL=0}G1 T0 E5.0000 F480
{IF NEWTOOL=0}G90


as for the "", it is because the old V4 way apparently did not need them, or the == part like in coding.


However, in V5 this is the layer change scripting way:
{IF "[current_layer_number] == 1"}M221 S115 ; increase flow rate by 10% for layer 1
{IF "[current_layer_number] == 1"}M220 S85 ; decrease Feedrate to 85% for layer 1

{IF "[current_layer_number] == 3"}M221 S100 ; reset flow rate to 95% for layer 2 and beyond
{IF "[current_layer_number] == 3"}M220 S100 ; Feedrate to100% for layer 2 and beyond


It would appear that all of the new scripting code formats are like layer change way I showed, and the old way for the V4 days was just left as is and not updated for consistent programming syntax. I find it to be a confusing way to go about it. Like with Windows 98, ME, XP, VISTA, 7, 8, 10, 11, all of the tools are sill in there 95 glory and not updated with the gui overhauls. and some of the others got stuck in whatever windows version they may have had a gui overhaul in. I just want documentation and script programming consistency. But I know keeping this rocketship slicer up to date with support is likely a never ending job.

It is odd to not have this properly documented.

Thank you for your help,
/retnel
S3D-Jason
Posts: 1488
Joined: Sun May 31, 2015 6:01 am

Re: Tool Change Scripting Bug

I'll add another suggestions. If you look at the gcode placeholder variables documented on this page (viewtopic.php?f=8&t=1959), you'll see that the variables to be used in the tool change script for the prior and next tools are [old_tool] and [new_tool]. If you want to use the new V5 syntax, you could just do something like:

{IF "[new_tool] == 0"}G91

You can do similar things in other scripts with placeholder variables like [current_layer_number], etc.
parallyze
Posts: 354
Joined: Fri Jun 05, 2015 4:18 am

Re: Tool Change Scripting Bug

blj1884 wrote: Wed Sep 27, 2023 6:13 pm as for the "", it is because the old V4 way apparently did not need them, or the == part like in coding.


However, in V5 this is the layer change scripting way:
{IF "[current_layer_number] == 1"}M221 S115 ; increase flow rate by 10% for layer 1
{IF "[current_layer_number] == 1"}M220 S85 ; decrease Feedrate to 85% for layer 1

{IF "[current_layer_number] == 3"}M221 S100 ; reset flow rate to 95% for layer 2 and beyond
{IF "[current_layer_number] == 3"}M220 S100 ; Feedrate to100% for layer 2 and beyond
<edit> - essentially talking about NEWTOOL vs. placeholders [] like in the post before mine... ^^ </edit>

On a side note: That example is quite irritating - only one of those 4 lines is actually doing what
the comment suggests... :?

Return to “Troubleshooting and Bug Reports”