summaryrefslogtreecommitdiff
path: root/gerbonara/cad/kicad/graphical_primitives.py
diff options
context:
space:
mode:
authorjaseg <git@jaseg.de>2023-09-19 12:44:22 +0200
committerjaseg <git@jaseg.de>2023-09-19 12:44:22 +0200
commit301601e81df58ea5fc5f32773c45e7a7e6a6f23c (patch)
tree41319a8c1a6774e584bc3650184ff53de3b5fcfe /gerbonara/cad/kicad/graphical_primitives.py
parent3e47e7c2dabc78650e228e5336da10d27bdf8dad (diff)
downloadgerbonara-301601e81df58ea5fc5f32773c45e7a7e6a6f23c.tar.gz
gerbonara-301601e81df58ea5fc5f32773c45e7a7e6a6f23c.tar.bz2
gerbonara-301601e81df58ea5fc5f32773c45e7a7e6a6f23c.zip
Multilayer coil WIP
Diffstat (limited to 'gerbonara/cad/kicad/graphical_primitives.py')
-rw-r--r--gerbonara/cad/kicad/graphical_primitives.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/gerbonara/cad/kicad/graphical_primitives.py b/gerbonara/cad/kicad/graphical_primitives.py
index f1d13e6..568d1d2 100644
--- a/gerbonara/cad/kicad/graphical_primitives.py
+++ b/gerbonara/cad/kicad/graphical_primitives.py
@@ -78,6 +78,10 @@ class Line:
stroke: Stroke = field(default_factory=Stroke)
tstamp: Timestamp = None
+ def rotate(self, angle, cx=None, cy=None):
+ self.start.x, self.start.y = rotate_point(self.start.x, self.start.y, angle, cx, cy)
+ self.end.x, self.end.y = rotate_point(self.end.x, self.end.y, angle, cx, cy)
+
def render(self, variables=None):
if self.angle:
raise NotImplementedError('Angles on lines are not implemented. Please raise an issue and provide an example file.')
@@ -176,6 +180,19 @@ class Arc:
width: Named(float) = None
stroke: Stroke = field(default_factory=Stroke)
tstamp: Timestamp = None
+ _: SEXP_END = None
+ center: XYCoord = None
+
+ def __post_init__(self):
+ self.start = XYCoord(self.start)
+ self.end = XYCoord(self.end)
+ self.mid = XYCoord(self.mid) if self.mid else center_arc_to_kicad_mid(XYCoord(self.center), self.start, self.end)
+ self.center = None
+
+ def rotate(self, angle, cx=None, cy=None):
+ self.start.x, self.start.y = rotate_point(self.start.x, self.start.y, angle, cx, cy)
+ self.mid.x, self.mid.y = rotate_point(self.mid.x, self.mid.y, angle, cx, cy)
+ self.end.x, self.end.y = rotate_point(self.end.x, self.end.y, angle, cx, cy)
def render(self, variables=None):
# FIXME stroke support