Jump to content

List of all G-Code Commands Cura (Marlin Flavor) will use when slicing?


Recommended Posts

Posted · List of all G-Code Commands Cura (Marlin Flavor) will use when slicing?

Is there a comprehensive list of all G-code commands that cura will use when slicing an stl file?


For some background on this question: I would like to write my own controller to drive a 3D printer. I realize this is 'reinventing the wheel', however, its suppose to be a learning experience for me. I also would like to add more functionality to the traditional controllers existing on the market so necessary for my end-goal.


I digress, I would like to know if cura only uses a limited set of g-code commands (such as straight line and arc) and/or if there is a comprehensive list of g-code commands the cura software uses. I sliced several objects and looked through the resulting g-code to find the main movements only consist of G0 and G1 (linear moves). I did not find anything complex such as G2 or G5 (arcs and bezier curves) even though my model contained them.


If the cura slicer does limit too only simple movements it would make the start of this project much easier! Also, I am always curious how people organize software and program things so I would just love to know how its internally implemented anyways.


(Other notes, I understand that this will probably also depend on what machine is selected with what preferences. I also understand that different machines will have different setups with fans and multiple extruders, etc... I am primarily concerned with the movement types)


Sorry if this is in the wrong place or not relevant, this is my first post. 

Thanks for reading!

  • Link to post
    Share on other sites

    Posted · List of all G-Code Commands Cura (Marlin Flavor) will use when slicing?

    STL files contain only triangles.  No curves.  So when a slicer slices a layer it finds the intersection of a plane with these triangles and ends up with a lot of lines.  No curves.  So cura creates no curves.  No splines.  So good news for you I guess.


    I have completely rewritten the path planner for redeem (open source motion controller - runs on beagle bone black) so I'm very familiar with these.  I've also looked at repetier host (open source - arduino hardware) and Marlin (open source - also arduino).  I'm familiar with all these controllers.


    One key thing is understanding the concept of what ALL of these path planners call "jerk" but is not jerk.  It's "maximum instantaneous change in magnitude of motion".  It's in mm/sec (or meters/sec in redeem).  This sets the max junction speed.  So for example if you are making tiny angle changes while printing a circle you can pass through the junctions (point at the end of each G0 or G1) at a high speed - maybe 100mm/sec.  But if there is a 90 degree corner you have to slow down to 14mm/sec at the junction (assuming jerk is 20mm/sec).  This is because if the head is moving 14mm in and out of the junction the change is the hypotenous or sqrt(14^2+14^2)=20


    Another key concept is the "backwards planner".  The arduino can only plan about 16 moves ahead (beagle bone black can do about 256 moves ahead).  So you have to be able to stop.  If you were moving at 300mm/sec on the final move which is say only 1mm long and then you stop, you will have a problem (skipped steps).  So instead the planner makes sure you can always stop with the known next 16 steps (or so - depends how many steps are loaded into the planner at any given moment).


    Let me know if you have any questions.


    • Thanks 1
    Link to post
    Share on other sites

    Posted · List of all G-Code Commands Cura (Marlin Flavor) will use when slicing?

    Thanks for the information! Also the clarification on jerk because I always assumed it was the mathematical definition of jerk and had no idea it was something entirely different! That also makes sense that its only linear commands because of your explanation of triangles which I definitely overlooked. This is all very intriguing info regarding the planner which I will definitely have to do more research into. Again, thanks for the knowledgeable info and insights. 

  • 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

      • 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
          • Thanks
          • Like
        • 3 replies
      • 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
        • 26 replies
    • Create New...