@@ -66,20 +66,21 @@ def _radian(ux, uy, vx, vy):
66
66
rad = - rad
67
67
return rad
68
68
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 ):
70
70
_x1 = float (el .attrib ['x1' ])
71
71
_x2 = float (el .attrib ['x2' ])
72
72
_y1 = - float (el .attrib ['y1' ])
73
73
_y2 = - float (el .attrib ['y2' ])
74
74
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 )
77
77
78
78
x1 , y1 = x + dx1 , - y + dy1
79
79
x2 , y2 = x + dx2 , - y + dy2
80
80
81
81
chord = math .sqrt ((x2 - x1 ) ** 2 + (y2 - y1 ) ** 2 )
82
82
theta = float (el .attrib ['curve' ])
83
+ theta = - theta if mirrored else theta
83
84
r = abs (0.5 * chord / math .sin (math .radians (theta ) / 2 ))
84
85
la = 0 if abs (theta ) < 180 else 1
85
86
sw = 0 if theta > 0 else 1
@@ -93,8 +94,8 @@ def _curve_to_svgparams(self, el, x=0, y=0, angle=0):
93
94
'y2' : y2
94
95
}
95
96
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 )
98
99
return 'M {x1} {y1} A {r} {r} 0 {la} {sw} {x2} {y2}' .format (** p )
99
100
100
101
@staticmethod
@@ -514,7 +515,8 @@ def _process_footprint(self, package, x, y, angle, mirrored, populate):
514
515
dwg = {
515
516
'type' : 'arc' ,
516
517
'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 )
518
520
}
519
521
else :
520
522
dwg = {
@@ -614,7 +616,7 @@ def _name_to_silk(self, name, x, y, elr, tr, align, size, ratio):
614
616
}
615
617
justify = [alignments [ss ] for ss in j [::- 1 ]]
616
618
if (90 < angle <= 270 and not spin ) or \
617
- (- 90 >= angle >= - 270 and not spin ):
619
+ (- 90 > angle >= - 270 and not spin ):
618
620
angle += 180
619
621
justify = [- j for j in justify ]
620
622
0 commit comments