diff options
-rw-r--r-- | gerbonara/cad/kicad/base_types.py | 2 | ||||
-rw-r--r-- | gerbonara/cad/kicad/primitives.py | 2 | ||||
-rw-r--r-- | gerbonara/cad/kicad/schematic.py | 3 | ||||
-rw-r--r-- | gerbonara/cad/kicad/symbols.py | 6 |
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 |