lib_get_components
Retrieve all components from an EasyEDA Pro library with names, aliases, descriptions, and optional parameters or default designators for library audits.
Instructions
Get all components in a library.
Default fast path returns only the metadata that the
ILibCompInfoReader exposes directly: name, alias_name,
part_count, description. That path scales linearly with file IO
and finishes in well under a second on typical libraries.
Setting with_parameters=True adds each component's full
parameter dict (Manufacturer, Value, Footprint, etc.) to the
result. That branch calls GetState_SchComponentByLibRef once
per symbol and iterates parameters, which is O(N) in the live
SchLib document and is what makes the call slow on libraries
with many hundreds of components. Use it when you need the
parameters; for a single symbol's parameters, prefer
lib_get_component_details.
Setting with_designator=True adds each component's DEFAULT
designator (Component.Designator.Text, e.g. "U?" / "R?"
/ "IC?"). The CompInfoReader fast path does NOT expose the
designator, so this also loads each live symbol (same cost driver
as with_parameters) but skips parameter iteration, keeping the
payload small. Intended for library-wide designator-consistency
audits.
Args: library_path: Path to library (uses active library if not specified) with_parameters: If True, include each component's parameter dict (slow on large libraries). Default False. with_designator: If True, include each component's default designator string (slow on large libraries; smaller payload than with_parameters). Default False.
part_count HERE IS NOT TRUSTWORTHY. It comes from the
CompInfoReader, and MEASURED on AD26 it reported 2 for a symbol
created single-part whose every pin carries OwnerPartId 1, while
lib_get_component_details reported 1 for an identically
created symbol. The two readers disagree and only the
discrepancy is established, not a conversion between them, so
no correction is applied here rather than guess one. Use
lib_get_component_details when the part count matters.
Returns:
Dictionary with count and components list. Each
component carries index, name, alias_name, part_count,
description, (only when with_parameters is True) parameters,
and (only when with_designator is True) designator.
``index`` is a stable addressing key (position in library
order). Pass it as ``component_index`` to lib_get_component_details
/ lib_delete_component / lib_rename_component to reach a
component whose ``name`` contains bytes you cannot reproduce
(an embedded double-quote, or a control char from a broken
import), the case where matching by name fails.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| library_path | No | ||
| with_designator | No | ||
| with_parameters | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||