Skip to content

Add G-code parser, toolpath data model, and Bézier-to-arc approximation#5

Open
GitBruno wants to merge 3 commits into
andymasteroffish:masterfrom
ofxyz:master
Open

Add G-code parser, toolpath data model, and Bézier-to-arc approximation#5
GitBruno wants to merge 3 commits into
andymasteroffish:masterfrom
ofxyz:master

Conversation

@GitBruno
Copy link
Copy Markdown

@GitBruno GitBruno commented May 7, 2026

This PR extends ofxGCode with two major capabilities:

  1. G-code parsing — read existing .nc/.gcode files back into a structured data model
  2. Bézier-to-arc output — write arc-aware G-code (G2/G3) instead of thousands of G1 line segments

All existing methods (bezier(), line(), save(), draw()) are unchanged. No breaking changes.

Implements bezier_arc() which decomposes a cubic Bezier into pairs of
tangentially-joined circular arcs (biarcs), producing G2/G3 arc commands
instead of many short G1 line segments.  Also adds arc() for direct arc
insertion and save_arcs() for arc-aware G-code output.
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