The Z value for G01 would be your layer height
I'm not trying to find what my layer height is so that I personally know it, I'm trying to get the gcode to pass that information directly into a variable so I can use it in an equation
Not sure what slicer you use, but in prusa slicer you could just set the variable in the machine startup code with the layer_height
placeholder (or you could modify the start_print macro to pass it in). theoretically, you could also set it in the layer_change gcode in your slicer to account for variable layer height as well
I've managed to get Cura to display the layer height in the startup code, what I can't do is get Klipper to do anything with that value.
If I try to create a variable and define it's value as {layer_height}, Cura doesn't pass the variable's value, instead it just defines the new variable's value as "layer_height"
Could you set the speed in the slicer instead of Klipper?
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:
-
Slicer names a variable for layer height in the start gcode of every print
-
cfg file for each filament contains a max volumetric flow for that filament/nozzle
-
a macro takes these values and the layer height and finds a max speed for the given parameters
-
a second macro assigns this value to the "speed factor" percentage
-
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.
Glad to hear you got it working!
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.
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.
Fair enough, I've found that properly tuned material settings work best for my setup WRTG consistent quality.
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
The only issue is (layer height), which of course can change from print to print.
Technically not the only issue 😀 it can also change from layer to layer.
Maybe calculate it from the length of filament being pushed out / the length of the movement * filament cross section? I'm on my phone so I can't check right now but that info should be possible to extract from the gcode iirc
Technically not the only issue 😀 it can also change from layer to layer.
I realized a little bit into finding a solution that this would be a limitation. I'm using Cura which AFAIK doesn't support traditional "variable layer height" like prusaslicer. It does however allow for different layer height for infill; if I ever decide to do that, I can just adjust the infill print speed accordingly.
I actually got this working btw, I had to learn a bit about how variables work in Python/gcode but it's working like I charm! I find my max volumetric flow, set it in the material cfg, and it just runs prints right below my max extrusion rate. Everything has come off the printer looking perfect in between filament types, no re-slicing required!
3DPrinting
3DPrinting is a place where makers of all skill levels and walks of life can learn about and discuss 3D printing and development of 3D printed parts and devices.
The r/functionalprint community is now located at: !functionalprint@kbin.social or !functionalprint@fedia.io
There are CAD communities available at: !cad@lemmy.world or !freecad@lemmy.ml
Rules
-
No bigotry - including racism, sexism, ableism, homophobia, transphobia, or xenophobia. Code of Conduct.
-
Be respectful, especially when disagreeing. Everyone should feel welcome here.
-
No porn (NSFW prints are acceptable but must be marked NSFW)
-
No Ads / Spamming / Guerrilla Marketing
-
Do not create links to reddit
-
If you see an issue please flag it
-
No guns
-
No injury gore posts
If you need an easy way to host pictures, https://catbox.moe may be an option. Be ethical about what you post and donate if you are able or use this a lot. It is just an individual hosting content, not a company. The image embedding syntax for Lemmy is ![](URL)
Moderation policy: Light, mostly invisible