Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add automatic layer height detection #34

Open
iitggithub opened this issue Jan 25, 2025 · 3 comments
Open

Add automatic layer height detection #34

iitggithub opened this issue Jan 25, 2025 · 3 comments
Assignees

Comments

@iitggithub
Copy link

Currently, the layer height needs to be passed to the script via a command line parameter. In prusa slicer, I would need to have the post processing script set to the following on my mac:

"/Library/Frameworks/Python.framework/Versions/Current/bin/python3" "/Users/stutaki/iitggithub/Bricklayers/bricklayers.py" -layerHeight 0.2;

The script should use the G-code comments to determine the layer height the model was sliced at.

During testing i found that Prusa printers seem to mention the layer height like so:

; layer_height = 0.15

and from some digging around online, I believe Bambu Labs uses:

; Z_HEIGHT: 0.15

@iitggithub
Copy link
Author

Submitted Pull request #26 to add automatic layer height detection via G-code comments

@taotien
Copy link

taotien commented Jan 25, 2025

According to https://help.prusa3d.com/article/post-processing-scripts_283913, you can also base it off of an environment variable. I'm assuming it's gonna be SLIC3R_LAYER_HEIGHT.

Although, it might be more convenient to just detect from the file for users running post-processing manually.

@TengerTechnologies TengerTechnologies self-assigned this Jan 25, 2025
@iitggithub iitggithub changed the title Add automatic layer height detection from G-code comments Add automatic layer height detection Jan 27, 2025
@iitggithub
Copy link
Author

iitggithub commented Jan 27, 2025

According to https://help.prusa3d.com/article/post-processing-scripts_283913, you can also base it off of an environment variable. I'm assuming it's gonna be SLIC3R_LAYER_HEIGHT.

Although, it might be more convenient to just detect from the file for users running post-processing manually.

I've pushed a commit that will try to obtain the layer height from the SLIC3R_LAYER_HEIGHT environment variable. If that fails, it'll try to find the layer height from the G-code comments and if that fails, it'll use the command line argument -layerHeight. Even if -layerHeight isn't specified it does set a default value of 0.2mm so we should be safe and it covers those users who want to run it manually.

I've also added a regex to support Simplify 3D G-code layerHeight comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants