feat: G2/G3 Arc Support — Bounding Box, Wipe Path, and Absolute Extrusion Fix#49
Open
adele-with-a-b wants to merge 1 commit intoGeekDetour:mainfrom
Open
feat: G2/G3 Arc Support — Bounding Box, Wipe Path, and Absolute Extrusion Fix#49adele-with-a-b wants to merge 1 commit intoGeekDetour:mainfrom
adele-with-a-b wants to merge 1 commit intoGeekDetour:mainfrom
Conversation
795bb71 to
6d0d649
Compare
6d0d649 to
6bd7996
Compare
Arc fitting can now be left enabled in the slicer. Adds: - compute_arc() for true arc bounding box via cardinal angle crossing - Arc-aware wipe distance and endpoint interpolation - 10 unit tests for arc bounding box correctness
6bd7996 to
a3ed18c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
G2/G3 Arc Support
Arc fitting can now be left enabled in the slicer. This PR properly handles G2/G3 arc commands:
GCodeStateBBoxonly used arc endpoints, ignoring the arc bulgecompute_arc()method computes true arc bounding box via cardinal angle crossing detectionwipe()andwipe_movement()used chord distance for G2/G3 segmentsArc Bounding Box
The existing
GCodeStateBBox.compute()only feeds the arc endpoint into the bounding box. For arcs that bulge beyond their endpoints (any arc crossing a cardinal angle — 0°, 90°, 180°, 270°), this underestimates the bounding box.compute_arc()computes the true bounding box by finding the arc center from I/J offsets, computing the sweep angle, and checking which cardinal angles fall within the sweep.Arc-Aware Wipe Path
The wipe functions retrace part of the printed loop while retracting. They calculated segment distance using chord length. For G2/G3 arcs, the actual path length is longer than the chord, causing wipes to stop short and leave gaps.
New helper methods:
Point.arc_length(),Point.point_along_arc(),Point.parse_arc_ij().Tests
tests/test_compute_arc.py— 10 geometric correctness teststests/visualize_arc_bbox.py— visual bbox comparison diagramWith these changes, the "Disable Arc fitting" warning in the README can be removed.