Duet3D Logo Duet3D
    • Tags
    • Documentation
    • Order
    • Register
    • Login

    load unload macro with endless loop and cancel condition

    Scheduled Pinned Locked Moved
    Gcode meta commands
    7
    44
    3.0k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • A Former User?
      A Former User @OwenD
      last edited by A Former User

      @OwenD

      M106 P[current_extruder] S0 ;Start with fan off
      -> Is P within M106 not the fan but the extruder?

      Do you have defined these variables like in "G10 P0 S{heat.coldExtrudeTemperature+10} R{heat.coldRetractTemperature+5}" or if not where can I find a "reference" about all predefined variables like these?

      And why do you specify [current_extruder] within M104 as T but not within G10 as P, since in the G-Code-Reference of duet both are the "tool number"?

      OwenDundefined 1 Reply Last reply Reply Quote 0
      • OwenDundefined
        OwenD @A Former User
        last edited by

        @LB said in load unload macro with endless loop and cancel condition:

        @OwenD

        M106 P[current_extruder] S0 ;Start with fan off
        -> Is P within M106 not the fan but the extruder?
        M106
        Pnnn Fan number (optional, defaults to 0). (In RRF_3 relates to the fan number created by M950, NOT the fan pin number on the board)

        In my case the part fan is F0

        M950 F0 C"fan0" Q500                                        ; create fan 0 on pin fan0 and set its frequency
        M106 P0 C"Part_Fan" S0 B2.0 H-1
        

        However I also use a post processing script in Prusa Slicer to try to ensure that if there were multiple tools, the correct fan is selected (see below)

        Do you have defined these variables like in "G10 P0 S{heat.coldExtrudeTemperature+10} R{heat.coldRetractTemperature+5}" or if not where can I find a "reference" about all predefined variables like these?

        These are object model meta commands which refer to the values you set in M302.
        You woud typically set these in config.g , but it would be more accurate to have them in each filament config.g
        I found that the filament config.g isn't loaded until after the load.g is complete so in order to reference these values I had to put the M302 in the preheat macro for each filament.
        It would be nice if M703 accepted parameters so you could load the correct values at the start of a filament change.

        And why do you specify [current_extruder] within M104 as T but not within G10 as P, since in the G-Code-Reference of duet both are the "tool number"?

        Probably laziness 🙄
        At present I only use a single extruder, so it's not really an issue for me.
        I try to make everything I do as portable as possible, so that any hardware changes take as little re-writing of individual macros etc as possible.
        For accuracy and completeness it should be as you say.

        I should point out that I also have post processors in Prusa Slicer which adjust the code to suit RRF flavour better.
        In the case of G10 temps this will soon be possible within Prusa Slicer.
        At present M104 is used and will set both active and standby temps to whatever is in the slicer at every temp change

        #RRF-fixes.py
        # Save in Prusa Slicer Scripts folder
        # Add to Prusa Slicer post processing scripts
        
        import sys
        #open G Code fand store in memory "filedata"
        f = open(sys.argv[1],"r")
        filedata = f.read()
        f.close()
        # search filedata and put the results into newdata
        newdata = filedata.replace("M104 S","G10 S") # replace all M104 with G10
        # now we keep searching newdata
        newdata = newdata.replace("M109 S","G10 S") # replace all M104 with G10
        newdata = newdata.replace("M204 S","M204 P")  # replace all M204 S parameters with Parameter
        newdata = newdata.replace("M106 S","M106 P{tools[state.currentTool].fans[0]} S") # replace all M106 with code to select tool
        newdata = newdata.replace("M107","M106 P{tools[state.currentTool].fans[0]} S0") # replace all M107 with M1106 to turn off heater
        
        f = open(sys.argv[1],"w")
        f.write(newdata) # write info back to G Code file
        f.close()
        

        .
        I should also point out that my day job is making sparks and smoke (welding)
        I try not to bring that to coding, but "caveat emptor" applies if you use any of my code.
        😁

        A Former User? 1 Reply Last reply Reply Quote 0
        • A Former User?
          A Former User @OwenD
          last edited by A Former User

          @OwenD
          AAHHH sorry bout the Fan-question with m106 - seems I mixed that up...

          "It would be nice if M703 accepted parameters so you could load the correct values at the start of a filament change." +1 here!

          Where did you pick up the
          M104 S0 R0
          Why do they have to be "zeroed", couldn´t just the filament-config.g temps get loaded instead?
          Doesn´t work yet I guess...?

          (Not your dayjob - woah, 💪 don´t make me fear my image in the mirror 😩 ...)

          OwenDundefined 1 Reply Last reply Reply Quote 0
          • OwenDundefined
            OwenD @A Former User
            last edited by

            @LB said in load unload macro with endless loop and cancel condition:

            @OwenD

            Where did you pick up the
            M104 S0 R0
            Why do they have to be "zeroed", couldn´t just the filament-config.g temps get loaded instead?

            If there is no M104 in your start Gcode, prusa slicer (and others) will add it automatically.
            This just tricks the slicer into not doing that, so that all temps are as we intended.

            A Former User? 2 Replies Last reply Reply Quote 0
            • A Former User?
              A Former User @OwenD
              last edited by A Former User

              This post is deleted!
              1 Reply Last reply Reply Quote 0
              • A Former User?
                A Former User @OwenD
                last edited by A Former User

                @OwenD

                for some sort of end.g for the print files, I do not even get this to work:

                G1 X{"{move.axes[0].min+5}"} Y{"{move.axes[1].max-5}"} F500 ; position for easy part removal
                

                edit: seems to work with:

                G1 X{move.axes[0].min+5} Y{move.axes[1].max-5} F500 ; position for easy part removal
                

                yeah! juhuu my first conditional g-code... 😊

                O.K. next:

                ;set temps for all heaters to have time to cool down below 60°C touch-safe temp with an additional -5°C for safety to account for measurement-tolerances, what gives then 55°C
                ;make conditional: only if S>55 do the following, else skip:
                ;M104 S55				; turn extruder-heater off -> DEPRACTED in RRF>=3.x
                ;if T0 > S55
                ;G10 S55					; turn extruder-heater to a touch-safe temperature
                ;if P0 > S55
                ;M140 S55				; turn print-heat-plate to a touch-safe temperature
                

                Nobody here to know what the variable for the current heater0 & heater1 is or where I find an overview how these variables are called/named?

                OwenDundefined A Former User? 2 Replies Last reply Reply Quote 0
                • OwenDundefined
                  OwenD @A Former User
                  last edited by OwenD

                  @LB said in load unload macro with endless loop and cancel condition:

                  @OwenD

                  for some sort of end.g for the print files, I do not even get this to work:

                  G1 X{"{move.axes[0].min+5}"} Y{"{move.axes[1].max-5}"} F500 ; position for easy part removal
                  

                  edit: seems to work with:

                  G1 X{move.axes[0].min+5} Y{move.axes[1].max-5} F500 ; position for easy part removal
                  

                  yeah! juhuu my first conditional g-code... 😊

                  Yes, by using quotes you turned it into a string instead of a meta command

                  You need to study this
                  https://duet3d.dozuki.com/Wiki/GCode_Meta_Commands

                  O.K. next:

                  ;set temps for all heaters to have time to cool down below 60°C touch-safe temp with an additional -5°C for safety to account for measurement-tolerances, what gives then 55°C
                  ;make conditional: only if S>55 do the following, else skip:
                  ;M104 S55				; turn extruder-heater off -> DEPRACTED in RRF>=3.x
                  ;if T0 > S55
                  ;G10 S55					; turn extruder-heater to a touch-safe temperature
                  ;if P0 > S55
                  ;M140 S55				; turn print-heat-plate to a touch-safe temperature
                  

                  Nobody here to know what the variable for the current heater0 & heater1 is or where I find an overview how these variables are called/named?

                  In DWC go to the settings section and select "Object Model"
                  You can drill down to find what you want.
                  You may have to update RRF & DWC to see it.
                  You can also use M409 but it can't return the entire model.

                  A Former User? 1 Reply Last reply Reply Quote 1
                  • A Former User?
                    A Former User @OwenD
                    last edited by

                    @OwenD said in load unload macro with endless loop and cancel condition:

                    In DWC go to the settings section and select "Object Model"
                    You can drill down to find what you want.
                    You may have to update RRF & DWC to see it.
                    You can also use M409 but it can't return the entire model.

                    Thanks so much!

                    Where do I find the "settings" section for DWC -> on the project hosting page? At least I could not find anything in the webbrowser that´s named like this...

                    Phaedruxundefined 1 Reply Last reply Reply Quote 0
                    • Phaedruxundefined
                      Phaedrux Moderator @A Former User
                      last edited by

                      @LB I'm guessing you're not running the 3.2 beta, so if you're still on 3.1.1 you wouldn't see the object model browser.

                      Z-Bot CoreXY Build | Thingiverse Profile

                      A Former User? 1 Reply Last reply Reply Quote 0
                      • A Former User?
                        A Former User @Phaedrux
                        last edited by A Former User

                        @OwenD
                        @Phaedrux
                        Ah! Thanks -> have so much work with setting up the stuff, will wait for 3.2-alpha I guess...

                        For now this should be enough: https://duet3d.dozuki.com/Wiki/Object_Model_of_RepRapFirmware#Section_Uses
                        Combining with the
                        https://duet3d.dozuki.com/Wiki/GCode_Meta_Commands#Section_Object_model_properties
                        should work...
                        (Saw that tree-structure in the first place but didn´t know what to do but reading slowly in I think I get the hold somehwere there 🙂 )

                        1 Reply Last reply Reply Quote 0
                        • A Former User?
                          A Former User @A Former User
                          last edited by A Former User

                          @OwenD
                          @Phaedrux
                          @T3P3Tony

                          Thanks everybody,
                          because of the code-snippets posted by you I was able to implement it in a way I am happy for now:

                          duet2ethernet1.0.4 with RRF3.1.1

                          load:

                          ; https://duet3d.dozuki.com/Wiki/Filaments
                          
                          ; load.g
                          
                          
                          
                          if (state.currentTool=-1)
                              M291 P"No tool active" R"Can't proceed" S1 T10
                              abort;
                          
                          M703								;load from filament-config.g:
                          G10 S235 							; Set current tool temperature S___ ,for PETG 230-255°C
                          ;G10 S___							; get from filament-config.g
                          
                          M291 R"...heating up hotend..." P"...for loading filament..." S0 T100 				; Display message P=main-message R=secondary-message T=timer in sec
                          
                          ;https://duet3d.dozuki.com/Wiki/Gcode#Section_M116_Wait
                          ;M116																			; Wait for ALL temperatures to be reached (if no secondary parameters like H, C or S are defined)
                          M116 P0																			; Wait for P0=Tool0 to reach temp
                          ;M116 P_			; make automatic for tool selected
                          
                          M292 ; Clear messages
                          
                          
                          
                          ; reliable max speed for extrusion seems to be below 10mm/s for PETG, retract can be higher
                          M83 																			; Extruder to relative mode
                          
                          ;old style fix:
                          ;G1 E50 F200 												; Feed+/Retract- E__mm of filament at F___mm/min
                          ;G1 E250 F500 												; Feed+/Retract- E__mm of filament at F___mm/min
                          ;M400 														; Wait for moves to complete
                          ;G4 P5 														; Wait/Dwell P___ MILLIsecond(s), S___ second(s)
                          ;G1 E-2 F1000 												; Feed+/Retract- E__mm of filament at F___mm/min
                          
                          ;new style interactive:
                          M400 ; wait for moves to finish
                          while true
                              if iterations = 25
                                 break
                              ;M292 ; Clear messages
                              M291 P"Press OK to feed 50mm of filament (or CANCEL to abort)" R"Extrude?"  S3
                              M291 P"...moving the filament..." R"...wait..."  S0 T50		; make long enough to be displayed longer then it takes to extrude
                              G1 E50 F250 												; Feed+/Retract- E__mm of filament at F___mm/min
                              G1 E-2 														; Feed+/Retract- E__mm of filament at F___mm/min
                              M400 ; wait for moves to finish
                              ;M292 ; Clear messages
                          M400 ; wait for moves to finish
                          
                          
                          
                          M291 R"Done loading" P{move.extruders[state.currentTool].filament ^  " Filament"} S1			; Display new message
                          ; set all back
                          G10 S0 																			; Set current tool temperature S___
                          ;M292 																			; Hide message
                          

                          unload:

                          ; https://duet3d.dozuki.com/Wiki/Filaments
                          
                          ; unload.g
                          
                          
                          if (state.currentTool=-1)
                              M291 P"No tool active" R"Can't proceed" S1 T10
                              abort;
                          
                          M703								;load from filament-config.g:
                          G10 S220 							; Set current tool temperature S___ ,for PETG 230-255°C
                          ;G10 S___							; get from filament-config.g
                          
                          M291 R"...heating up hotend..." P"...to unload filament..." S0 T100 				; Display message P=main-message R=secondary-message T=timer in sec
                          
                          ;https://duet3d.dozuki.com/Wiki/Gcode#Section_M116_Wait
                          ;M116																			; Wait for ALL temperatures to be reached (if no secondary parameters like H, C or S are defined)
                          M116 P0																			; Wait for P0=Tool0 to reach temp
                          ;M116 P_			; make automatic for tool selected
                          
                          M292 ; Clear messages
                          
                          
                          
                          ; reliable max speed for extrusion seems to be below 10mm/s for PETG, retract can be higher
                          M83 																			; Extruder to relative mode
                          
                          ;old style fix:
                          ;G1 E50 F200 												; Feed+/Retract- E__mm of filament at F___mm/min
                          ;G1 E250 F500 												; Feed+/Retract- E__mm of filament at F___mm/min
                          ;M400 														; Wait for moves to complete
                          ;G4 P5 														; Wait/Dwell P___ MILLIsecond(s), S___ second(s)
                          ;G1 E-2 F1000 												; Feed+/Retract- E__mm of filament at F___mm/min
                          
                          ;new style interactive:
                          M400 ; wait for moves to finish
                          while true
                              if iterations = 25
                                 break
                          	;M292 ; Clear messages
                          	M291 P"Press OK to un-feed 50mm of filament (or CANCEL to abort)" R"Un-load?"  S3
                          	M291 P"...moving the filament..." R"...wait..."  S0 T50		        ; make long enough to be displayed longer then it takes to extrude
                          	G1 E-47 F500 																	; Feed+/Retract- E__mm of filament at F___mm/min
                          	G1 E-3 F300 																	; Feed+/Retract- E__mm of filament at F___mm/min
                          	M400 ; wait for moves to finish
                          	;M292 ; Clear messages
                          M400 ; wait for moves to finish
                          
                          
                          
                          M291 R"Done unloading" P{move.extruders[state.currentTool].filament ^  " Filament"} S1			; Display new message
                          ; set all back
                          G10 S0 																			; Set current tool temperature S___
                          ;M292 																			; Hide message
                          

                          Thanks!

                          Please close as "solved"

                          Krohm Koalaundefined 1 Reply Last reply Reply Quote 1
                          • Krohm Koalaundefined
                            Krohm Koala @A Former User
                            last edited by

                            @LB Do you ever have the message done loading/unloading ? I tried your solution but as soon as i cancel the purge, it kills the macro and don't finish it.

                            OwenDundefined 1 Reply Last reply Reply Quote 0
                            • OwenDundefined
                              OwenD @Krohm Koala
                              last edited by

                              @Krohm-Koala said in load unload macro with endless loop and cancel condition:

                              @LB Do you ever have the message done loading/unloading ? I tried your solution but as soon as i cancel the purge, it kills the macro and won't finish it.
                              likewise in the above case, abort would kill the macro (and print)

                              At present if you hit cancel in an M291 S3 dialog it will cancel the macro, so no, you would never get the finished message in that instance.

                              There was discussion about adding a third option to M291, but it doesn't seem to be on the current list for implementation.
                              Perhaps some some time after 3.2 is finalized.

                              A Former User? 1 Reply Last reply Reply Quote 1
                              • A Former User?
                                A Former User @OwenD
                                last edited by A Former User

                                @OwenD said in load unload macro with endless loop and cancel condition:

                                @Krohm-Koala said in load unload macro with endless loop and cancel condition:

                                @LB Do you ever have the message done loading/unloading ? I tried your solution but as soon as i cancel the purge, it kills the macro and won't finish it.
                                likewise in the above case, abort would kill the macro (and print)

                                At present if you hit cancel in an M291 S3 dialog it will cancel the macro, so no, you would never get the finished message in that instance.

                                There was discussion about adding a third option to M291, but it doesn't seem to be on the current list for implementation.
                                Perhaps some some time after 3.2 is finalized.

                                @OwenD
                                Thanks for pointing this out! That is what I assumed! Conditional G-code is pretty new, so not everything can be there from the start. But over time I guess there will be an option so I just let the code there to change it whenever the solution arrives...
                                @Krohm-Koala
                                To be honest I feel settled with the no "final" message since anyway in DWC it shows you that it has loaded everything -> since I currently only work with printers with only 1 extruder (and no colourchanger or stuff like that) the filamentchange-code posted is good enough for me now... hope you understand 🙂

                                Krohm Koalaundefined 1 Reply Last reply Reply Quote 1
                                • Krohm Koalaundefined
                                  Krohm Koala @A Former User
                                  last edited by

                                  @LB Totally understand 😄 it's just me who want too much 😂

                                  1 Reply Last reply Reply Quote 0
                                  • garethkyundefined
                                    garethky
                                    last edited by garethky

                                    I just did this and I deeply loath writing a macro for every filament. I'll have to go back and try G701 inside load/unload to save some extra lines that are not totally DRY. Here is what I did:

                                    each filament has a config that defines some variables

                                    ; set filament name, temperature and speed "variables"
                                    M563 P5 S"PLA"
                                    G10 P5 X215 Y300
                                    
                                    ; set retraction parameters
                                    M207 S0.4 F2100
                                    

                                    When I make a new filament, this is a bsically all I have to do now.

                                    Then load.g and unload.g just load up those variables and call a macro (this is where I need to try M703):

                                    M98 P"/filaments/PLA/config.g" ; the filament config isn't loaded until AFTER this macro runs, but we need the variables set now.
                                    M98 P"/macros/Filament/loadFilament.g"
                                    

                                    Then my load macro looks like this:

                                    ; loadFilament.g
                                    
                                    ; ask the user if they really want to light up the heater and load some filament
                                    M291 S3 P{"Click OK to heat to " ^ tools[5].offsets[0] ^ "C and load " ^ tools[5].name} R{"Load " ^ tools[5].name ^ "?"}
                                    
                                    ; Set current the configured temperature and wait for the extruder to reach temp
                                    M109 S{tools[5].offsets[0]}
                                    
                                    ; Pause and ask the user to position the filament for feeding
                                    M291 S2 P{"Load filament in the extruder and click OK to start loading " ^ tools[5].name} R{"Ready to Load " ^ tools[5].name} 
                                    
                                    M83 ; Extruder to relative mode
                                    
                                    ; rapidly feed filament from the gears to the bottom of the heat break
                                    G1 E58 F900 ; Feed 58mm of filament at 15mm/s
                                    G1 E30 F300 ; Feed 30mm of filament slowly
                                    
                                    ; purge and ask for more loop
                                    while true
                                        G1 E30 F300 ; Feed 30mm of filament slowly
                                        M400; Wait for moves to complete
                                    
                                        ; ask the user if they want to do that again?
                                        M291 S3 P{"Click OK to purge some more"} R{"Continue purging?"}
                                    

                                    So it asks put the temps and the filament name in all the messages. Plus it has a loop to purge more plastic and you can keep doing that as long as you want. (See the whole commit on github)

                                    When variables are implemented this will become so much less ugly.

                                    My next challenge is finding a way to check, at print start, if the filament/tool pairings in the print match the filaments configured on the tools in in the printer and abort if they don't 😔

                                    A Former User? 1 Reply Last reply Reply Quote 1
                                    • A Former User?
                                      A Former User @garethky
                                      last edited by A Former User

                                      @garethky

                                      Hi, really impressive - hat´s off! 👍
                                      It is promising to us all to simplify things by getting rid of redundant code via "links" & "variables"!

                                      What I do not understand by looking at the code:

                                      -> How does this work with the code you just posted, because is RRF not looking for the "un-"/"load.g" within the filament-folder of the selected filament? Since yours seems to be within the macros/filaments/ how does it find it automatically without throwing an error?😐
                                      -> Does this work really automatic with pressing within e.g. DWC here:
                                      552c5870-920e-4036-a6b8-3e4a3894d652-grafik.png

                                      @dc42

                                      What I really like:

                                      It does make sense to have a general/1-for-all un-/load.g one layer "before" in the folder-structure within Files/Filaments so to say, and to only be able to "overwrite" it with a more specific un-/load.g within that filament-folder, IF a special filament really needs it I guess 🤓 That way we could get rid of some redundant code?

                                      -> Wouldn´t some sort of it be cool as the general layout? Or did I oversee something here 🤔

                                      Krohm Koalaundefined garethkyundefined 2 Replies Last reply Reply Quote 0
                                      • Krohm Koalaundefined
                                        Krohm Koala @A Former User
                                        last edited by

                                        @LB Personnally, i've updated my filament change macro to have specific heat file by filament, it's not the most intuitive at first, but now that i have all my files, it's insanely good to use, i also add an axe movement to choose the filament i'm loading wich is also useful, loading a config file at the end could be easy to add but don't need it now, thanks to meta code 😄
                                        I hope the endless loop for purging could be done at one time but it's already good now

                                        M291 P"Mettre les chauffes et changer le filament ?" R"Changement du Filament" S3
                                        M80
                                        T0 P0		;Select tool
                                        M106 S0
                                        
                                        M98 P{"0:/filaments/" ^ {move.extruders[state.currentTool].filament} ^ "/e-heat.g"}
                                        
                                        M291 P"Mise aux origines..." R"Changement du Filament" S0 T30
                                        G28 ; homing
                                        M291 P"Mise à la position de purge..." R"Changement du Filament" S0 T30
                                        G1 X253 Y-5.9 F12000 ; aller à la position de purge
                                        while heat.heaters[1].current <= heat.heaters[1].active
                                            M291 P"Chauffes en cours... Veuillez Patienter..." R"Changement du Filament" S0
                                        if sensors.filamentMonitors[0].status == "ok"
                                            M291 P"Déchargement en cours, veuillez patienter..." R"Changement du Filament" S0 T30
                                        
                                            G1 E5 F150     ;Extrude 10mm filament at low speed
                                            ;G1 E-15 F500	;Retract 15mm filament at low speed 
                                            G1 E-100 F3600	;Retract 100mm filament at high speed
                                            M400
                                        
                                            while sensors.filamentMonitors[0].status == "ok"
                                                M291 P"Merci de retirer le filament." R"Changement du Filament" S0 T30
                                                G4 S0.1  ;attendre 0.1s pour éviter de surcharger le processeur
                                            while true
                                                if sensors.filamentMonitors[0].status == "noFilament"
                                                    M291 P"Filament déchargé, merci d''insérer le nouveau filament." R"Changement du Filament" S0 T30
                                                    G4 S0.1  ;attendre 0.1s pour éviter de surcharger le processeur
                                                else
                                                    break
                                        else
                                            while true
                                                if sensors.filamentMonitors[0].status == "noFilament"
                                                    M291 P"Aucun filament, merci d''insérer un filament." R"Changement du Filament" S0 T30
                                                    G4 S0.1  ;attendre 0.1s pour éviter de surcharger le processeur
                                                else
                                                    break
                                        
                                        G4 S0.7  ;attendre 1s pour laisser le temps d'insérer le filament
                                        
                                        M291 P"Chargement en cours...." R"Changement du Filament" S0
                                        M106 S255  ;mise en route du ventilateur pour refroidir la purge
                                        
                                        G1 E65 F3600	; extrude 65mm at high speed
                                        M83     	; mode d'extrusion relative
                                        G1 E20 F200	; extrude 10mm at low speed
                                        
                                        M400
                                        M98 P"/macros/Filament/Purge.g"
                                        
                                        G1 Z0.1 F200    ;Essuyer la purge
                                        G1 X0 F12000
                                        G1 Z20 F3000
                                        M106 S0
                                        
                                        M291 P"Filament chargé. Merci de définir le nouveau filament." R"Changement du Filament" S2
                                        M291 P"Déplacez l''axe X pour choisir le filament voulu. 0 = Aucun Changement / 1 = PLA / 2 = PETG / 3 = TPU" R"Changement du Filament" S2 X1
                                        if move.axes[0].machinePosition < 1
                                        elif move.axes[0].machinePosition < 2
                                            M702
                                            M701 S"PLA"
                                        elif move.axes[0].machinePosition < 3
                                            M702
                                            M701 S"PETG"
                                        elif move.axes[0].machinePosition < 4
                                            M702
                                            M701 S"TPU"
                                        
                                        M291 P{"""" ^ move.extruders[0].filament ^ """ a bien été défini comme filament chargé."} R"Changement du Filament" S2
                                        M98 P{"0:/filaments/" ^ {move.extruders[state.currentTool].filament} ^ "/heat.g"}
                                        
                                        1 Reply Last reply Reply Quote 0
                                        • garethkyundefined
                                          garethky @A Former User
                                          last edited by garethky

                                          @LB

                                          For whatever reason my version of RRF seems happy finding these paths (3.1.1, Duet 3 with a Pi attached). I've actually tried to use relative paths, but found that they are all relative to /sys/. If you are having trouble there is an absolute path option for M98 that starts from 0:/some/path/macros/filaments/loadFilament.g.

                                          Yes this it totally automatic from the GUI!

                                          I had another idea last night that im going to try: maybe the filament name is somewhere in the Object Model after M703 gets run and I don't have to use that extra tool to store the filament name string. I'll work on it some more today.

                                          1 Reply Last reply Reply Quote 0
                                          • dc42undefined
                                            dc42 administrators
                                            last edited by

                                            The filament name is available in the OM as move.extruders[n].filament.

                                            Duet WiFi hardware designer and firmware engineer
                                            Please do not ask me for Duet support via PM or email, use the forum
                                            http://www.escher3d.com, https://miscsolutions.wordpress.com

                                            1 Reply Last reply Reply Quote 1
                                            • First post
                                              Last post
                                            Unless otherwise noted, all forum content is licensed under CC-BY-SA