Assign components field based on hierarchical sheet name


Is it possible through an existing feature, or the Python scripting console, to assign the name of the hierarchical sheet a symbol is in to a field of that symbol?

I am interested in doing this so that I can “Group By” the hierarchical sheets within a design when assigning component values in the Symbol Fields Table

If there is an alternative way to select several symbols, and then edit only their fields in the Symbol Fields Table, that would also be helpful.

Thanks in advance

Use ${SHEETNAME}. This is empty in the main sheet, so it shows nothing even if you make it visible.

Hi eelik,

That works fine for showing the sheet name on the component (and I imagine the same if I were to create a custom generator for the BOM).

Unfortunately, in the symbol fields table it just shows as ${SHEETNAME} which means I am not able to sort the symbols or group by their hierarchical sheet.

Screenshot from 2023-01-04 20-05-07

Is there some way I can force this value to be calculated in the symbol fields table view, or an alternative solution? board_dds in the neighbouring row is an example name for the sheet which is what I am aiming to achieve.


The problem is that because the field is editable it must show the original string, not the resolved value. I don’t know what would be a solution which would work for all use cases. Maybe it would need a “virtual” read-only field showing the resolved value.

If the Schematic Editor would have a python API it wouldn’t be incredibly difficult to create a custom dialog. But, alas, that API has been postponed for several years already and doesn’t seem to be coming for v7, either.

You can try your luck and file a wishlist issue for an enhancement in the dialog, but that would probably be counted as a new feature and wouldn’t be included in v7 even if it was accepted.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.