Jump to content

Modifying gcode to move print head out of the way


Recommended Posts

Posted · Modifying gcode to move print head out of the way

Hello! 

 

I am working on a research project where we are trying to track the progress of a print using a top down camera with an Ultimaker s5. After some research, I've figured out the best way to do this is by modifying the gcode of whatever print I send. I don't have any experience in this area; I know the M# lines correspond to specific firmware commands but I cannot find any documentation of how specifically to modify the gcode and make custom motions (or even a list of all the firmware commands). I don't know if I can do this through the cura application, or if I manually input commands into the code, and if I were, where/what they would be. 

 

For reference, I'm working with python and have been using a script which sends the gcode through the API. 

 

Does anyone have any advice or resources I can look for? Thank you!

  • Link to post
    Share on other sites

    Posted (edited) · Modifying gcode to move print head out of the way

    Update: I've figured out that by adding a G0 line to whatever coordinate i want to move the head to and then another g0 command to the most prior position will move the head there and then back. I'm doing this right before the beginning of a new layer, or the line before "LAYER X", as seen below

    .
    .
    G0 F600 X127.265 Y104.194 Z1
    G0 F9000 X127.995 Y137.027
    G0 X128.265 Y137.297
    G0 X50 Y50  //added line of desired coordinate
    G0 X128.265 Y137.297 //return line
    ;TIME_ELAPSED:71.017140
    ;LAYER:4 
    .
    .
    .
    G0 F600 X127.265 Y104.194 Z1.2
    G0 F9000 X159.537 Y103.463
    G0 X50 Y50
    G0 F9000 X159.537 Y103.463
    ;TIME_ELAPSED:82.405408
    ;LAYER:5

     

     

    Two questions: for my actual print, i will probably just make a for loop that does this automatically. However, is there a better way to do this rather than manually adding in commands? Also, what would be the best way to have the print head remain at the new coordinates (X50, Y50) for a few seconds?

    Edited by mmittlem
  • Link to post
    Share on other sites

    Posted (edited) · Modifying gcode to move print head out of the way

    a couple of things.... if you are moving the head you may wind up dragging over the print. you might consider a 

    Quote

    G91

    G0 F5000 Z1.0

    G90

    G0 X50 Y50

    G91

    G0 Z-1.0

    G90

     

    And if you are using cura as your slicer look up post procsessing scripts. that's what you want for this. 

     

    As to the pause look up Gcode options for your firmare. this should all be documented. Marlin is at https://marlinfw.org/meta/gcode/

    Edited by jaysenodell
  • Link to post
    Share on other sites

    Posted · Modifying gcode to move print head out of the way
    8 hours ago, mmittlem said:

    Two questions: for my actual print, i will probably just make a for loop that does this automatically. However, is there a better way to do this rather than manually adding in commands? Also, what would be the best way to have the print head remain at the new coordinates (X50, Y50) for a few seconds?

    1: A post-processor can do it automatically. They're written in Python and not hard to learn just by looking at the ones that come with Cura, they're inside the scripts folder inside the Cura configuration folder (in Cura, go to Help > Show Configuration Folder) or if you really can't figure it out, I might be able to help you.

    2:

    G4 S5 ; pause for five seconds
  • Link to post
    Share on other sites

    Posted · Modifying gcode to move print head out of the way
    On 4/1/2024 at 1:54 PM, jaysenodell said:

    As to the pause look up Gcode options for your firmare. this should all be documented. Marlin is at https://marlinfw.org/meta/gcode/

    This was the site i was looking for! For some reason all of the Marlin sites I found were out of date, but this is perfect! Thanks! 

     

    As for the cura scripts, my scripts folder in the directory you mentioned is empty. Actually most of those files are, exceptuser, definition_changes, extruders and machine_instances. Am I looking in the right place?

     

  • Link to post
    Share on other sites

    Posted · Modifying gcode to move print head out of the way
    7 hours ago, mmittlem said:

    As for the cura scripts, my scripts folder in the directory you mentioned is empty. Actually most of those files are, exceptuser, definition_changes, extruders and machine_instances. Am I looking in the right place?

    Either I'm crazy (high possibility) and it used to copy the scripts there when you installed it and has migrated up when I've updated, or I'm crazy and I decided to copy them all in there at one point.

     

    Either way, I'm crazy, you're probably in the right place.

  • Link to post
    Share on other sites

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now
    • Our picks

      • UltiMaker Cura 5.7 stable released
        Cura 5.7 is here and it brings a handy new workflow improvement when using Thingiverse and Cura together, as well as additional capabilities for Method series printers, and a powerful way of sharing print settings using new printer-agnostic project files! Read on to find out about all of these improvements and more. 
         
          • Like
        • 20 replies
      • S-Line Firmware 8.3.0 was released Nov. 20th on the "Latest" firmware branch.
        (Sorry, was out of office when this released)

        This update is for...
        All UltiMaker S series  
        New features
         
        Temperature status. During print preparation, the temperatures of the print cores and build plate will be shown on the display. This gives a better indication of the progress and remaining wait time. Save log files in paused state. It is now possible to save the printer's log files to USB if the currently active print job is paused. Previously, the Dump logs to USB option was only enabled if the printer was in idle state. Confirm print removal via Digital Factory. If the printer is connected to the Digital Factory, it is now possible to confirm the removal of a previous print job via the Digital Factory interface. This is useful in situations where the build plate is clear, but the operator forgot to select Confirm removal on the printer’s display. Visit this page for more information about this feature.
          • Like
        • 0 replies
    ×
    ×
    • Create New...