From 070494a1c3bf682a457dd0ec3092d360825ec84c Mon Sep 17 00:00:00 2001 From: jaseg Date: Mon, 12 Jun 2023 19:43:13 +0200 Subject: stroke WIP --- gerbonara/cad/kicad/graphical_primitives.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'gerbonara/cad/kicad/graphical_primitives.py') diff --git a/gerbonara/cad/kicad/graphical_primitives.py b/gerbonara/cad/kicad/graphical_primitives.py index f078268..8e2d325 100644 --- a/gerbonara/cad/kicad/graphical_primitives.py +++ b/gerbonara/cad/kicad/graphical_primitives.py @@ -115,12 +115,13 @@ class Line: if self.angle: raise NotImplementedError('Angles on lines are not implemented. Please raise an issue and provide an example file.') - if self.width: - aperture = ap.CircleAperture(self.width, unit=MM) - else: - aperture = ap.CircleAperture(self.stroke.width, unit=MM) + dasher = Dasher(self) + dasher.move(self.start.x, self.start.y) + dasher.line(self.end.x, self.end.y) - yield go.Line(self.start.x, self.start.y, self.end.x, self.end.y, aperture=aperture, unit=MM) + for x1, y1, x2, y2 in dasher: + yield go.Line(x1, y1, x2, y2, aperture=ap.CircleAperture(dasher.width, unit=MM), unit=MM) + # FIXME render all primitives using dasher, maybe share code w/ fp_ prefix primitives @sexp_type('fill') @@ -204,13 +205,14 @@ class Polygon: pts: PointList = field(default_factory=PointList) layer: Named(str) = None width: Named(float) = None + stroke: Stroke = field(default_factory=Stroke) fill: FillMode = True tstamp: Timestamp = None def render(self, variables=None): reg = go.Region([(pt.x, pt.y) for pt in self.pts.xy], unit=MM) - if self.width and self.width >= 0.005: + if self.width and self.width >= 0.005 or self.stroke.width and self.stroke.width > 0.005: yield from reg.outline_objects(aperture=ap.CircleAperture(self.width, unit=MM)) if self.fill: -- cgit