Update a primitive
update_primitiveUpdate specific properties of a primitive (track, arc, text, fill, region, or via) in a PcbLib footprint by type and index, applying only the fields you specify.
Instructions
Update specific properties of a primitive (track, arc, text, fill, region or via) in a PcbLib footprint. Find the primitive by type and index (its position in read_pcblib's list for that type), apply only the specified updates. Moving a primitive to another layer drops the layer carriers it was read with (a region's v7_layer, an unmapped raw_layer_id) so the new layer's own token is written. On a stacked via (diameter_stack_mode other than simple) a diameter change also reaches per_layer_diameters: layers that shared the old diameter follow it, layers with their own value keep it, and the response reports how many followed.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"filepath": "<filepath>",
"component_name": "<component_name>",
"primitive_type": "<primitive_type>",
"index": "<index>",
"updates": "<updates>"
},
"name": "update_primitive"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| index | Yes | Zero-based index of the primitive within its type array | |
| dry_run | No | If true, show what would change without saving (default: false) | |
| updates | Yes | Properties to update (only specified properties are changed). Valid properties depend on primitive_type — track: x1, y1, x2, y2, width, layer; arc: x/x1, y/y1, radius, start_angle, end_angle, width, layer; text: x, y, height, rotation, text, layer; fill: x/x1, y/y1, x2, y2, rotation, layer; region: layer; via: x, y, diameter, hole_size, from_layer, to_layer. Any other key is refused. | |
| filepath | Yes | Path to the .PcbLib file | |
| component_name | Yes | Name of the footprint containing the primitive | |
| primitive_type | Yes | Type of primitive to update. Addressed by `index` into that primitive list. Pads are not here — they have a designator, so use update_pad. |