diff options
author | jaseg <git@jaseg.de> | 2023-07-21 14:38:09 +0200 |
---|---|---|
committer | jaseg <git@jaseg.de> | 2023-07-21 14:38:09 +0200 |
commit | 21ca5f7f5c2e5425f9a142961bf86b39af825bf7 (patch) | |
tree | c4a02c5487a52b5fef5f7faec4e3f514f7e2eae4 /gerbonara/cad/kicad/schematic.py | |
parent | a39af853c833c524a43b8a953cce60e07bb14dfb (diff) | |
download | gerbonara-21ca5f7f5c2e5425f9a142961bf86b39af825bf7.tar.gz gerbonara-21ca5f7f5c2e5425f9a142961bf86b39af825bf7.tar.bz2 gerbonara-21ca5f7f5c2e5425f9a142961bf86b39af825bf7.zip |
WIP
Diffstat (limited to 'gerbonara/cad/kicad/schematic.py')
-rw-r--r-- | gerbonara/cad/kicad/schematic.py | 48 |
1 files changed, 47 insertions, 1 deletions
diff --git a/gerbonara/cad/kicad/schematic.py b/gerbonara/cad/kicad/schematic.py index 00272dd..cb945a2 100644 --- a/gerbonara/cad/kicad/schematic.py +++ b/gerbonara/cad/kicad/schematic.py @@ -303,8 +303,25 @@ class DrawnProperty(TextMixin): self.value = value @property + def default_v_align(self): + return 'middle' + + @property + def h_align(self): + return self.effects.justify.h_str + + @property def rotation(self): - return self.parent.rotation + self.at.rotation + rot = -self.at.rotation + rot += getattr(self.parent.at, 'rotation', 0) + if getattr(self.parent, 'reference', None) == 'C13': + print(self.value, self.at, self.parent.at, self.parent.mirror) + if hasattr(self.parent, 'mirror'): + if self.parent.mirror.y and rot in (90, 270): + rot = (rot+180)%360 + if self.parent.mirror.x and rot in (0, 180): + rot = (rot+180)%360 + return rot%360 def to_svg(self, colorscheme=Colorscheme.KiCad): if not self.hide: @@ -337,6 +354,35 @@ class SymbolInstance: self.schematic = parent @property + def reference(self): + return self['Reference'].value + + @reference.setter + def reference(self, value): + self['Reference'].value = value + + @property + def value(self): + return self['Value'].value + + @value.setter + def value(self, value): + self['Value'].value = value + + @property + def footprint(self): + return self['Footprint'].value + + @footprint.setter + def footprint(self, value): + self['Footprint'].value = value + + def __getitem__(self, key): + for prop in self.properties: + if prop.key == key: + return prop + + @property def rotation(self): return self.at.rotation |