Hi all, got a bit of a technical problem I’m trying to solve and I’ve got very little programming experience.

Basically, I’m trying to create a folder with a bunch of filament profile cfg files, with things like retraction distance, temperature, flow rate etc preloaded into them. That way, I can slice a model for a 0.6mm nozzle, send it to Klipper, and run it with any filament I want without having to re-slice, just change which cfg file is loaded.

This is going pretty well and I’ve figured out how to get most of what I want into the cfg. However, I want to limit my print speed by my maximum volumetric flow rate, a variable that Klipper does not support (and Kevin has more or less denied requests to have it added). To solve this issue, I want to limit the max speed instead, using a formula like this:

print speed = (max vol. flow) / (nozzle width) / (layer height)

(max vol. flow) and (nozzle width) would be defined manually by me for each profile. The only issue is (layer height), which of course can change from print to print. I know that my slicer puts the layer height and total number of layers in the header of the gcode, I also understand that that’s where Klipper gets this info from and how it displays those numbers once you’ve selected a file. What I’m having trouble figuring out is how I can send that number into the above formula; I found this which seems to be almost what I need, but I can’t figure out how to use the “print_stats object” in my cfg.

A potential workaround is to find my maximum layer height for each nozzle/filament combo and set the max speed assuming that later height, but if I’m printing something at say half my maximum layer height that’s going to severely unnecessarily reduce my print speed.

Any advice?

  • papalonian@lemmy.worldOP
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 month ago

    I could, but the entire purpose of what I’m doing is to avoid having any material-specific settings set in the slicer, so that re-slicing between filaments isn’t necessary.

    I actually got this working last night, I had to learn a lot about how variables work but it works like a charm:

    1. Slicer names a variable for layer height in the start gcode of every print

    2. cfg file for each filament contains a max volumetric flow for that filament/nozzle

    3. a macro takes these values and the layer height and finds a max speed for the given parameters

    4. a second macro assigns this value to the “speed factor” percentage

    5. print speed in slicer is set to 100mm/s, travel speed is set to 9999mm/s; say the equation limits my speed to 55mm/s, it sets speed factor to 55%, now moves with extrusion will be 55mm/s (travel will be 5500mm/s but limited to 500mm/s by printer’s max speed)

    All other filament/nozzle settings were really easy to bake into the cfg file, there’s just no official Klipper support for a max volumetric flow so I had to jank this system together.

    • ExcessShiv@lemmy.dbzer0.com
      link
      fedilink
      English
      arrow-up
      1
      ·
      edit-2
      1 month ago

      Do you often need to print the same file in significantly different materials with the exact same settings in support, infill type/percentage, wall thickness, rafts etc.? If I want to print something in e.g. PLA and ASA, I need fairly different slicer settings that would require re-slicing anyway.

      • papalonian@lemmy.worldOP
        link
        fedilink
        English
        arrow-up
        0
        ·
        1 month ago

        The only thing you mentioned that I would ever need to change between materials is supports, and I very rarely need to print anything with supports. Theoretically it makes sense to reslice for walls and infill so you can make thinner/ lighter models if the material is stronger, but I’d prefer the ease of switching to a perfectly dialed in profile over the occasional savings in material.

        The only thing that really needs anything special from the slicer in my experience is PETG with it’s funky bridging, everything else can be ignored if you have your material settings perfect. I’m getting much better quality prints with these quick profile swaps than I was quickly re-slicing things with mostly-good settings.

          • papalonian@lemmy.worldOP
            link
            fedilink
            English
            arrow-up
            1
            ·
            1 month ago

            Yup exactly, I was being lazy previously and if the settings (ie retraction, flow, pressure advance etc) were “close enough” I wouldn’t bother re-slicing, would just reprint and accept the good-enough quality. Now, no need to re-slice, and I get the spot-on material settings I’ve calibrated