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

    Tool Change Script, Conditional Tool Change

    Scheduled Pinned Locked Moved Unsolved
    Gcode meta commands
    2
    13
    653
    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.
    • NeueKlasseundefined
      NeueKlasse
      last edited by

      Thank you, that should work,

      The Problem with tpre0/1 and tpost0/1
      is that everytime i change the tool it‘ll do
      The code. I want to switch that on or off...
      (Single nozzle don‘t need that, dual nozzle operation does.)

      I‘m sure the T0 in the config.g file executes
      It at the startup. I’ll test that tomorrow.

      In the start gcode i have t1,t0 a few times for
      The nozzles to heat up at the same time.
      Because:
      M104 P0 S230
      M104 P1 S230

      Does only start heating from tool0?!?!!?!

      I had to write:
      T0
      M104 P0 S230
      T1
      M104 P0 S230
      T0

      (And the same toolchange for the 2 introlines,
      To save time)

      Prusa Mini, Chiron @ BMG X2
      Metal SLS Printer Development

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

        @NeueKlasse
        T1 P0 would change tools without running any macros

        NeueKlasseundefined 1 Reply Last reply Reply Quote 0
        • NeueKlasseundefined
          NeueKlasse @OwenD
          last edited by

          @OwenD
          Oh ok, that’s a nice information!

          Do you know, is it possible to calculate temperatures?

          For example if tool0 temp is > than 200 degree
          Set actual tool0 temperature -20 degree

          Prusa Mini, Chiron @ BMG X2
          Metal SLS Printer Development

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

            @NeueKlasse
            Yes, you can monitor most things.
            I'm not sure if you mean lower the temp by 20 degrees, or set it to minus 20 degrees.
            if you only have one tool heater for both tools (like on a chimera hot end) then just use something like this (note M104 is deprecated, so I used G10)

            if heat.heaters[1].current > 200
                G10 P1 R140 S180 ;set standby to 140 and active temperature to 180 for tool 1 
            

            You mention start Gcode. I presume you mean in the slicer.
            Most slicers won't allow indenting, so to heat up both heaters you have to do something like you have done.

            G10 P0 R140 S205 ;set standby and active temp on tool 0
            G10 P1 R140 S205 ;set standby and active temp on tool 1
            T1 P0 ; select tool 1 to start it heating
            T0 P0 ; select tool 0 (will set tool 1 to standby and heat tool 0)
            M116 ; wait for heating to finish
            

            If you're working in a macro you can do something like this

            while iterations < #tools
            	G10 P{iterations} R140 S205 ;set standby and active temp
            	T{iterations} P0; set the tool to active to begin heating but don't run macro
            M116	;wait for heating to finish
            ; this would leave tool 1 selected
            T-1 P0; set both tools to standby
            
            NeueKlasseundefined 1 Reply Last reply Reply Quote 0
            • NeueKlasseundefined
              NeueKlasse
              last edited by

              Thank you very much for the Help,

              i mean Lower the Actual Temperature by 20 degrees (Regardless which Temperature is
              setted as long the Temperature is above 200 degrees)
              => i need that to simplify the Wipe Routine within the Toolchange Scripts (tpre tpost)

              so that the Slicer Toolchange Script has to go...

              Prusa Mini, Chiron @ BMG X2
              Metal SLS Printer Development

              1 Reply Last reply Reply Quote 0
              • NeueKlasseundefined
                NeueKlasse @OwenD
                last edited by NeueKlasse

                @OwenD
                i tried following Gcode:

                ; tpost0.g
                ; called after tool 0 has been selected
                ;
                ; generated by RepRapFirmware Configuration Tool v3.1.4 on Sun Nov 15 2020 19:31:40 GMT+0100 (Mitteleuropäische Normalzeit)
                ; Wait for set temperatures to be reached
                if heat.heaters[0].current > 200
                    if !move.axes[0].homed
                  	echo "X-Axis not homed, homing X first"
                 	G28 X0
                 
                    G1 X390 F10000 
                    G1 X380 F5000
                    G1 X390 F5000
                    G1 X380 F5000
                    G1 X390 F5000
                    G1 X380 F5000
                    M116 P1
                    G1 X380 F5000
                    G1 X390 F5000
                    G1 X380 F5000
                    G1 X390 F5000
                    G1 X380 F5000
                else 
                    M117 "wait for Temperatures"
                	
                M116 P0
                
                

                the Console gets following warning:

                T0
                Warning: both space and tab characters used to indent blocks by line 8

                Why?, it seems formatting but each IF is one TAB inside..

                The Printer should only Wipe if the Temperature is above 200 degree
                and M116 P1 is to wait for Tool 1 to cool down before wipe the excess off
                and if needed (to prevent crashing) to home X

                => if T0 gets selected the Printer Moves X to the Maxima to wipe T1 Clean while
                cooling down.
                (and the Same mirrored if T1 gets selected)

                Prusa Mini, Chiron @ BMG X2
                Metal SLS Printer Development

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

                  @NeueKlasse
                  The warning is just what it says.
                  If you go to the start of each indented line and hit delete you will find one with spaces instead of tabs.

                  On another note, heat.heaters[0] usually refers to the bed heater.

                  Also you should be careful jut putting a fixed value of 200 degrees and waiting till the temp > 200
                  What if you need to print at 190?

                  Simply using M116 P0 would achieve your goal in a tool change.

                  NeueKlasseundefined 1 Reply Last reply Reply Quote 1
                  • NeueKlasseundefined
                    NeueKlasse @OwenD
                    last edited by NeueKlasse

                    @OwenD

                    I choose 100 degree (just to be sure the tool is warm) (otherwise the printer knows that it runs just with tool0 single nozzle)

                    Yes you’re right i need heater 1 and 2

                    I think i found the problem
                    RRF doesn’t like
                    A indented if statement in an if statement...
                    I turned that into one if statement and it works.

                    I don’t know if it is right here but another problem is the heatup after the standby temperature... when the tool is active again.
                    It overshoots about 10 degree.
                    I’ve done the autocal. But it’s still to “aggressive”
                    It needs to be more “defensive” with small heatups (with 20-30 degree delta)

                    Prusa Mini, Chiron @ BMG X2
                    Metal SLS Printer Development

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

                      @NeueKlasse
                      You can have as many nested IF statements as you want.
                      You just can't have both spaces and TABS in your indentation.
                      Some editors will convert the tab to spaces if you hit enter on an indented line.
                      That is to say, the new line will look correctly indented, but it has spaces instead of a tab.

                      NeueKlasseundefined 1 Reply Last reply Reply Quote 0
                      • NeueKlasseundefined
                        NeueKlasse @OwenD
                        last edited by

                        @OwenD

                        I think it is not correctly formatted here in the post,

                        I set everything on the left and
                        Indented the second if with tab and the commands within one tab further....

                        But i still get this warning.

                        No space is in the indention.

                        Prusa Mini, Chiron @ BMG X2
                        Metal SLS Printer Development

                        1 Reply Last reply Reply Quote 0
                        • NeueKlasseundefined
                          NeueKlasse
                          last edited by NeueKlasse

                          My Toolchange script now Cools down
                          the Old tool before Selecting the New One (tpre, tpost)

                          the tpost code:

                          if heat.heaters[1].current > 100 && move.axes[0].homed = true
                          	G1 X-5 F15000
                          	while heat.heaters[1].current <= heat.heaters[1].active
                          		G1 X-13 F1000 
                          		G4 S2
                          		G1 X-5
                          		if heat.heaters[1].current >= heat.heaters[1].active
                          			break
                          	G1 X-13 F1000 
                          	G4 S2
                          	G1 X-5
                          	G1 X-13  
                          	G4 S2
                          	G1 X-5
                          	G1 X-13  
                          	G4 S2
                          	G1 X-5
                          	G1 X-13  
                          	G4 S2
                          	G1 X-5
                          	G1 X-13  
                          	G4 S2
                          	G1 X-5
                          	M116
                          	G1 X-13  
                          	G4 S2
                          	G1 X-5
                          

                          is there a Variable that equals to M116 => i want to wipe till the new tool is ready,
                          but i found no boolean in the object browser for it.

                          on the Paneldue i sometimes get the Message
                          M4 command is not supported in machine mode FFF.

                          But i have no M4 Command in it?!

                          Prusa Mini, Chiron @ BMG X2
                          Metal SLS Printer Development

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