← Commit history

MAKING_LIBRARIES: 3D model placement proven via API (importToTarget + orient + Package3DStop); document the deviceset-remap wall + screenshot

John Lauer ·7f518424e8 ·4mo ago ·parent 67fc5a2
2 files changed +29−9
MAKING_LIBRARIES.md+29−9
@@ -77,17 +77,37 @@ loaded (the green courtyard + `>NAME` / `>VALUE`), and a PACKAGE / SELECT / FINI  ![The 3D Package Generator with the nRF54L15 footprint loaded, ready for a model](lib-02-generator.png) -In the generator you (a) **PACKAGE -> insert the 3D model**, (b) position it over the footprint, and-(c) **FINISH**, which pushes the 3D package back to the library and writes the `package3d` URN.+The generator is itself an `adsk::fusion::Design` in the **`Package3DEnvironment`** workspace, with+three command definitions: `Package3DCmd`, `Package3DCreateCmd`, `Package3DStop` (Stop = FINISH).+So the insert + finish are drivable through `fusion_run_modeling_script` (full `adsk` API): -### Status of the last mile (being honest)+```python+# inside the generator, via fusion_run_modeling_script:+d = adsk.fusion.Design.cast(app.activeProduct); root = d.rootComponent+im = app.importManager+im.importToTarget(im.createSTEPImportOptions("C:/.../NAME.step"), root)   # the real 3D body+oc = root.occurrences.item(root.occurrences.count-1)                      # STEP imports Y-up;+mat = oc.transform2.copy()                                                # rotate 90 deg about X+mat.transformBy(_rotX(math.pi/2)); oc.transform2 = mat                    # so it lies flat (thin in Z)+ui.commandDefinitions.itemById("Package3DStop").execute()                 # FINISH -> Save dialog+``` -The insert + FINISH actions are **UI-only**: Fusion exposes them through neither a text command-(`fusion_list_text_commands` has `Electron.Create3DPackage` but nothing to insert a model or finish)-nor a routed bridge verb (`fusion_import_file` is not exposed). So completing the attach today means-either driving the Qt ribbon (UIA does not surface those collapsed menu items cleanly) or adding a new-bridge add-in command that does the association through Fusion's Library/Package API. That verb-(`fusion_attach_3d_package`) is the next build; everything up to it is proven above.+This **works**: the real chip imports at correct scale, orients flat, centered on the footprint, and+FINISH saves a 3D package to the cloud (the Save dialog Name/Location are confirmed via `desktop_ui_click`).++![The real nRF54L15 3D chip placed + oriented on the footprint, entirely via the API](lib-03-chip-on-footprint.png)++### The remaining wall (being honest)++`Electron.Create3DPackage <file>` builds a **standalone** 3D package. It does **not** map back onto the+open library's deviceset, and it does **not** write `package3d` into the `.lbr` (verified: the file is+byte-unchanged, the package still shows **Placeholder**). The deviceset-to-3D mapping is done in the+**Content Manager** (select the package -> Generate 3D Package -> Finish), which is Qt-UI and exposed by+neither a text command (the `addvariant`/`queryvariant` family is for schematic assembly variants, not+3D) nor the public API found so far. So `fusion_attach_3d_package` can automate everything up through+*placing + saving the model*; the final **deviceset re-map** needs Content Manager UI automation or a+deeper API, and is the open item. Launching the generator **from the selected package inside the open+library** (not from the `.lbr` file) is the most likely path to make the map stick.  ## Pitfalls 
lib-03-chip-on-footprint.pngadded
⋯ 1 unchanged line ⋯