Referencing other filament-specific gcode files?
-
I've taken the time to convert to volumetric printing and am taking advantage of the filament capabilities of RRF to have per-filament diameter, extrusion mult., retraction, advance, etc. This has pulled much of the filament-specific code out of my sliced gcode files, which is awesome. I have stock calibration gcode files I can just run; I can swap a filament mid-print and immediately adjust my configuration to be right for the new filament, and there's just one place where all this information is being maintained.
I'd like to keep going with this, and specifically I'd like to be able to define per-filament temperatures. I print primarily in PETG, and I've found it necessary to use a different temperature for initial layers than for latter ones. Thus I cannot simply use a single execution of M703 to do the job.
It feels like I could use gcode metacommands to do what I want, if I could insert them at start of layers. I could do this by having a specific macro file and using M98 to call it. However, ideally I would do this in a filament-specific manner as M703 does.
The most obvious thing I could do is misuse M703 somehow and use it as a per-layer macro rather than its original intention, but that just feels awful. I guess I'm really wishing that there were an M704 that would execute a generic, filament-specific macro, which I could then use for this purpose.
Are there other solutions that come to mind?
Thanks!
-
Look into M505
https://duet3d.dozuki.com/Wiki/Gcode#Section_M505_Set_configuration_file_folder
Lets you change between completely separate system folders
-
I think we will soon have the ability to pass parameters to macros which will make this sort of thing easier.
At present I think you're going to have to use the "on layer change" function of your slicer to call one or more macros and do the logic there.
In Prusa slicer you can use conditions to call different macros depending on the layer height.
Here I've used the filament type to build the file path.
You would need two macros for each filament which is messy.;set temp per filament {if layer_num < 2} M98 P"[filament_type]_1st_layer.g" {else} M98 P"[filament_type]_2nd_layer.g" {endif}
Output is
;set temp per filament - layer 0 M98 P"ABS_1st_layer.g"
;set temp per filament - layer 1 M98 P"ABS_1st_layer.g"
Probably better to call a single macro and do your conditional logic in there.
in the Prusa slicer layer change
M98 P"set_[filament_type].g"
in set_PLA.g
if job.layer < 2 G10 S195 R80 else G10 S180 R80
edit: You could of course call M703 and do the logic in there
I use this in my start gcodeT[current_extruder] ; select tool G10 S0 R0 T[current_extruder] ; Set temps to zero to stop slicer adding them M106 P[current_extruder] S0 ;Start with fan off M701 S"[filament_type]"; define filament ; All retraction and temp settings done in 0:/filaments/[filament_type]/config.g M703 ; load config file for [filament_type]
-
@Phaedrux Oh that's interesting but also heavyweight! I'll have a look.
-
@OwenD Thanks. Yes, I was thinking I would initiate from the PrusaSlicer layer change custom code. I may just have to look for creative ways to store a variable or something...
-
@paralepsis Ah, M28 looks like it might be better, can write the name of the filament-specific layer.g into a known location? This sort of thing.
Thanks all for your thoughts!