attach_3d_model
Attach a STEP file as a 3D model to a PCB package, ensuring it sits over the pads and stands on the board. Handles offset, rotation, and versioning.
Instructions
Give a package in the OPEN library a 3D model from a STEP file. The model is placed in the
footprint's frame (KiCad library models need no offset; pass offset_mm [x, y, z] and
rotation_deg [rx, ry, rz] when a model's origin differs), saved as a 3D package document in
the project's folder, and linked to the package. Checks that the model sits over the pads.
The model must stand on the board: more of it above the board than below (pins may go
through), else nothing is saved and the call fails (allow_below_board=true for a part that
really hangs below, e.g. a through-board connector): fix rotation_deg (KiCad's 3D rotation
signs are the opposite of Fusion's; vendor STEPs are often Y-up and need +90 about X).
If the package already has a 3D model, the new model's file gets a versioned name
(_V2, ...) so the files in folder stay distinguishable. Boards that already use the
package keep their old model until refreshed: save the library (save_design), then on each
board run update_from_libraries(refresh_parts=[one part per device]) and push_3d.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | No | ||
| folder | No | 3D Packages | |
| package | Yes | ||
| offset_mm | No | ||
| step_path | Yes | ||
| rotation_deg | No | ||
| allow_below_board | No |