Skip to content

Import STEP files into .shape.ts scripts (v1.31.0/1.31.1) - #20

Draft
asbis wants to merge 2 commits into
masterfrom
claude/distracted-kepler-a02937
Draft

asbis wants to merge 2 commits into
masterfrom
claude/distracted-kepler-a02937

Conversation

@asbis

@asbis asbis commented Dec 4, 2026

Copy link
Copy Markdown
Owner

To commits:

  • 8b8738b Import existing STEP files into .shape.ts scripts (v1.31.0): STEP-leser i stdlib, step-writer, typer og MCP-verktøy, med tester og en fixture.
  • c6a0d66 Stop STEP export from crashing the next OCCT call (v1.31.1).

Lagret fra en lokal worktree under opprydding 2026-12-04; ikke gjennomgått. Versjonsnumrene i grenene kolliderer (flere hever til 1.30.2/1.31.0), så de må rebases og nummereres om før fletting.

🤖 Generated with Claude Code

asbis and others added 2 commits October 22, 2026 18:49
`import part from "./input.step"` now bundles on every host, and the new
stdlib helper `importStep(bytes)` turns the bytes into a shape inside a
synchronous main(), so a script can load a part, edit it and export it.

- bundle-spec: SHAPE_BUNDLE_LOADERS maps .step/.stp (both cases; esbuild
  loader keys are case-sensitive) to the binary loader. The MCP engine and
  the extension host inline their own options, so both now spread the
  shared map; the serve host gets it through shapeBundleOptions.
- core/stdlib/step.ts: importStep does what replicad's async importSTEP
  does after `await blob.arrayBuffer()`, synchronously: Emscripten FS write,
  STEPControl_Reader, TransferRoots, OneShape, cast. It unlinks the temp
  file, frees the reader, progress range and root, and returns a Shape3D.
  A path string, a Blob, empty or non-STEP data each get a message that
  says how to import the file.
- executor: a main() that returns a Promise (async main, or replicad's
  importSTEP returned directly) now fails with "main() returned a Promise"
  and points at importStep, instead of "main() must return one of".
  The abandoned Promise's rejection is silenced.
- Typings: step-imports.d.ts declares *.step / *.stp modules as Uint8Array
  and ships with the shapeitup stubs, so the import type-checks.
- Docs: get_api_reference (stdlib + export) and the skill.
- Tests: core (real OCCT, against a block ShapeItUp exported itself),
  executor, shared, serve (native esbuild) and the MCP engine end to end
  (import, cut, export STEP; .STP; rebundle when the STEP changes).

Versions: extension, mcp-server and the plugin entry bumped to 1.31.0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Replicad's exportSTEP registers its XSControl_WorkSession with a GC scope
that deletes it directly, and also wraps it in a refcounting Handle that
the writer shares. When GC collects the scope, replicad's
FinalizationRegistry runs all three deletes in V8's order, so the session
is freed twice. The finalizer logs "function signature mismatch" or
"table index is out of bounds", and a later OCCT call dies with "memory
access out of bounds". A rebundle after an export allocates enough to
trigger that GC, which is why it crashed about 4 runs in 5.

Core now writes STEP itself (step-writer.ts) with one owner per object,
freeing everything in reverse order before it returns. The output matches
replicad's once entity numbering is ignored. The exporter uses it, and so
does the exportSTEP that scripts destructure.

Tests: step-writer.test.ts forces GC through v8/vm and fails 3 of 3 runs
against replicad's exportSTEP. export-rebundle.test.ts replays the
reported sequence; it failed 5 of 5 runs before the fix and passed 10 of
10 after. step-import.test.ts now runs its export first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
shapeitup-landing Ready Ready Preview Dec 4, 2026 9:10am UTC

This branch was successfully deployed

1 active deployment
Preview — c6a0d669 Deployed Dec 4, 2026 by vercel[bot]
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