How to get the extruder that is enabled in GCODE script "After print job is paused"


I am trying to park the extruder that is activated during a pause in my IDEX printer. I am searching for the variable to get the extruder that is enabled in this script, the variable tool does not exist in this script.

Does anyone know how to get this information or is there any code to park the extruder that is activated in an IDEX printer?

My printer is a snapmaker j1s

G27 is park toolhead command, but not sure how that works with IDEX and the feature has to be enabled in Marlin.

I see in the example gcode script for pause it mentions If you do not have a multi-extruder setup so it might not be possible to handle.

I understand the limitation to keep all the positions for all the extruders. If there is somehow a way to use a global variable, I can set the extruder number during tool change and reuse the variable to do a pause. I did not found global variables also.

I think I am missing somethig :confused:

you might be able to achieve something with the gcode macros plugin, calling a macro with the tool specified in the command. I'm not as familiar with how the variables work in these templates, but I think it might be possible. you could then do conditional blocks of code utilizing the jinja2 templating system.

Howdy! I agree with jneiliii. Use Gcode Macros plugin. It is kind of convoluted but in your slicer, use the tool change gcode to insert a command to update the 'database' as to tool. I really am going to have to do a write up of this. I also use Gcode System Command plugin to do the update. The jinja2 has a 'namespace' syntax that makes variables kinda global, which I then load the database with an include. Let me find some time later this week for that.