lib_set_model_source
Writes the datafile-link Location on a footprint model so it embeds in compiled libraries and no longer goes missing from used output. Use the exact source-library string from a known-good model.
Instructions
Write the datafile-link Location (source library) on a footprint model.
A footprint whose datafile link has an empty Location resolves in the SchLib editor by name but cannot embed into a self-contained compiled library, so the footprint goes missing in the used/compiled output even though the package's own compile reports no error. This writes Location so the model is embeddable. Location is set in place (never through AddDataFileLink with a path, which wedges AD26). Targets PCBLIB models matching model_name, or all PCBLIB models when it is empty.
IMPORTANT: get the exact source_library string from a known-good model that already embeds correctly. Read it via lib_get_component_details, whose models array now shows each model's location and use_component_library. This tool writes exactly what you pass; it does not infer the format.
Args: component_name: the component's LibReference. source_library: the source-library reference written into Location. model_name: optional footprint model name to target one model. use_component_library: optional; sets the embed-vs-search flag. library_path: optional .SchLib path; defaults to the focused lib.
Returns: {"success": true, "component": "...", "source_library": "...", "models_updated": N}.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| model_name | No | ||
| library_path | No | ||
| component_name | Yes | ||
| source_library | Yes | ||
| use_component_library | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||