Working with variables in Gcode?



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



  • This post is deleted!

  • administrators



  • 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.



  • 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


  • administrators

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

    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



  • This post is deleted!


  • @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.
    😉



  • 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.



  • @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.


Log in to reply