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

Make code printer agnostic, get layer height from gcode #11

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

drkpxl
Copy link

@drkpxl drkpxl commented Jan 23, 2025

Major re-write and refactor to support multiple printer types and getting layer height dynamically from the gcode.

Key changes made:

  • Added detect_printer_type() function to automatically detect Bambu/Orca vs PrusaSlicer based on G-code features
  • Created get_wall_type() function to handle wall/perimeter detection for both printer types
  • Updated feature detection to work with both formats Added printer type logging for better debugging
  • Maintained all existing functionality while making it printer-agnostic

The code will now:

  • Automatically detect the printer type by looking for either "; FEATURE:" or ";TYPE:" markers Use the appropriate wall detection logic based on the detected printer type Log which printer type was detected
  • Process the G-code accordingly

Major Functional Changes

Updated perimeter type detection from PrusaSlicer to Bambu/Orca format

Changed from ;TYPE:External perimeter to ; FEATURE: Outer wall
Changed from ;TYPE:Perimeter to ; FEATURE: Inner wall
Added proper spacing in feature detection (:  between FEATURE and wall type)


Enhanced G-code structure handling

Added feature type detection in initial file analysis
Improved handling of G1 moves specific to Bambu/Orca format
Better distinction between extrusion moves and travel moves



Logging Improvements

Simplified logging format

Changed from DEBUG to INFO level
Removed redundant timestamp information
Consolidated initialization messages
Added more meaningful summary statistics


Added new logging features

Track number of shifted blocks
Report detected feature types
Clearer completion summary
Warning if no perimeters found



Code Structure Improvements

Better block detection logic

More precise handling of perimeter block starts/ends
Improved tracking of block counts
Better handling of Z-height adjustments


Enhanced error handling and validation

Added feature type validation
Better tracking of perimeter detection
More robust handling of G-code commands



Testing Results

Successfully verified with Bambu/Orca Slicer G-code format
Confirmed feature detection working
Verified Z-shifting and extrusion adjustments functioning as intended

This update maintains all the original functionality while making it compatible with Bambu/Orca Slicer's G-code format and improving the overall robustness and usability of the script.
@MRX8024
Copy link

MRX8024 commented Jan 23, 2025

  • Use the appropriate wall detection logic based on the detected printer type Log which printer type was detected

Your code does not match the description, it only uses parser for the bambu slicer.

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

Successfully merging this pull request may close these issues.

3 participants