Skip to content

Commit c77c74a

Browse files
Funkenjaegerqu1ck
authored andcommitted
(eagle) Fix #429
1 parent 0c7b65a commit c77c74a

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

InteractiveHtmlBom/ecad/fusion_eagle.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,20 +66,21 @@ def _radian(ux, uy, vx, vy):
6666
rad = -rad
6767
return rad
6868

69-
def _curve_to_svgparams(self, el, x=0, y=0, angle=0):
69+
def _curve_to_svgparams(self, el, x=0, y=0, angle=0, mirrored=False):
7070
_x1 = float(el.attrib['x1'])
7171
_x2 = float(el.attrib['x2'])
7272
_y1 = -float(el.attrib['y1'])
7373
_y2 = -float(el.attrib['y2'])
7474

75-
dx1, dy1 = self._rotate(_x1, _y1, -angle)
76-
dx2, dy2 = self._rotate(_x2, _y2, -angle)
75+
dx1, dy1 = self._rotate(_x1, _y1, -angle, mirrored)
76+
dx2, dy2 = self._rotate(_x2, _y2, -angle, mirrored)
7777

7878
x1, y1 = x + dx1, -y + dy1
7979
x2, y2 = x + dx2, -y + dy2
8080

8181
chord = math.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2)
8282
theta = float(el.attrib['curve'])
83+
theta = -theta if mirrored else theta
8384
r = abs(0.5 * chord / math.sin(math.radians(theta) / 2))
8485
la = 0 if abs(theta) < 180 else 1
8586
sw = 0 if theta > 0 else 1
@@ -93,8 +94,8 @@ def _curve_to_svgparams(self, el, x=0, y=0, angle=0):
9394
'y2': y2
9495
}
9596

96-
def _curve_to_svgpath(self, el, x=0, y=0, angle=0):
97-
p = self._curve_to_svgparams(el, x, y, angle)
97+
def _curve_to_svgpath(self, el, x=0, y=0, angle=0, mirrored=False):
98+
p = self._curve_to_svgparams(el, x, y, angle, mirrored)
9899
return 'M {x1} {y1} A {r} {r} 0 {la} {sw} {x2} {y2}'.format(**p)
99100

100101
@staticmethod
@@ -514,7 +515,8 @@ def _process_footprint(self, package, x, y, angle, mirrored, populate):
514515
dwg = {
515516
'type': 'arc',
516517
'width': float(el.attrib['width']),
517-
'svgpath': self._curve_to_svgpath(el, x, y, angle)
518+
'svgpath': self._curve_to_svgpath(el, x, y, angle,
519+
mirrored)
518520
}
519521
else:
520522
dwg = {
@@ -614,7 +616,7 @@ def _name_to_silk(self, name, x, y, elr, tr, align, size, ratio):
614616
}
615617
justify = [alignments[ss] for ss in j[::-1]]
616618
if (90 < angle <= 270 and not spin) or \
617-
(-90 >= angle >= -270 and not spin):
619+
(-90 > angle >= -270 and not spin):
618620
angle += 180
619621
justify = [-j for j in justify]
620622

0 commit comments

Comments
 (0)