remove overly complicated substrate/sketch getters
Update getting sketch by BoardSketch name
This commit is contained in:
parent
934aaaf354
commit
8e9d8d7a38
1 changed files with 7 additions and 14 deletions
|
@ -18,10 +18,11 @@ class BoardObject(BaseObject):
|
||||||
|
|
||||||
def __init__(self, feature, kicad_board, board_polygon):
|
def __init__(self, feature, kicad_board, board_polygon):
|
||||||
self.feature = feature
|
self.feature = feature
|
||||||
self.kicad_board = kicad_board
|
self.substrate_body = None
|
||||||
self.board_sketch = None
|
self.board_sketch = None
|
||||||
# TODO add this to FreeCAD Preferences and Property?
|
|
||||||
self.do_offset = True
|
self.kicad_board = kicad_board
|
||||||
|
|
||||||
# TODO needs to be resotred in onDocumentRestored
|
# TODO needs to be resotred in onDocumentRestored
|
||||||
#self.board_polygon = board_polygon
|
#self.board_polygon = board_polygon
|
||||||
self.polygon_id = board_polygon.id.value
|
self.polygon_id = board_polygon.id.value
|
||||||
|
@ -32,6 +33,7 @@ class BoardObject(BaseObject):
|
||||||
|
|
||||||
self.feature.PolygonId = board_polygon.id.value
|
self.feature.PolygonId = board_polygon.id.value
|
||||||
|
|
||||||
|
self.substrate_body = self.create_substrate_body()
|
||||||
self.board_sketch = BoardSketch.makeBoardSketch(self.substrate_body, kicad_board, board_polygon)
|
self.board_sketch = BoardSketch.makeBoardSketch(self.substrate_body, kicad_board, board_polygon)
|
||||||
self.create_substrate_pad()
|
self.create_substrate_pad()
|
||||||
|
|
||||||
|
@ -42,17 +44,8 @@ class BoardObject(BaseObject):
|
||||||
def onDocumentRestored(self, feature):
|
def onDocumentRestored(self, feature):
|
||||||
super(BoardObject, self).onDocumentRestored(feature)
|
super(BoardObject, self).onDocumentRestored(feature)
|
||||||
|
|
||||||
self.board_sketch = self.feature.getObject('BoardSketch')
|
|
||||||
self.kicad_board = self.get_api().kicad.get_board()
|
self.kicad_board = self.get_api().kicad.get_board()
|
||||||
|
self.board_sketch = self.feature.getObject('Substrate').getObject('BoardSketch')
|
||||||
@property
|
|
||||||
def substrate_body(self):
|
|
||||||
body = self.feature.getObject('Substrate')
|
|
||||||
|
|
||||||
if not body:
|
|
||||||
body = self.create_substrate_body()
|
|
||||||
|
|
||||||
return body
|
|
||||||
|
|
||||||
def create_substrate_body(self):
|
def create_substrate_body(self):
|
||||||
substrate_body = App.ActiveDocument.addObject('PartDesign::Body', 'Substrate')
|
substrate_body = App.ActiveDocument.addObject('PartDesign::Body', 'Substrate')
|
||||||
|
@ -148,7 +141,7 @@ class BoardObject(BaseObject):
|
||||||
poly = boardpoly.polygons[0]
|
poly = boardpoly.polygons[0]
|
||||||
poly.outline.clear()
|
poly.outline.clear()
|
||||||
|
|
||||||
geom = self.feature.getObject('Substrate').getObject('Sketch').Geometry
|
geom = self.feature.getObject('Substrate').getObject('BoardSketch').Geometry
|
||||||
segments = [l for l in geom if isinstance(l, Part.LineSegment)]
|
segments = [l for l in geom if isinstance(l, Part.LineSegment)]
|
||||||
|
|
||||||
for line in segments:
|
for line in segments:
|
||||||
|
|
Loading…
Add table
Reference in a new issue