From 629c42d4b16de2519be2ed2748bd7055a06dcdff Mon Sep 17 00:00:00 2001 From: "Salvador E. Tropea" Date: Tue, 14 Feb 2023 14:11:41 -0300 Subject: [PATCH] [PCB2Blender Tools][KiCad 7] Adapted to KiCad v7 API --- kibot/gs.py | 4 ++++ kibot/out_pcb2blender_tools.py | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/kibot/gs.py b/kibot/gs.py index acfbdd0d..85981620 100644 --- a/kibot/gs.py +++ b/kibot/gs.py @@ -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) diff --git a/kibot/out_pcb2blender_tools.py b/kibot/out_pcb2blender_tools.py index 9e6feb33..50f598a7 100644 --- a/kibot/out_pcb2blender_tools.py +++ b/kibot/out_pcb2blender_tools.py @@ -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())))