Skip to content

[feature] reach primitives in non-active parts of a multi-part SchLib component #11

Description

@BiergitKraft

Creating multi-part Library Symbols and do changes afterwards.

I'm using this wonderfull tool to generate schematic symbols for my library. It works well when generating single part components, but has some limitations with muli-part components. In a schematic library, obj_query / obj_modify / obj_delete scoped to lib_component:NAME only ever see part 1 of a multi-part component, and OwnerPartId comes back empty. Correcting an existing multi-part symbol therefore requires a full delete-and-rebuild, which throws away everything the API cannot reproduce or was done manually. Generating multi-part components obviously works fine, only doing changes doesn't work.

I tested with the TPS23881B.
Component TPS23881B: 4 parts, 56 pins (part 1 holds 11 power/NC pins).

Call (scope lib_component:TPS23881B) Result Expected
obj_query ePin, limit=0 11 objects (part 1 only) 56
… property OwnerPartId empty string 1..4
obj_modify ePin, filter Designator=<pin in part 3> matched: 0 matched: 1
obj_modify ePin, filter Designator=<pin in part 1> matched: 1 matched: 1
lib_get_component_details 56 pins across all parts ✔

Proposed solution

Maybe one oft those proposals would work:

Make the `lib_component:` scope part-aware: iterate the component's full primitive collection instead of the current part, and accept a part filter (e.g. `filter="OwnerPartId=3"`).

or

 Expose an explicit selector: `lib_set_current_part(component_name | component_index, part_id)`, or a scope suffix like `lib_component:NAME@3`. Per-call rather than sticky state would keep the current `:= 1` default intact.

and perhaps

Populate `OwnerPartId` in query results regardless of the above. A caller cannot tell which part a returned primitive belongs to.

Alternatives considered

sch_set_component_part_id doesn't work in a schematic library.

Altium API surface

scripts/altium/Library.pas, Function SelectLibComponent (starting line 350), pins the part before every name-based resolution:

Try Component.CurrentPartID := 1; Except End;

The reset itself looks correct — its comment documents the "primitive lands in an invisible bucket" failure it prevents. So I guess you shouldn't remove it, but it would be great to add an way to target another part.

Additional context

I'm using: eda-agent 0.4.0 · Altium script SCRIPT_VERSION 2026.07.25.3 · Altium Designer 26.8.1.31 / Windows 11 · app_pingversion_match: true

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions