set_symbol_attributes
Write the attributes of placed symbols, as the Symbol Properties dialog of KiCad 10 sets them: "Do not populate" (dnp), "Exclude from bill of materials", "Exclude from board", "Exclude from position files" and "Exclude from simulation".
Instructions
Write the attributes of placed symbols, as the Symbol Properties dialog of KiCad 10 sets them: "Do not populate" (dnp), "Exclude from bill of materials", "Exclude from board", "Exclude from position files" and "Exclude from simulation".
The tool writes each attribute into each unit of the reference. KiCad 10.0.6 gives the other units the same DNP and Exclude from BOM, board and position files, but not Exclude from simulation (it keeps that one for each unit): the tool sets each unit, as the dialog on each unit does. The tool changes only the attributes. The OK of the dialog also copies the fields of the unit (not the Reference) to the other units (SCH_SYMBOL::SyncOtherUnits). The tool does not copy the fields: units with different fields keep them (set_symbol_fields changes the fields).
With a variant (KiCad 10), the tool writes the attributes of that variant: a value equal to the attribute of the symbol is no differential, and KiCad writes no variant with no differentials. A change of an attribute of the symbol does not change the variants: KiCad keeps the old value in each variant (the variant starts with the attributes of the symbol when KiCad loads the file), thus the file then has the old value as a token of each variant. This is correct, not a defect.
A symbol in a sheet that the hierarchy uses more than one time has one set of attributes for all its references (U201 and U301): give the same attributes for each of these references, or write different attributes through a variant.
The tool checks all changes and all files first, and writes no file when a check fails. It writes all files or no file. KiCad must not have the files open. A schematic file of the project with an older version than the installed KiCad writes is an error: the user converts it in KiCad first. The tool refuses a reference that is not annotated (U?), a duplicate reference, a variant that the project does not have, an attribute name that it does not know, a symbol with no token for an attribute to change (KiCad 10 writes the five tokens: save the schematic in KiCad first), a token whose value is not yes or no, the variants of an instance that are not next to each other, a file that KiCad loads under more than one name, and a project whose full sheet hierarchy the tool cannot read. The installed KiCad must be KiCad 10.0.
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": {
"schematic_path": "<schematic_path>",
"changes": "<changes>"
},
"name": "set_symbol_attributes"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| changes | Yes | One item for each reference (and variant): the reference, the attributes to set (a missing attribute does not change), and the variant name (empty: the symbol). | |
| schematic_path | Yes | A .kicad_sch file of the project. The tool finds the references in the full project. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |