Filament Config.g and Conditional Gcode
-
Is a filament config.g processed where the following will work. I use firmware retraction and specify in the config.g. Is it possible to add conditionals like the following. Will this conditional be queued and checked on every layer?
if move.axes[2].machinePosition < 1.0 M207 S0.4 F2100 Z0.4 else M207 S0.4 F2100 Z0 M572 D0 S0.04
-
@ctilley79 said in Filament Config.g and Conditional Gcode:
Is a filament config.g processed where the following will work. I use firmware retraction and specify in the config.g. Is it possible to add conditionals like the following. Will this conditional be queued and checked on every layer?
if move.axes[2].machinePosition < 1.0 M207 S0.4 F2100 Z0.4 else M207 S0.4 F2100 Z0 M572 D0 S0.04
You can usually make an entry in a slicer that will execute some user defined code on each layer change.
But the filament specific file config.g is invoked by M703 - not a layer change.
Frederick
-
@fcwilt I know what's usually done but my goal was to decouple from the slicer a bit more. My question had more to do with what the firmware does when it encounters a file with meta commands whether commands were stored in memory and queued for future execution or not.
-
@ctilley79 said in Filament Config.g and Conditional Gcode:
@fcwilt I know what's usually done but my goal was to decouple from the slicer a bit more. My question had more to do with what the firmware does when it encounters a file with meta commands whether commands were stored in memory and queued for future execution or not.
You mean a file that is being printed?
I don't put any code into the slicer other than M98 commands to invoke files that I create and keep on the Duet.
Examples:
print_begin.g
print_end.g
print_layer_change.gMeta-commands in these file are executed like regular commands, processed as they are encountered.
Frederick
-
@fcwilt That's unfortunate.
-
@ctilley79 said in Filament Config.g and Conditional Gcode:
@fcwilt That's unfortunate.
Why is that unfortunate?
What is it you are hoping to do?
Frederick
-
@ctilley79 Just to summarize this, M703 is the command you want to get the filament-specific config.g executed. I do this in my Slicer pre-print gcode to get a single execution to set pressure advance, extrusion multiplier, and retraction settings, but you could easily do the same thing in the per-layer gcode to execute per layer.
I considered doing this also for temperature control reasons but ultimately decided not to bother. But it would work.
-
@paralepsis Gotcha. That's a good point. I can just add an additional M703 command in the layer change gcode section of my slicer.
I was hoping to execute M703 once, and RRF automagically execute the condition at the appropriate layer height. Wishful thinking lol.
-
@ctilley79 said in Filament Config.g and Conditional Gcode:
I was hoping to execute M703 once, and RRF automagically execute the condition at the appropriate layer height. Wishful thinking lol.
You could do that using a few global variables for the desired values.
They would be set once in the filament config.g file.
They would be used in a dedicated layer change file, something like print_layer_change.g.
Frederick