[PCB2Blender Tools][KiCad 7] Adapted to KiCad v7 API

This commit is contained in:
Salvador E. Tropea 2023-02-14 14:11:41 -03:00
parent 6b5782c3ab
commit 629c42d4b1
2 changed files with 6 additions and 2 deletions

View File

@ -506,6 +506,10 @@ class GS(object):
return pcbnew.wxRect(pcbnew.wxPoint(pos.x, pos.y), pcbnew.wxSize(bound.GetWidth(), bound.GetHeight()))
return bound.getWxRect()
@staticmethod
def get_pad_orientation_in_radians(pad):
return pad.GetOrientation().AsRadians() if GS.ki7 else pad.GetOrientationRadians()
# @staticmethod
# def create_wxpoint(x, y):
# return pcbnew.wxPoint(x, y)

View File

@ -100,7 +100,7 @@ class PCB2Blender_ToolsOptions(VariantOptions):
os.makedirs(dir_name, exist_ok=True)
fname = os.path.join(dir_name, self.board_bounds_file)
# PCB bounding box using the PCB edge, converted to mm
bounds = tuple(map(GS.to_mm, GS.board.ComputeBoundingBox(aBoardEdgesOnly=True).getWxRect()))
bounds = tuple(map(GS.to_mm, GS.get_rect_for(GS.board.ComputeBoundingBox(aBoardEdgesOnly=True))))
# Apply 1 mm margin (x, y, w, h)
bounds = (bounds[0]-1, bounds[1]-1, bounds[2]+2, bounds[3]+2)
with open(fname, 'wb') as f:
@ -141,7 +141,7 @@ class PCB2Blender_ToolsOptions(VariantOptions):
pad.GetAttribute(),
pad.GetShape(),
*map(GS.to_mm, pad.GetSize()),
pad.GetOrientationRadians(),
GS.get_pad_orientation_in_radians(pad),
pad.GetRoundRectRadiusRatio(),
pad.GetDrillShape(),
*map(GS.to_mm, pad.GetDrillSize())))