Jump to content

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.9 stable released!
        Here comes Cura 5.9 and in this stable release we have lots of material and printer profiles for UltiMaker printers, including the newly released Sketch Sprint. Additionally, scarf seams have been introduced alongside even more print settings and improvements.  Check out the rest of this article to find out the details on all of that and more
          • Like
        • 5 replies
      • Introducing the UltiMaker Factor 4
        We are happy to announce the next evolution in the UltiMaker 3D printer lineup: the UltiMaker Factor 4 industrial-grade 3D printer, designed to take manufacturing to new levels of efficiency and reliability. Factor 4 is an end-to-end 3D printing solution for light industrial applications
          • Heart
          • Thanks
          • Like
        • 4 replies
    ×
    ×
    • Create New...