more migration to BoardSketch
This commit is contained in:
parent
a162b98000
commit
0a95b5529e
1 changed files with 6 additions and 11 deletions
|
@ -19,6 +19,7 @@ class BoardObject(BaseObject):
|
|||
def __init__(self, feature, kicad_board, board_polygon):
|
||||
self.feature = feature
|
||||
self.kicad_board = kicad_board
|
||||
self.board_sketch = None
|
||||
# TODO add this to FreeCAD Preferences and Property?
|
||||
self.do_offset = True
|
||||
# TODO needs to be resotred in onDocumentRestored
|
||||
|
@ -72,6 +73,9 @@ class BoardObject(BaseObject):
|
|||
|
||||
return self.board_sketch
|
||||
|
||||
def get_polygon(self, kiid):
|
||||
return [ s for s in self.kicad_board.get_shapes() if s.id.value == kiid ][0]
|
||||
|
||||
def get_boardpoly(self):
|
||||
# TODO remove in favor of extract_polygons class method
|
||||
board = self.kicad_board
|
||||
|
@ -128,17 +132,8 @@ class BoardObject(BaseObject):
|
|||
Pulls outline from KiCAD PolygonBoard and saves points as Vectors
|
||||
'''
|
||||
|
||||
# bit of a quick hack to keep the board in one place, needs more testing
|
||||
if self.do_offset and not self.feature.BoardOffset:
|
||||
bb = self.board_polygon.bounding_box()
|
||||
self.feature.BoardOffset.Base = (App.Vector(bb.pos.x, -bb.pos.y) + App.Vector(bb.size.x, -bb.size.y) / 2) / 1000000.0
|
||||
|
||||
vectors = []
|
||||
|
||||
for node in self.board_polygon.polygons[0].outline:
|
||||
vectors.append(self.point_to_vector(node.point))
|
||||
|
||||
self.feature.Vectors = vectors
|
||||
if self.board_sketch:
|
||||
self.board_sketch.Proxy.sync_from()
|
||||
|
||||
def sync_to(self):
|
||||
board = self.kicad_board
|
||||
|
|
Loading…
Add table
Reference in a new issue