Conditional gcode based on nozzle diameter
Hi everyone, I wonder if you can help me with something?
I want to make some conditional gcode in my filament profile that sets some different parameters based on the nozzle diameter. Specifically, pressure advance (but the specifics are not important).
On the face of it, this would appear to be quite simple. Slic3r user guide says to export a profile and then look at the items in it, and those should be what I can use. However I can't get it to work. Here's what I've tried...
; Filament gcode
{if [nozzle_diameter] == 0.2}SET_PRESSURE_ADVANCE ADVANCE=0.264
This produces the following error:
!!!!! Failed to process the custom G-code template start_filament_gcode
Parsing error at line 2. Expecting a boolean expression.
{if [nozzle_diameter] == 0.2}SET_PRESSURE_ADVANCE ADVANCE=0.264
OK, it appears not to like the square brackets. Try without.
!!!!! Failed to process the custom G-code template start_filament_gcode
Parsing error at line 2: Referencing a vector variable when scalar is expected
{if nozzle_diameter == 0.2}SET_PRESSURE_ADVANCE ADVANCE=0.264
Right... the user guide suggests that it's supposed to default to the current extruder if no index is give. How would I even give an index? What's the syntax for that?
Another part of the guide says I should be able to use `nozzle_diameter_1` (is that an index?) so try that...
!!!!! Failed to process the custom G-code template start_filament_gcode
Parsing error at line 2: Not a variable name
{if nozzle_diameter_1 == 0.2}SET_PRESSURE_ADVANCE ADVANCE=0.264
Oh dear. I've tried every combination I can think of, and I cannot find one that works. I also cannot find anywhere in the manual that clearly explains how to do this (there is an example of accessing the nozzle diameter but it doesn't work, as above).
Can anyone help me out here? I'm sure its really simple once you know the answer! 😉
RE: Conditional gcode based on nozzle diameter
[...] I've tried every combination I can think of, and I cannot find one that works. I also cannot find anywhere in the manual that clearly explains how to do this (there is an example of accessing the nozzle diameter but it doesn't work, as above).
Try:
{if nozzle_diameter[0] == 0.2} SET_PRESSURE_ADVANCE ADVANCE=0.264{endif}
Unfortunately, scalars don't seem to work like other variables, so you can't use something like:
[nozzle_diameter[0]]
At least not by any means I'm aware of.
Hint: If you hover your mouse over any setting in PrusaSlicer, the popup tool tip will show the the name of the corresponding setting.
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
RE: Conditional gcode based on nozzle diameter
Try:
{if nozzle_diameter[0] == 0.2} SET_PRESSURE_ADVANCE ADVANCE=0.264{endif}
Ha! That darn well works. Looks like its the {endif} that it needed. Seems kind of obvious now, but I found plenty of examples without an {endif}.
Awesome, thanks for setting me right. And also thanks for the tip about hovering the mouse to find the setting names.
RE: Conditional gcode based on nozzle diameter
I am having trouble printing with a .2 nozzle It cloggs all the time. Does this pressure advance have any affect? What is it suposed to do?
Regards,
Harley
RE: Conditional gcode based on nozzle diameter
@kelsey-harley
Pressure advance basically helps to prevent blobbing and oozing especially at corners. It predictively increases or decreases the nozzle pressure by speeding up or slowing down the extruder. Unfortunately it is unlikely to help with nozzle clogs. I used to get nozzle clogs on my Ender 3 _all the time_ that were due to the bowden tube working loose and pulling slightly away from the nozzle, that lets the filament leak out and up into the heat break and that's what causes nozzle clogs.. Luke's hot end fix didn't help. The little clamps that go around the tube fittings didn't help. Capricorn tubing didn't help. Nothing helped. I came to the conclusion that it was a fundamental design weakness and I was going to have to take drastic action.
So I did 2 things.
1. I built myself a remote direct drive extruder (see https://www.thingiverse.com/thing:4009262 and https://www.thingiverse.com/thing:4444403 ). This is also why I switched to Klipper - I needed the improved step throughput.
2. I got myself a Micro Swiss style all-metal hot end (no more bowden tube in the hot part).
Since then I have not had a single nozzle clog, although its only been on there a month.
An all-metal hot end might be enough. They are relatively cheap so worth a try I would think.
--Tim