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

Working with variables in Gcode?

Scheduled Pinned Locked Moved
Tuning and tweaking
6
11
1.6k
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.
  • undefined
    RudydG
    last edited by 28 May 2018, 17:51

    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
    • undefined
      Danal
      last edited by 29 May 2018, 02:41

      This post is deleted!
      1 Reply Last reply Reply Quote 0
      • undefined
        T3P3Tony administrators
        last edited by 29 May 2018, 08:33

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

        www.duet3d.com

        1 Reply Last reply Reply Quote 2
        • undefined
          WarriorMe
          last edited by 29 May 2018, 12:41

          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
          • undefined
            RudydG
            last edited by 31 May 2018, 17:59

            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

            undefined 1 Reply Last reply 3 Jun 2018, 23:32 Reply Quote 0
            • undefined
              dc42 administrators @RudydG
              last edited by 3 Jun 2018, 23:32

              @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?

              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

              undefined 2 Replies Last reply 6 Jun 2018, 04:21 Reply Quote 0
              • undefined
                whosrdaddy
                last edited by 4 Jun 2018, 15:20

                @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

                undefined 1 Reply Last reply 6 Jun 2018, 04:24 Reply Quote 0
                • undefined
                  RudydG @dc42
                  last edited by 6 Jun 2018, 04:21

                  This post is deleted!
                  1 Reply Last reply Reply Quote 0
                  • undefined
                    RudydG @whosrdaddy
                    last edited by 6 Jun 2018, 04:24

                    @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
                    • undefined
                      RudydG @dc42
                      last edited by 6 Jun 2018, 04:29

                      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.

                      undefined 1 Reply Last reply 6 Jun 2018, 11:41 Reply Quote 0
                      • undefined
                        whosrdaddy @RudydG
                        last edited by 6 Jun 2018, 11:41

                        @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
                        4 out of 11
                        • First post
                          4/11
                          Last post
                        Unless otherwise noted, all forum content is licensed under CC-BY-SA