M703 - error if no filament is selected?
-
When using the Filament system, M703 is used to load config of the selected filament.
However, as stated in the G-Code dictionary, it will not throw an error if no filament was selected before.
Depending on how one uses the filament system, it would be quite useful to be able to abort printing if no filament was selected. Because obviously, if ones print files rely on correct data from filament config, the prints will fail completely if no filament config sets correct temperatures etc.AFAIK this is not implemented yet. If that's right I'd like to kindly ask for adding an optional parameter to M703 which would make it throw in case of unselected filament.
Thanks, Jannik
-
@jbjhjm
Whilst an additional parameter may be useful, you can work around it in a macro as follows.
This would cancel any print in progress when the macro is called if either no tool was selected, or the selected tool didn't have a filament loaded.The check for a null value is probably unnecessary. Just added for safety
if state.currentTool = -1 ; check if there's an active tool abort "No tool selected" if (move.extruders[state.currentTool].filament = "") || (move.extruders[state.currentTool].filament = null) ; check if there's a loaded filament abort "No filament selected"
-
I have a number of "sanity checks" at the beginning of my "print_begin.g" while which is executed from the slicer with M98 P"print_begin.g".
; check for selected filament if move.extruders[0].filament = "" M291 R"No Filament Selected" P"Cannot Continue" S2 T0 abort ; check bed heater active temp setting if heat.heaters[0].active = 0 M291 R"Bed Heater Active Temp = 0" P"Cannot Continue" S2 T0 abort ; check extruder heater active temp setting if heat.heaters[1].active = 0 M291 R"Extruder Heater Active Temp = 0" P"Cannot Continue" S2 T0 abort
-
ah thanks guys that's perfect! Have to look a bit more into the scripting features I guess
Note in case anyone wants to do the same:
Owen's example failed to work for me due to a compilation error.
I had to split the second if into:if move.extruders[state.currentTool].filament == "" abort "Error: No filament selected" if move.extruders[state.currentTool].filament == null abort "Error: No filament selected"
... and then it works as supposed.
-
@jbjhjm said in M703 - error if no filament is selected?:
if move.extruders[state.currentTool].filament == "" abort "Error: No filament selected" if move.extruders[state.currentTool].filament == null abort "Error: No filament selected"
I have not encountered a situation where the null check was needed - perhaps it can be null but I don't know when.
I have no test for a tool being selected as that is done just after the checks. I have no multi-tool printers.
T0 M703
Frederick