Skip to content

Machine Selector: support Fusion .f3d/.f3z files - #91

Open
george-roberts wants to merge 1 commit into
masterfrom
machine-selector-f3d
Open

george-roberts wants to merge 1 commit into
masterfrom
machine-selector-f3d

Conversation

@george-roberts

Copy link
Copy Markdown
Contributor

Summary

Lets the machine selector use Fusion design files (.f3d / .f3z) that carry a machine definition. The embedded .mch (e.g. MachineAsset/Machines/simulation.mch) is extracted to a temp file and passed to the post engine via --machine.

  • New out/fusionArchive.js: minimal ZIP reader (stored, deflate, and Zstandard method 93, which Fusion uses), ZIP64 aware, searches nested .f3d inside .f3z. Prefers an [Active] machine asset when several exist.
  • Machine tree, import dialog and recents accept .f3d/.f3z; archives without a .mch are hidden from the list.
  • Tooltips, the axis/purpose/kinematics filter and the status-bar label read the extracted .mch.
  • The selection keeps the archive path (tree highlight/recents unchanged); it is resolved to the extracted .mch only when building post arguments. Extraction is cached in $TMPDIR/AutodeskPostUtility/ArchiveMachines, keyed on path + mtime + size.
  • "Edit machine file" on an archive opens the extracted .mch, with a note that edits are not written back.

Notes

  • Zstandard needs zlib.zstdDecompressSync (Node >= 22.15). On older editor runtimes, selecting an archive shows an error asking to update; plain .mch/.machine are unaffected.
  • Archive contents are treated as untrusted: decompressed sizes are capped (64 MB for .mch, 1 GB for nested designs, nesting depth 2) and the output file name comes from a hash, never from entry names.

Testing

Run under Cursor's Node 24 runtime:

  • Autodesk Generic 5-axis (CB Table-Head).f3d: extracts MachineAsset/Machines/simulation.mch byte-identical to an independent extraction; vendor/model parsed.
  • .f3z wrapping that .f3d: same result.
  • .f3d with no machine: reported as "No machine definition (.mch) found" and hidden from the tree.
  • maxOutputLength cap verified to throw ERR_BUFFER_TOO_LARGE.
  • node --check on all modified files; vsce package --no-dependencies builds.

Not yet exercised end-to-end in the Extension Development Host with the post executable.

Made with Cursor

Extract the embedded .mch (Zstandard/deflate ZIP entries, nested .f3d in .f3z)
to a temp file and pass it to the post engine. Archives without a machine are
hidden from the machine list.

Co-authored-by: Cursor <cursoragent@cursor.com>
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