diff options
-rw-r--r-- | gerbonara/cad/kicad/base_types.py | 10 | ||||
-rw-r--r-- | gerbonara/cad/kicad/footprints.py | 14 | ||||
-rw-r--r-- | gerbonara/cad/kicad/pcb.py | 3 |
3 files changed, 16 insertions, 11 deletions
diff --git a/gerbonara/cad/kicad/base_types.py b/gerbonara/cad/kicad/base_types.py index 719d5ea..0c31404 100644 --- a/gerbonara/cad/kicad/base_types.py +++ b/gerbonara/cad/kicad/base_types.py @@ -523,13 +523,13 @@ class DrawnProperty(TextMixin): key: str = None value: str = None id: Named(int) = None - at: AtPos = field(default_factory=AtPos) - unlocked: Named(YesNoAtom()) = True + at: AtPos = None + unlocked: OmitDefault(Named(YesNoAtom())) = True layer: Named(str) = None - hide: Named(YesNoAtom()) = False - uuid: UUID = field(default_factory=UUID) + hide: OmitDefault(Named(YesNoAtom())) = False + uuid: UUID = None tstamp: Timestamp = None - effects: TextEffect = field(default_factory=TextEffect) + effects: OmitDefault(TextEffect) = field(default_factory=TextEffect) _ : SEXP_END = None parent: object = None diff --git a/gerbonara/cad/kicad/footprints.py b/gerbonara/cad/kicad/footprints.py index 127eef5..25e2329 100644 --- a/gerbonara/cad/kicad/footprints.py +++ b/gerbonara/cad/kicad/footprints.py @@ -658,6 +658,7 @@ class Footprint: pads: List(Pad) = field(default_factory=list) zones: List(Zone) = field(default_factory=list) groups: List(Group) = field(default_factory=list) + embedded_fonts: Named(YesNoAtom()) = False models: List(Model) = field(default_factory=list) _ : SEXP_END = None original_filename: str = None @@ -819,7 +820,7 @@ class Footprint: self.layer = flip_layer(self.layer) for obj in self.objects(): - if hasattr(obj, 'layer'): + if getattr(obj, 'layer', None) is not None: obj.layer = flip_layer(obj.layer) if hasattr(obj, 'layers'): @@ -829,8 +830,9 @@ class Footprint: obj.effects.justify.mirror = not obj.effects.justify.mirror for obj in self.properties: - obj.effects.justify.mirror = not obj.effects.justify.mirror - obj.layer = flip_layer(obj.layer) + if obj.layer is not None: + obj.effects.justify.mirror = not obj.effects.justify.mirror + obj.layer = flip_layer(obj.layer) @property def single_sided(self): @@ -878,7 +880,8 @@ class Footprint: pad.at.rotation = (pad.at.rotation - math.degrees(angle)) % 360 for prop in self.properties: - prop.at.rotation = (prop.at.rotation - math.degrees(angle)) % 360 + if prop.at is not None: + prop.at.rotation = (prop.at.rotation - math.degrees(angle)) % 360 for text in self.texts: text.at.rotation = (text.at.rotation - math.degrees(angle)) % 360 @@ -892,7 +895,8 @@ class Footprint: pad.at.rotation = (pad.at.rotation + delta) % 360 for prop in self.properties: - prop.at.rotation = (prop.at.rotation + delta) % 360 + if prop.at is not None: + prop.at.rotation = (prop.at.rotation + delta) % 360 for text in self.texts: text.at.rotation = (text.at.rotation + delta) % 360 diff --git a/gerbonara/cad/kicad/pcb.py b/gerbonara/cad/kicad/pcb.py index 90845e6..013baa5 100644 --- a/gerbonara/cad/kicad/pcb.py +++ b/gerbonara/cad/kicad/pcb.py @@ -66,7 +66,7 @@ class GeneralSection: class LayerSettings: index: int = 0 canonical_name: str = None - layer_type: AtomChoice(Atom.jumper, Atom.mixed, Atom.power, Atom.signal, Atom.user) = Atom.signal + layer_type: AtomChoice(Atom.jumper, Atom.mixed, Atom.power, Atom.signal, Atom.user, Atom.auxiliary) = Atom.signal custom_name: str = None @@ -341,6 +341,7 @@ class Board: # Other stuff zones: List(Zone) = field(default_factory=list) groups: List(Group) = field(default_factory=list) + embedded_fonts: Named(YesNoAtom()) = False _ : SEXP_END = None original_filename: str = None |