Skip to content

Fix NC file loading freeze with vertex decimation and async chunked p…#6

Merged
bwees merged 1 commit into
prodfrom
claude/fix-nc-file-loading-Xqlw6
Apr 12, 2026
Merged

Fix NC file loading freeze with vertex decimation and async chunked p…#6
bwees merged 1 commit into
prodfrom
claude/fix-nc-file-loading-Xqlw6

Conversation

@bwees
Copy link
Copy Markdown
Member

@bwees bwees commented Apr 12, 2026

…rocessing

Large G-code files with continuous A-axis rotation caused the UI to freeze because every line created a vertex even when X/Y/Z barely changed between lines, and all parsing happened synchronously on the main thread.

Two fixes applied:

  1. Vertex decimation: Skip vertices within 0.1mm of the previous one (sub-pixel at any zoom level). This dramatically reduces geometry size for A-axis rotation programs where thousands of lines produce nearly identical XYZ coordinates. Motion type transitions (G0↔G1) always keep both vertices to preserve color boundaries.

  2. Async chunked processing: processGCodeAsync splits the G-code into 5000-line chunks with setTimeout(0) yields between them, keeping the loading spinner animated and the browser responsive. The result populates the same cache as the sync path, so GCodeToolpath's useMemo hits the cache instantly.

https://claude.ai/code/session_01XToJJomq1oMrbTxNLuJDjV

…rocessing

Large G-code files with continuous A-axis rotation caused the UI to freeze
because every line created a vertex even when X/Y/Z barely changed between
lines, and all parsing happened synchronously on the main thread.

Two fixes applied:

1. Vertex decimation: Skip vertices within 0.1mm of the previous one (sub-pixel
   at any zoom level). This dramatically reduces geometry size for A-axis
   rotation programs where thousands of lines produce nearly identical XYZ
   coordinates. Motion type transitions (G0↔G1) always keep both vertices to
   preserve color boundaries.

2. Async chunked processing: processGCodeAsync splits the G-code into 5000-line
   chunks with setTimeout(0) yields between them, keeping the loading spinner
   animated and the browser responsive. The result populates the same cache as
   the sync path, so GCodeToolpath's useMemo hits the cache instantly.

https://claude.ai/code/session_01XToJJomq1oMrbTxNLuJDjV
@bwees bwees merged commit 4c82ce4 into prod Apr 12, 2026
8 checks passed
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.

2 participants