diff options
Diffstat (limited to 'gerbonara/cad/kicad')
-rw-r--r-- | gerbonara/cad/kicad/base_types.py | 2 | ||||
-rw-r--r-- | gerbonara/cad/kicad/footprints.py | 20 |
2 files changed, 19 insertions, 3 deletions
diff --git a/gerbonara/cad/kicad/base_types.py b/gerbonara/cad/kicad/base_types.py index 11eeb6d..81eb0c4 100644 --- a/gerbonara/cad/kicad/base_types.py +++ b/gerbonara/cad/kicad/base_types.py @@ -239,7 +239,7 @@ class AtPos(XYCoord): x: float = 0 # in millimeter y: float = 0 # in millimeter rotation: int = 0 # in degrees, can only be 0, 90, 180 or 270. - unlocked: Flag() = False + unlocked: Flag() = True def __before_sexp__(self): self.rotation = int(round(self.rotation % 360)) diff --git a/gerbonara/cad/kicad/footprints.py b/gerbonara/cad/kicad/footprints.py index 7bdeec6..aedef41 100644 --- a/gerbonara/cad/kicad/footprints.py +++ b/gerbonara/cad/kicad/footprints.py @@ -627,7 +627,7 @@ class Footprint: zone_connect: Named(int) = None thermal_width: Named(float) = None thermal_gap: Named(float) = None - attributes: List(Attribute) = field(default_factory=list) + attributes: Attribute = field(default_factory=list) private_layers: Named(str) = None net_tie_pad_groups: Named(Array(str)) = None texts: List(Text) = field(default_factory=list) @@ -672,11 +672,27 @@ class Footprint: effects = TextEffect() self.properties.append(DrawnProperty(key, value, - at=AtPos(x, y, rotation), + at=AtPos(x, y, rotation, unlocked=True), layer=layer, hide=hide, effects=effects)) + def make_standard_properties(self): + if not self.property_value('Reference', None): + self.set_property('Reference', 'REF**', 0, 0, 0, 'F.SilkS') + + if not self.property_value('Value', None): + self.set_property('Value', self.name or 'VAL**', 0, 0, 0, hide=False) + + if not self.property_value('Footprint', None): + self.set_property('Footprint', '', 0, 0, 0) + + if not self.property_value('Datasheet', None): + self.set_property('Datasheet', '', 0, 0, 0) + + if not self.property_value('Description', None): + self.set_property('Description', self.descr or '', 0, 0, 0) + @property def pads_by_number(self): return {(int(pad.number) if pad.number.isnumeric() else pad.number): pad for pad in self.pads if pad.number} |