apply_schematic_ops
Batch multiple LTspice schematic edits (add components, connect pins, set values, add directives, and more) into one atomic transaction that loads the file once and saves once, minimizing API round trips.
Instructions
Apply many .asc edits in one transaction. Loads the schematic once, runs each op against the in-memory editor in order, and saves once at the end. Cuts the typical 25+ tool calls to build a real circuit (add_component × N + connect × N + add_net_label × N + edit_directive × N) down to a single round-trip.
Supported ops (each tagged via the op field): add_component, set_component_value, set_component_attribute, remove_component, move_component, add_net_label, connect, add_directive.
By default, the first op that raises aborts the whole transaction and nothing is written to disk. Set stop_on_error=false to run every op and persist whatever subset succeeded — useful when each op is independent and partial progress is acceptable. Errors are recorded under each op's error field; successes carry the per-op result keys (e.g. wire_count).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Path to .asc schematic | |
| ops | Yes | List of edit operations applied in order against a single in-memory AscEditor. The file is saved once at the end iff every op succeeded (or stop_on_error=false). Each op is tagged by its ``op`` field; see the schema for per-op fields. | |
| stop_on_error | No | When true (default), the first op that raises aborts the transaction and nothing is saved. When false, every op runs and per-op errors are recorded in ``results``; the file IS saved with whatever ops did succeed — set false only when failures are recoverable. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | ||
| applied_count | Yes | ||
| failed_count | Yes | ||
| saved | Yes | ||
| results | Yes | ||
| validation_warnings | No |