lib_link_3d_model
Link a 3D STEP model to a named PcbLib footprint in the active library, loading it as a component body that drives 3D view and height/placement DRC.
Instructions
Link a 3D STEP model to a PcbLib footprint.
Loads the STEP geometry into the footprint as an IPCB_ComponentBody
(the real 3D body that drives the 3D view and the height/placement
DRC), so the active document must be the .PcbLib that contains the
footprint. component_name selects the footprint by name (empty uses
the library's current footprint).
Args:
component_name: Name of the footprint in the active PcbLib
model_path: Path to the 3D model file (.step, .stp); must exist
offset_x: X offset in mils from the FOOTPRINT's origin. The
body is always moved onto that origin first: it arrives
at the board origin, and a footprint open in the editor
sits at Altium's library origin, about 50000,50000 mil,
so an offset of 50000 used to be needed to bring it back.
Do not add that any more.
offset_y: Y offset in mils, applied with offset_x
offset_z: Z offset in mils, sets the body's StandoffHeight.
This is the common adjustment: lifting a connector body
off the board so it sits on its pads rather than through
them.
rotation_x: NOT APPLIED, accepted for signature stability.
Set it in the library editor after linking.
rotation_y: NOT APPLIED, same reason as rotation_x.
rotation_z: NOT APPLIED. This one used to assign
Body.Rotation, and IPCB_ComponentBody has no such
property on AD26 26.9.1.9. MEASURED: it raised
"Undeclared identifier: Rotation", which DelphiScript
cannot catch, so the Try around it never fired and the
resulting modal took the whole polling loop down with
it. Passing a rotation used to cost you the bridge.
The rotation lives on the MODEL, not the body, and has
to be set before the model is attached
(Model.SetState in AutoSTEPplacer.pas). Its four
arguments are undocumented, so they are not guessed at
here. Rotate in the library editor for now.
Returns:
Dict with success, footprint, model,
footprint_origin_mils and moved_to_footprint_origin
(false means the body may sit at the board origin, away
from the footprint), and
applied -- which adjustments were actually written to
the body (standoff_height, rotation_z,
offset_xy). Check it rather than assuming: each
assignment is individually guarded, so one failing does not
fail the call. rotation_z is now ALWAYS false, see
above. standoff_height is confirmed live;
offset_xy is not yet.
A ``false`` means the adjustment did not happen, which
covers both a rejected assignment and an argument left at
its default of 0: the handler skips a zero rather than
writing it. ``offset_xy`` covers ``offset_x`` and
``offset_y`` together and is true if either is non-zero.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| offset_x | No | ||
| offset_y | No | ||
| offset_z | No | ||
| model_path | Yes | ||
| rotation_x | No | ||
| rotation_y | No | ||
| rotation_z | No | ||
| component_name | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||