sch_swap_supplier_part
Bulk-swap supplier metadata on schematic components matching a filter for drop-in replacements; dry-run first, then export BOM to confirm integrity.
Instructions
Bulk-swap supplier metadata on schematic components matching a filter. WARNING (field-confirmed): this swaps supplier METADATA only. The canvas symbol and its label stay those of the OLD part. Use this ONLY when the replacement is a true drop-in with identical schematic symbol and PCB footprint (e.g. same 100nF 0603 cap in a different reel). For any part with a different symbol, footprint, or pin count, delete the component and re-add it instead — otherwise the schematic and BOM will disagree with the canvas symbol/label. Uses the same bug-1 metadata guard as sch_modify_component: unspecified fields (otherProperty, uniqueId, position, symbol, etc.) are preserved via a snapshot-and-merge round trip, so a swap that only touches supplierId doesn't wipe the rest of the BOM row. Non-dry-run swaps snapshot first: the active document (or, with allSchematicPages, the whole project) is committed to the local backup repo before any write, and the response includes the backup SHA. Note the multi-page walk is not atomic — if a page fails to open mid-walk the swap aborts with earlier pages already written; use the backup SHA to recover. Typical uses: rotate to a cheaper LCSC alt (match: {supplierId: "C25804"}, replace: {supplierId: "C17414", manufacturerId: "..."}), or bulk-tag a designator prefix (match: {designator: "R*"}, replace: {manufacturer: "YAGEO"}). match: filter fields with the same semantics as read-tool filter — exact string, ["a","b"] OR-array, or "prefix*" glob. Any component field is accepted (designator, supplierId, manufacturerId, manufacturer, ...). Matching runs against RESOLVED values: fields stored as ={...} template expressions are resolved from the netlist before the filter applies, matching what sch_get_all_components shows. If the netlist cannot be fetched, matching falls back to raw stored values. replace: at least one of supplierId, manufacturerId, manufacturer, supplier. dryRun: if true, returns the matches with before/after but does NOT modify (and takes no backup). Recommended for the first pass. allSchematicPages: walk every schematic page instead of only the active one; original page is restored. Returns { dryRun, swappedCount, swapped:[{primitiveId, designator, page, before, after}], backup? }. Always re-run sch_export_bom afterward to confirm BOM integrity.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| match | Yes | Filter fields to match components on (exact, OR array, or "prefix*" glob). | |
| dryRun | No | If true, return matches with before/after but do not modify. Recommended for first pass. | |
| refresh | No | If true, bypass the netlist cache when resolving ={...} templates for matching. Use after editing the schematic directly in the EasyEDA UI. | |
| replace | Yes | Supplier metadata to overwrite on matched components. At least one field required. | |
| document | Yes | Target document UUID — auto-switches to this document before executing. Get UUIDs from list_instances or editor_get_open_tabs. | |
| instance_id | No | Target EasyEDA instance ID (8-char hex). Required when multiple instances are connected. Omit when only one instance is connected (auto-selected). Use list_instances to see connected instances. | |
| allSchematicPages | No | Walk all schematic pages (defaults to active page only) |