#NEWLINE# def _parse_edges( self , board ) : #NEWLINE# #INDENT# for graphic in sexp . find_all ( board , 'gr_line' , 'gr_arc' , 'gr_circle' ) : #NEWLINE# #INDENT# layer = sexp . find ( graphic , 'layer' ) [ 1 ] #NEWLINE# if ( layer != 'Edge.Cuts' ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# if ( graphic [ 0 ] == 'gr_line' ) : #NEWLINE# #INDENT# start = [ float ( x ) for x in sexp . find ( graphic , 'start' ) [ 1 : ] ] #NEWLINE# end = [ float ( x ) for x in sexp . find ( graphic , 'end' ) [ 1 : ] ] #NEWLINE# self . edge_lines . append ( ( start , end ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( graphic [ 0 ] == 'gr_arc' ) : #NEWLINE# #INDENT# center = [ float ( x ) for x in sexp . find ( graphic , 'start' ) [ 1 : ] ] #NEWLINE# start = [ float ( x ) for x in sexp . find ( layer , 'end' ) [ 1 : ] ] #NEWLINE# r = math . sqrt ( ( ( ( center [ 0 ] - start [ 0 ] ) ** 2 ) + ( ( center [ 1 ] - start [ 1 ] ) ** 2 ) ) ) #NEWLINE# angle = ( ( float ( sexp . find ( graphic , 'angle' ) [ 1 ] ) * math . pi ) / 180.0 ) #NEWLINE# dx = ( start [ 0 ] - center [ 0 ] ) #NEWLINE# dy = ( start [ 1 ] - center [ 1 ] ) #NEWLINE# start_angle = math . atan2 ( dy , dx ) #NEWLINE# end_angle = ( start_angle + angle ) #NEWLINE# self . edge_arcs . append ( ( center [ 0 ] , center [ 1 ] , r , start_angle , end_angle ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( graphic [ 0 ] == 'gr_circle' ) : #NEWLINE# #INDENT# center = [ float ( x ) for x in sexp . find ( graphic , 'center' ) [ 1 : ] ] #NEWLINE# end = [ float ( x ) for x in sexp . find ( graphic , 'end' ) [ 1 : ] ] #NEWLINE# r = math . sqrt ( ( ( ( center [ 0 ] - end [ 0 ] ) ** 2 ) + ( ( center [ 1 ] - end [ 1 ] ) ** 2 ) ) ) #NEWLINE# self . edge_arcs . append ( ( center [ 0 ] , center [ 1 ] , r , 0 , ( 2 * math . pi ) ) )