helper method to find the Board Feature of a Sketch
This commit is contained in:
parent
03fc42579f
commit
796206f116
1 changed files with 5 additions and 3 deletions
|
@ -72,7 +72,7 @@ class BoardObject(BaseObject):
|
||||||
|
|
||||||
return self.board_sketch
|
return self.board_sketch
|
||||||
|
|
||||||
def get_boardpoly(self):
|
def get_boardpoly(self, polygon_id=None):
|
||||||
# TODO remove in favor of extract_polygons class method
|
# TODO remove in favor of extract_polygons class method
|
||||||
board = self.kicad_board
|
board = self.kicad_board
|
||||||
|
|
||||||
|
@ -80,8 +80,10 @@ class BoardObject(BaseObject):
|
||||||
edge_cuts = [ edge for edge in board.get_shapes() if edge.layer == BoardLayer.BL_Edge_Cuts ]
|
edge_cuts = [ edge for edge in board.get_shapes() if edge.layer == BoardLayer.BL_Edge_Cuts ]
|
||||||
polygons = [ edge for edge in edge_cuts if isinstance(edge, BoardPolygon) ]
|
polygons = [ edge for edge in edge_cuts if isinstance(edge, BoardPolygon) ]
|
||||||
|
|
||||||
# XXX only single board supported at the moment
|
if polygon_id:
|
||||||
return polygons[0]
|
return [ p for p in polygons if p.id.value == polygon_id ][0]
|
||||||
|
else:
|
||||||
|
return polygons
|
||||||
|
|
||||||
def pocket_vias(self):
|
def pocket_vias(self):
|
||||||
board = self.kicad_board
|
board = self.kicad_board
|
||||||
|
|
Loading…
Add table
Reference in a new issue