Jump to content
Ultimaker Community of 3D Printing Experts

How can I make startup GCode that depends on the nozzle diameter?

Recommended Posts

Posted (edited) · How can I make startup GCode that depends on the nozzle diameter?

Hi everyone. I've tried looking in the online guides for this but I can't seem to find anything. I'm using Klipper firmware and I want to set the pressure advance based on the nozzle diameter. Is that something I can do in Cura? Basically what I need is a case statement, or if-then-else. The gcode I need to add is:



For a 0.4mm nozzle the value should be 0.153, for a 0.2mm nozzle it's 0.250, etc. The values are determined by printing a calibration tower and they are different for every nozzle size and in some cases per filament. In Prusa Slicer I've done it like this:

{if nozzle_diameter[0] == 0.2} SET_PRESSURE_ADVANCE ADVANCE=0.250
{elsif nozzle_diameter[0] == 0.4} SET_PRESSURE_ADVANCE ADVANCE=0.153

I imagine there must be some similar technique in Cura, Can anyone point me to the right documentation or an example, please?

Edited by NameOfTheDragon
  • Link to post
    Share on other sites
    Posted · How can I make startup GCode that depends on the nozzle diameter?

    Use the Linear Advance Setting plugin (from the Marketplace) to set your linear advance factor in profiles. Then - since you seem to be using Klipper), add this gcode macro to your printer.cfg:

    [gcode_macro m900]
    default_parameter_K: 0


  • 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

      • Talking additive | The 3D printing podcast
        Why should we be the only ones asking questions? Join us and ask Jabil all your questions on September 22nd 5pm CET
          • Like
        • 3 replies
      • Ultimaker masterclass: Optimizing your Ultimaker Cura workflow
        Save your seat for either broadcast on September 23.
        What will you learn?
        · Best practices for iterative print preparation and every lesson you should learn from each print
        · The right way to use per-object settings and when they are most useful
        · Easy-to-use resources for anyone who wants to develop their own printer definitions, plugins, or print profiles
        · How to optimize print profile settings and whether to “keep” or “discard” changes
        · When is the right time to export your drawing from CAD? (Based on Ultimaker Cura’s surprising power as 3D control software)
        · And a whole lot more tips and tricks!
        How can I join?
        This free masterclass will take place twice:
        1. 11am CEST (5pm SGT, 5am EDT)
        2. 5pm CEST (11am EDT, 8am PDT, 11pm SGT)
          • Like
        • 0 replies
      • Do you use 3D printing at work? Let us know
        It doesn't matter if you are using 1 Ultimaker or 10, there is inspiration in everything. We're looking for ...
        • 1 reply
    • Create New...