Skip to content

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
adele-with-a-b:arc-support
Open

feat: G2/G3 Arc Support — Bounding Box, Wipe Path, and Absolute Extrusion Fix#49
adele-with-a-b wants to merge 1 commit intoGeekDetour:mainfrom
adele-with-a-b:arc-support

Conversation

@adele-with-a-b
Copy link
Copy Markdown

@adele-with-a-b adele-with-a-b commented Feb 24, 2026

G2/G3 Arc Support

Arc fitting can now be left enabled in the slicer. This PR properly handles G2/G3 arc commands:

Area Problem Fix
Bounding box GCodeStateBBox only used arc endpoints, ignoring the arc bulge New compute_arc() method computes true arc bounding box via cardinal angle crossing detection
Wipe path wipe() and wipe_movement() used chord distance for G2/G3 segments Arc-aware distance calculation and arc interpolation for wipe endpoints

Arc 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 tests
  • tests/visualize_arc_bbox.py — visual bbox comparison diagram

With these changes, the "Disable Arc fitting" warning in the README can be removed.

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
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.

1 participant