summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjaseg <git@jaseg.de>2024-05-28 18:07:09 +0200
committerjaseg <git@jaseg.de>2024-05-28 18:07:09 +0200
commit04c4b3ff0c81d13b8aba01ddb79ac3f14d59baa6 (patch)
tree47a1b376637d72006938a0969d4c8d52b612ebea
parent227d4ed1cd9ccc124851343e52fbf015845b52fe (diff)
downloadgerbonara-04c4b3ff0c81d13b8aba01ddb79ac3f14d59baa6.tar.gz
gerbonara-04c4b3ff0c81d13b8aba01ddb79ac3f14d59baa6.tar.bz2
gerbonara-04c4b3ff0c81d13b8aba01ddb79ac3f14d59baa6.zip
kicad_sch render: Fix nightly import and wire rendering
-rw-r--r--gerbonara/cad/kicad/base_types.py2
-rw-r--r--gerbonara/cad/kicad/primitives.py2
-rw-r--r--gerbonara/cad/kicad/schematic.py3
-rw-r--r--gerbonara/cad/kicad/symbols.py6
4 files changed, 7 insertions, 6 deletions
diff --git a/gerbonara/cad/kicad/base_types.py b/gerbonara/cad/kicad/base_types.py
index 1161996..59a727d 100644
--- a/gerbonara/cad/kicad/base_types.py
+++ b/gerbonara/cad/kicad/base_types.py
@@ -97,7 +97,7 @@ class Stroke:
class Dasher:
def __init__(self, obj):
if obj.stroke:
- w = obj.stroke.width if obj.stroke.width is not None else 0.254
+ w = obj.stroke.width if obj.stroke.width not in (None, 0, 0.0) else 0.254
t = obj.stroke.type
else:
w = obj.width or 0
diff --git a/gerbonara/cad/kicad/primitives.py b/gerbonara/cad/kicad/primitives.py
index fa55568..65e83ac 100644
--- a/gerbonara/cad/kicad/primitives.py
+++ b/gerbonara/cad/kicad/primitives.py
@@ -81,7 +81,7 @@ def kicad_mid_to_center_arc(mid, start, end):
cy = ((p1[0] - p2[0]) * cd - (p2[0] - p3[0]) * bc) / det
radius = math.sqrt((cx - p1[0])**2 + (cy - p1[1])**2)
- return ((cx, cy), radius)
+ return (cx, cy), radius
@sexp_type('hatch')
diff --git a/gerbonara/cad/kicad/schematic.py b/gerbonara/cad/kicad/schematic.py
index 45a022e..0a2f4de 100644
--- a/gerbonara/cad/kicad/schematic.py
+++ b/gerbonara/cad/kicad/schematic.py
@@ -260,6 +260,7 @@ class HierarchicalLabel(TextMixin):
class Pin:
name: str = '1'
uuid: UUID = field(default_factory=UUID)
+ alternate: Named(str) = None
# Suddenly, we're doing syntax like this is yaml or something.
@@ -354,7 +355,7 @@ class SymbolInstance:
pins: List(Pin) = field(default_factory=list)
# AFAICT this property, too, is completely redundant. It ultimately just lists paths and references of at most
# three other uses of the same symbol in this schematic.
- instances: Named(List(SymbolCrosslinkProject)) = field(default_factory=list)
+ instances: Named(Array(SymbolCrosslinkProject)) = field(default_factory=list)
_ : SEXP_END = None
schematic: object = None
diff --git a/gerbonara/cad/kicad/symbols.py b/gerbonara/cad/kicad/symbols.py
index ed93f7b..3c6fab2 100644
--- a/gerbonara/cad/kicad/symbols.py
+++ b/gerbonara/cad/kicad/symbols.py
@@ -20,7 +20,7 @@ from .base_types import *
from ...utils import rotate_point, Tag, arc_bounds
from ...newstroke import Newstroke
from .schematic_colors import *
-from .primitives import center_arc_to_kicad_mid
+from .primitives import kicad_mid_to_center_arc
PIN_ETYPE = AtomChoice(Atom.input, Atom.output, Atom.bidirectional, Atom.tri_state, Atom.passive, Atom.free,
@@ -259,7 +259,7 @@ class Arc:
fill: Fill = field(default_factory=Fill)
def bounding_box(self, default=None):
- (cx, cy), r = center_arc_to_kicad_mid(self.mid, self.start, self.end)
+ (cx, cy), r = kicad_mid_to_center_arc(self.mid, self.start, self.end)
x1, y1 = self.start.x, self.start.y
x2, y2 = self.mid.x-x1, self.mid.y-x2
x3, y3 = (self.end.x - x1)/2, (self.end.y - y1)/2
@@ -268,7 +268,7 @@ class Arc:
def to_svg(self, colorscheme=Colorscheme.KiCad):
- (cx, cy), r = center_arc_to_kicad_mid(self.mid, self.start, self.end)
+ (cx, cy), r = kicad_mid_to_center_arc(self.mid, self.start, self.end)
x1r = self.start.x - cx
y1r = self.start.y - cy