move much of the board outline functionality to BoardSketch
This commit is contained in:
parent
db3a25dbd2
commit
03fc42579f
1 changed files with 19 additions and 14 deletions
|
@ -15,18 +15,35 @@ class BoardSketchObject(BaseObject):
|
|||
TYPE = 'KiConnect::BoardSketch'
|
||||
|
||||
def __init__(self, feature, kicad_board, board_polygon):
|
||||
self.board_polygon = board_polygon
|
||||
super(BoardSketchObject, self).__init__(feature)
|
||||
|
||||
#feature.Visibility = False
|
||||
|
||||
def execute(self, feature):
|
||||
feature.recompute()
|
||||
|
||||
def point_to_vector(self, point, offset=True):
|
||||
return (
|
||||
App.Vector(point.x,
|
||||
-point.y
|
||||
)) / 1000000.0 - (self.feature.BoardOffset.Base if offset else 0)
|
||||
|
||||
def setup_properties(self, feature):
|
||||
super(BoardSketchObject, self).setup_properties(feature)
|
||||
|
||||
feature.addProperty('App::PropertyPlacement', 'BoardOffset', 'KiConnect', 'Internal offset for zeroing out Footprint offset', hidden=True, read_only=True)
|
||||
feature.addProperty('App::PropertyVectorList', 'Vectors', 'KiConnect', 'Internal offset for zeroing out Footprint offset', hidden=True)
|
||||
|
||||
def sync_from(self):
|
||||
feature = self.feature
|
||||
vectors = []
|
||||
|
||||
for node in board_polygon.polygons[0].outline:
|
||||
for node in self.board_polygon.polygons[0].outline:
|
||||
vectors.append(self.point_to_vector(node.point))
|
||||
|
||||
self.feature.Vectors = vectors
|
||||
|
||||
def execute(self, feature):
|
||||
begin = None
|
||||
start = None
|
||||
|
||||
|
@ -48,18 +65,6 @@ class BoardSketchObject(BaseObject):
|
|||
|
||||
feature.recompute()
|
||||
|
||||
def point_to_vector(self, point, offset=True):
|
||||
return (
|
||||
App.Vector(point.x,
|
||||
-point.y
|
||||
)) / 1000000.0 - (self.feature.BoardOffset.Base if offset else 0)
|
||||
|
||||
def setup_properties(self, feature):
|
||||
super(BoardSketchObject, self).setup_properties(feature)
|
||||
|
||||
feature.addProperty('App::PropertyPlacement', 'BoardOffset', 'KiConnect', 'Internal offset for zeroing out Footprint offset', hidden=True, read_only=True)
|
||||
feature.addProperty('App::PropertyVectorList', 'Vectors', 'KiConnect', 'Internal offset for zeroing out Footprint offset', hidden=True)
|
||||
|
||||
def __getstate__(self):
|
||||
return None
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue