[SCH][Added] Save of unit_name attribute

This commit is contained in:
Salvador E. Tropea 2023-11-06 13:27:29 -03:00
parent 54c8c4d3ee
commit 76f168fb45
2 changed files with 8 additions and 4 deletions

View File

@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `remove_solder_mask_for_dnp` similar to `remove_solder_paste_for_dnp` but
applied to the solder mask apertures. (#476)
- `layer_defaults` to specify the default suffix and description. (#504)
- Schematic format:
- Support for *unit names* (#513)
- Internal templates:
- 3DRender_top, 3DRender_top_straight, 3DRender_bottom and
3DRender_bottom_straight: to generate simple and quick 3D renders.

View File

@ -788,7 +788,6 @@ class LibComponent(object):
if parent is None:
logger.warning(W_NOLIB + "Component `{}` with more than one `:`".format(comp.name))
comp.units = []
comp.unit_name = ''
comp.pins = []
comp.all_pins = []
comp.unit_count = 1
@ -869,10 +868,10 @@ class LibComponent(object):
comp.unit_count = max(unit, comp.unit_count)
# UNIT_NAMES...
elif i_type == 'unit_name':
# Units can have custom labels
# The format is not documented but as of V7 is:
# Units can have custom labels
# The format is not documented but as of V7 is:
# (unit_name "<NAME>")
comp.unit_name = i[1]
comp.unit_name = i[1]
else:
raise SchError('Unknown symbol attribute `{}`'.format(i))
if vis_obj:
@ -941,6 +940,9 @@ class LibComponent(object):
sdata.append(_symbol('in_bom', [Symbol(NO_YES[s.in_bom])]))
sdata.append(_symbol('on_board', [Symbol(NO_YES[s.on_board])]))
sdata.append(Sep())
if s.unit_name is not None:
sdata.append(_symbol('unit_name', [s.unit_name]))
sdata.append(Sep())
# Properties
for f in s.fields:
fdata = f.write()