Jump to content

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:

 

SET_PRESSURE_ADVANCE ADVANCE=n.nnn

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
{endif}

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
    gcode:
      SET_PRESSURE_ADVANCE ADVANCE={K}

     

  • Link to post
    Share on other sites

    • 5 months later...
    Posted · How can I make startup GCode that depends on the nozzle diameter?

    Not sure if have this figured out yet but I do something similar except for different extrusion widths when I was running Marlin. Just changed over to Klipper now and figuring out how I can do the same so still looking into an elegant solution but for the moment I use post-processing in Cura to set my K values


    Basically in my start gcode in Cura I have:
    M140 S{material_bed_temperature_layer_0}    ; Start heating the bed to initial layer temp
    G4 S30                    ; wait 30 secs
    M104 S{material_print_temperature_layer_0}    ; start heating the hot end to initial layer temp
    M190 S{material_bed_temperature_layer_0}    ; wait for bed
    M109 S{material_print_temperature_layer_0}    ; wait for hotend

    In Search and Replace with the checkbox for expressions ticked I do the following
    Search: M190 S85.1\t; wait for bed\nM109 S225\t; wait for hotend
    Replace: ;POST-PROCESSED DETAIL PETG 0.2_0.42\nM190 S85.1\t; wait for bed\nM109 S225\t; wait for hotend\nM92 E414.63\t; set new extruder setting for PETG\nM301 P14.19 I0.81 D62.17\t; set PID hotend 230C/50% fan\nM304 P114.31 I19.93 D437.00\t; set PID bed 85C\nM900 T0 K1.635 L1.72\t; Linear advance for DETAIL PETG 0.2_0.42

    And then in my specific Cura profiles, I just make sure to set the initial bed temperature to 85.1 (or whatever else triggers you use) so that it will trigger the search and replace code that I want. I also use this to set my extruder E steps, as well as PID settings. Because I have my PID values, and E-steps tuned for whatever setting that I'm using (PLA or PETG etc).

     

    So in the end I have about 15 different Search and Replace code to handle the various settings that I have. All hinging on this initial bed temp value.

    I even use this Search and Replace method to set different K (and L) values when I'm doing a different initial layer height for example. Bear in mind this was all for Marlin, so you'll have to modify the code to your needs.




     

    • Like 1
    Link to post
    Share on other sites

    • 1 year later...
    Posted · How can I make startup GCode that depends on the nozzle diameter?
    On 8/30/2020 at 12:58 AM, NameOfTheDragon said:

    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:

     

    SET_PRESSURE_ADVANCE ADVANCE=n.nnn

    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
    {endif}

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

    SIMPLE IS THE BEST:

     

    [gcode_macro m900]
    gcode:
      SET_PRESSURE_ADVANCE ADVANCE={params.K}

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