@@ -69,6 +69,18 @@ def extra_data_file_filter(self):
6969 def normalize (point ):
7070 return [point [0 ] * 1e-6 , point [1 ] * 1e-6 ]
7171
72+ @staticmethod
73+ def get_arc_angles (d ):
74+ # type: (pcbnew.PCB_SHAPE) -> tuple
75+ a1 = d .GetArcAngleStart ()
76+ if hasattr (d , "GetAngle" ):
77+ a2 = a1 + d .GetAngle ()
78+ else :
79+ a2 = a1 + d .GetArcAngle ()
80+ if a2 < a1 :
81+ a1 , a2 = a2 , a1
82+ return round (a1 * 0.1 , 2 ), round (a2 * 0.1 , 2 )
83+
7284 def parse_shape (self , d ):
7385 # type: (pcbnew.PCB_SHAPE) -> dict or None
7486 shape = {
@@ -115,10 +127,9 @@ def parse_shape(self, d):
115127 shape_dict ["filled" ] = 1
116128 return shape_dict
117129 if shape == "arc" :
118- a1 = round (d .GetArcAngleStart () * 0.1 , 2 )
119- a2 = round ((d .GetArcAngleStart () + d .GetAngle ()) * 0.1 , 2 )
120- if d .GetAngle () < 0 :
121- (a1 , a2 ) = (a2 , a1 )
130+ a1 , a2 = self .get_arc_angles (d )
131+ if hasattr (d , "GetCenter" ):
132+ start = self .normalize (d .GetCenter ())
122133 return {
123134 "type" : shape ,
124135 "start" : start ,
@@ -471,11 +482,7 @@ def parse_tracks(self, tracks):
471482 else :
472483 if track .GetLayer () in [pcbnew .F_Cu , pcbnew .B_Cu ]:
473484 if track .GetClass () in ["ARC" , "PCB_ARC" ]:
474- a1 = round (track .GetArcAngleStart () * 0.1 , 2 )
475- a2 = round ((track .GetArcAngleStart () +
476- track .GetAngle ()) * 0.1 , 2 )
477- if track .GetAngle () < 0 :
478- (a1 , a2 ) = (a2 , a1 )
485+ a1 , a2 = self .get_arc_angles (track )
479486 track_dict = {
480487 "center" : self .normalize (track .GetCenter ()),
481488 "startangle" : a1 ,
0 commit comments