Take the packaged Fusion exporter, and a preset Fusion will load - #9
Merged
Merged
Conversation
The export moves out of `app/shared/fusion-library.ts` and into
`@toolpath/tool-support/export/fusion` 0.4.0, whose per-type rules come from
Autodesk's own published JSON Schema rather than from a table written here.
`app/shared/fusion-input.ts` is the whole seam that remains: this catalog's
records turned into what that package takes, and its `ExportNote`s read back
into the dialog. The dialog no longer asks for a workpiece material or a
spindle ceiling, because nothing here answers them yet.
Every tool now carries one preset, `Default Preset`, with 1 in every numeric
field. Libraries exported without one would not import: Fusion refuses a tool
whose `start-values.presets` is empty. The schema does ask for a preset —
every `start-values` branch declares `presets: { type: 'array', minLength: 1 }`
— but `minLength` is a string keyword and a no-op on an array, so no validator
enforces it and the earlier reading, that Fusion wants the key and not a preset
in it, went unchallenged. Of 727 tools across seventeen libraries Fusion itself
wrote, every one carries a preset and none carries zero.
What is written is the union of what all five preset shapes require, narrowed
per type by `fusionPresets`: a tap goes out with its six fields, a drill with
eleven and no cutting feedrate, a milling tool with twenty. `pretool-presets.ts`
is still the model for what those numbers should be and is still unwired; it
goes back through the same `ToolRequest.presets` the placeholder travels on.
The bump carries 0.3.1's collet grip tolerance, which widened from 1e-6 mm to a
thousandth of an inch, so `toolholding.test.ts` pins both sides of the corridor.
Collaborator
|
If you didn't already I think it would be good to integrate my changes from this PR: #11 into this since they will likely conflict it seems. |
# Conflicts: # AGENTS.md # apps/catalog/package.json # apps/dfm/package.json # packages/catalog-data/package.json # packages/catalog-data/src/toolholding.test.ts # pnpm-lock.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this is
Two things, one of which is a bug fix found by testing the export in Fusion.
The exporter moves into a package.
app/shared/fusion-library.tsis deleted and the work is done by@toolpath/tool-support/export/fusion0.4.0, whose per-type rules come from Autodesk's own published JSON Schema rather than from a table written here.app/shared/fusion-input.tsis the whole seam that remains — this catalog's records turned into what that package takes, and itsExportNotes read back into the dialog. The dialog drops its workpiece-material and spindle-ceiling questions, because nothing here answers them yet.Exported libraries would not import into Fusion. Every tool went out with
start-values: { presets: [] }, and Fusion refuses a tool carrying no cutting-data preset. Every tool now carries one placeholder,Default Preset, with1in every numeric field.Why the empty list looked correct
Autodesk's schema does ask for a preset — every
start-valuesbranch declarespresets: { type: 'array', minLength: 1 }— butminLengthis a string keyword, so on an array it is a no-op. Autodesk meantminItems. No validator enforces it, which is why the reading that Fusion wants the key and not a preset in it went unchallenged, and why the exporter package's own schema test could not catch it.Two independent confirmations:
ToolLibrary.schema.json(sha256 matching the digest pinned in ui-packages) under ajv, and Fusion still refused it. Schema-valid is not import-valid.Verified by re-importing the same library with one preset added: it loads.
How one preset serves five tool types
Autodesk states a preset's shape per type and the five shapes are not variations on one another.
defaultPresetwrites the union of what they require and letsfusionPresetsnarrow it — a field the type does not model is dropped before the record is written:Writing one shape per type here would have been a fourth copy of a table that already exists in the exporter and in the schema digest it is checked against.
materialis deliberately omitted — an absent band is no restriction rather than a narrow one, and the exporter supplies the all-materials band for that reason. The two booleans Autodesk hangsif/thenrules off are set, so the fields they demand travel with their own1.Why 1 and not a real number
They are placeholders. What a tool's feeds and speeds should be is a machining model, and this application does not answer that yet.
app/shared/pretool-presets.tsis that model, still unwired on purpose, and goes back through the sameToolRequest.presetsthe placeholder already travels on — after its three documented problems are fixed (spot/centre drills short of aspottingpreset's five feedrates, a tap given four fields atappingpreset does not model, and millimetre arithmetic against records stated in the vendor's own unit system). A visible1loads and nobody mistakes it for a recommendation.Also in here
1e-6mm to a thousandth of an inch.toolholding.test.tsnow pins both sides of that corridor, including40ERSS0312— a sealed ER40 collet 0.0635 mm undersize in both unit columns, which stays refused.app-support,tool-drawing,tool-scraper) still depend on tool-support 0.3.1, so two copies resolve in the store. Harmless — it is pure logic with no runtime state, and 0.4.0 is additive — but worth knowing.Tests
app/shared/fusion-input.test.ts— a newthe preset every tool carriesblock: one preset per request under its own guid, the milling required set measured againstFUSION_TYPESrather than a list retyped here, the drill narrowing, and the tap coming out as exactly its six.apps/catalog/tests/on-the-part.spec.ts— the end-to-end download assertion is now its opposite: one preset namedDefault Preset, not an empty list.pnpm checkgreen (check-style, lint, build, check-types, test). The export e2e passes.