Navigation

    Duet3D Logo

    Duet3D

    • Register
    • Login
    • Search
    • Categories
    • Tags
    • Documentation
    • Order

    Working with variables in Gcode?

    Tuning and tweaking
    6
    11
    1181
    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.
    • RudydG
      RudydG last edited by

      Hello, i have a complex movement (changing head position in a ultimaker 3 dual head)
      my code i made up of about 10 lines of small movement, and is carrefully tested.
      Now i want to change the startposition of this movement in the X and Y position.
      I know i can use the relative coordinates, and switch back to absolute coordinates after the movement, but then still i would have to make a X and Y movement to the startpoint.
      Anyone?

      1 Reply Last reply Reply Quote 0
      • Danal
        Danal last edited by

        This post is deleted!
        1 Reply Last reply Reply Quote 0
        • T3P3Tony
          T3P3Tony administrators last edited by

          Looks like you want to have a tool change macro:
          https://duet3d.dozuki.com/Wiki/ConfiguringRepRapFirmwareCartesianPrinter#Section_Tool_change_files

          1 Reply Last reply Reply Quote 2
          • WarriorMe
            WarriorMe last edited by

            If i understand correctly, you are trying to write a Gcode to move the second nozzle to the correct position?

            You don't actually need to do that. Setting the right tool offset is enough, though you need to include a command to lift the printhead in the "tpre" macro (which you can access in the system editor) to prevent the idle printhead from colliding with the bed when it's deploying.

            You also need to put the commands required to actually deploy or retract the nozzle in the "tpost" macros.

            1 Reply Last reply Reply Quote 0
            • RudydG
              RudydG last edited by

              I know i can use the macro's, that is not the poitn.

              This is the code i use to switch head (ultimaker head) it is rather complicated, and when i change something, i have to rewrite this entire code...
              That is why i want to use some variables.
              Many thanks,
              Rudy
              G1 X280 Y5 F20000 ;velige zone
              G1 X280 Y23 F5000 ;ga voor gleuf
              G1 X287.1 Y23 F5000 ; ga in gleuf
              G1 X287.1 Y16 F5000 ;beweeg eerste stuk
              G1 X285.1 Y9 F5000 ; beetje uit
              G1 X284.1 Y2 F5000 ;vrij
              G1 X280 Y5 F5000

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

                @rudydg said in Working with variables in Gcode?:

                I know i can use the macro's, that is not the poitn.

                This is the code i use to switch head (ultimaker head) it is rather complicated, and when i change something, i have to rewrite this entire code...
                That is why i want to use some variables.
                Many thanks,
                Rudy
                G1 X280 Y5 F20000 ;velige zone
                G1 X280 Y23 F5000 ;ga voor gleuf
                G1 X287.1 Y23 F5000 ; ga in gleuf
                G1 X287.1 Y16 F5000 ;beweeg eerste stuk
                G1 X285.1 Y9 F5000 ; beetje uit
                G1 X284.1 Y2 F5000 ;vrij
                G1 X280 Y5 F5000

                I'm sorry, the extent of my Dutch/Flemish is "twee biertjes alstublieft". Can you translate the comments for me?

                RudydG 2 Replies Last reply Reply Quote 0
                • whosrdaddy
                  whosrdaddy last edited by

                  @rudydg :

                  you could switch to relative positioning after the first G1 command, this way you only would need the absolute coordinates (Translated comments for @dc42 🙂 ) :

                  G1 X280 Y5 F20000 ; safe zone
                  G91 ; relative positioning
                  G1 Y18 F5000 ;position in front of the slot
                  G1 X7.1 F5000 ; go in the slot
                  G1 Y-7 F5000 ;move first part
                  G1 X-2 Y-7 F5000 ; almost out
                  G1 X-1 Y-7 F5000 ; free
                  G90; absolute positioning
                  G1 X280 Y5 F5000

                  RudydG 1 Reply Last reply Reply Quote 0
                  • RudydG
                    RudydG @dc42 last edited by

                    This post is deleted!
                    1 Reply Last reply Reply Quote 0
                    • RudydG
                      RudydG @whosrdaddy last edited by

                      @whosrdaddy said in Working with variables in Gcode?:

                      @rudydg :

                      you could switch to relative positioning after the first G1 command, this way you only would need the absolute coordinates (Translated comments for @dc42 🙂 ) :

                      G1 X280 Y5 F20000 ; safe zone
                      G91 ; relative positioning
                      G1 Y18 F5000 ;position in front of the slot
                      G1 X7.1 F5000 ; go in the slot
                      G1 Y-7 F5000 ;move first part
                      G1 X-2 Y-7 F5000 ; almost out
                      G1 X-1 Y-7 F5000 ; free
                      G90; absolute positioning
                      G1 X280 Y5 F5000

                      Ok, thank you, did not see you translated for me.
                      And will have a go with this method. Indeed yes, only one set of coordinates to manipulate in this situation.
                      😉

                      1 Reply Last reply Reply Quote 0
                      • RudydG
                        RudydG @dc42 last edited by

                        I'm sorry, the extent of my Dutch/Flemish is "twee biertjes alstublieft". Can you translate the comments for me?

                        whosrdaddy helped me out i guess.
                        Fun to see "twee biertjes alstublieft" always works ;-);-);-)

                        I have a second question,
                        How s the sequence of the toolchange files, i think there are 6 files, but i have some issues there also, and i don't find a clear explanation about is.

                        whosrdaddy 1 Reply Last reply Reply Quote 0
                        • whosrdaddy
                          whosrdaddy @RudydG last edited by

                          @rudydg said in Working with variables in Gcode?:

                          I have a second question,
                          How s the sequence of the toolchange files, i think there are 6 files, but i have some issues there also, and i don't find a clear explanation about is.

                          Look at the section "setting up the tool change files" of this documentation link.

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