PrusaSlicer Placeholder/Variable evaluation
 
Notifications
Clear all

PrusaSlicer Placeholder/Variable evaluation  

  RSS
TimW
 TimW
(@timw-3)
Active Member
PrusaSlicer Placeholder/Variable evaluation

I am using PrusaSlicer Version: 2.3.3+win64-202107161027

My custom G-code is set up as:

Start G-code

; * Start of TJW code **************************
; Reset speed, extrusion rates, and temperatures
M140 S{first_layer_bed_temperature[0]} ; set bed temp
M104 S{temperature[0]}
M117 {temperature[0]}

Template Custom G-code

; Template Custom G-code
M140 S{first_layer_bed_temperature[0]} ; set bed temp
M104 S{temperature[0]}
M117 {temperature[0]}

After slicing the exported G-code appears as:

...
;TYPE:Custom
; * Start of TJW code ********************************
; Reset speed, extrusion rates, and temperatures
M140 S85; set bed temp
M104 S250
M117 250

...

;AFTER_LAYER_CHANGE
;4
;CUSTOM_GCODE
; Template Custom G-code
M140 S{first_layer_bed_temperature[0]} ; set bed temp
M104 S{temperature[0]}
M117 {temperature[0]}

...

In the first instance the Placeholders are evaluated correctly but in the second instance no evaluation occurs.  Is this behaviour correct?  What do I need to do for placeholder/variable evaluation to be performed?

Thanks

Posted : 30/07/2021 3:19 pm
Ringarn67
(@ringarn67)
Reputable Member

@timw-3

Save, zip, and upload project file

Prusa i3 MK3S+ FW 3.11.0 (kit dec -20), PrusaSlicer 2.5.0+win64, Fusion 360, Windows 10

Posted : 30/07/2021 5:02 pm
bobstro
(@bobstro)
Illustrious Member
2¢ worth

Try enclosing the placeholders in square brackets. Curly braces are needed to evaluate expressions, but square brackets are used otherwise. No idea why it does it differently for layer change versus start gcode, but this is worth a shot.

FWIW - Your layer change example shows setting all layers to the 1st layer bed temp. Is that what you want? The reverse is true for the filament temp in the start gcode.

My notes and disclaimers on 3D printing

and miscellaneous other tech projects
He is intelligent, but not experienced. His pattern indicates two dimensional thinking. -- Spock in Star Trek: The Wrath of Khan

Posted : 30/07/2021 5:33 pm
TimW
 TimW
(@timw-3)
Active Member
Topic starter answered:
PrusaSlicer Placeholder/Variable evaluation

Thanks for the [] suggestion.  Unfortunately the placeholders are still not evaluated:

;AFTER_LAYER_CHANGE
;4
;CUSTOM_GCODE
; Template Custom G-code
M140 S[first_layer_bed_temperature] ; set bed temp
M104 S[temperature]
M117 [temperature]

The example that I am using illustrates the problem but is not what I actually use.

Thanks again.

Posted : 31/07/2021 12:18 am
TimW
 TimW
(@timw-3)
Active Member
Topic starter answered:
PrusaSlicer Placeholder/Variable evaluation

Simple project which illustrates the problem is attached.

Shape-Box

Thanks

Posted : 31/07/2021 12:24 am
TimW
 TimW
(@timw-3)
Active Member
Topic starter answered:
PrusaSlicer Placeholder/Variable evaluation

I have created a very simple model and modified the default Printer Settings/Custom G-codes.  It seems that evaluation of Placeholders occurs correctly for:

Start G-code
End G-code
Before layer change G-code
After layer change G-code

But there is no evaluation of Placeholders for:

Color Change G-code
Pause Print G-code
Template Custom G-code

The model I am using to illustrate the problem is: Placeholder_eval

Thanks for any help with this.

Posted : 31/07/2021 11:03 am
bobstro
(@bobstro)
Illustrious Member

I'm seeing the same. I'd open up a bug report ticket on Prusa's GitHub pages to get developer attention. This is only a user-user forum and the devs only pop in occasionally. 

My notes and disclaimers on 3D printing

and miscellaneous other tech projects
He is intelligent, but not experienced. His pattern indicates two dimensional thinking. -- Spock in Star Trek: The Wrath of Khan

Posted : 31/07/2021 3:44 pm
TimW
 TimW
(@timw-3)
Active Member
Topic starter answered:
PrusaSlicer Placeholder/Variable evaluation

bobstro, thanks for making the effort to reproduce the problem.  I have opened an issue on GitHub,    https://github.com/prusa3d/PrusaSlicer/issues/6760 , and will post any response back here.

 

Posted : 31/07/2021 7:05 pm
bobstro liked
TimW
 TimW
(@timw-3)
Active Member
Topic starter answered:
PrusaSlicer Placeholder/Variable evaluation

This issue has been confirmed.

"I think this a duplicate of #5782 which was fixed on master in 224f3e5. But there have been several duplicate reports already so perhaps the fix could be considered for cherry-picking into stable."

Hopefully we will see a released fix in the near future.

Posted : 05/08/2021 10:07 pm
bobstro liked
Share: