Jump to content

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


NameOfTheDragon

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