Plecs Model Edit
plecs_model_editStructurally edit .plecs schematic files by adding or removing components, setting parameters and orientations, and connecting terminals; use it when PLECS RPC cannot modify a schematic.
Instructions
Edit a .plecs file structurally (PLECS RPC cannot modify a schematic).
Operations (applied in order)::
{"op": "add_component", "type": "Resistor", "name": "R2",
"position": [400, 200], "direction": "right", "flipped": "off",
"parameters": {"R": "10"}}
{"op": "remove_component", "name": "R2"}
{"op": "set_parameter", "component": "R2", "variable": "R", "value": "22"}
{"op": "set_orientation", "component": "R2", "direction": "up", "flipped": "on"}
{"op": "set_position", "component": "R2", "position": [400, 240]}
{"op": "connect", "source": "V_dc", "source_terminal": 1,
"target": "R2", "target_terminal": 1, "points": [[110, 200], [400, 200]]}
{"op": "add_outport", "name": "Vout", "position": [600, 200]}direction is right/left/up/down and flipped is on/off:
set them when the component is added (or use set_orientation later) so the
terminal sides match the intended signal flow. Rotating a placed component
invalidates explicit Points; drop them or re-run connect so PLECS re-routes.
In-place editing requires confirm=true, obeys the same write policy as other
tools (allowed roots, no install dirs), and creates a .bak-<ms> backup; pass
output to write elsewhere. validate loads the result in PLECS and rolls
back the in-place edit if loading fails.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | ||
| output | No | ||
| confirm | No | ||
| validate | No | ||
| operations | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||