[PCB2Blender Tools][KiCad 7] Adapted to KiCad v7 API
This commit is contained in:
parent
6b5782c3ab
commit
629c42d4b1
|
|
@ -506,6 +506,10 @@ class GS(object):
|
||||||
return pcbnew.wxRect(pcbnew.wxPoint(pos.x, pos.y), pcbnew.wxSize(bound.GetWidth(), bound.GetHeight()))
|
return pcbnew.wxRect(pcbnew.wxPoint(pos.x, pos.y), pcbnew.wxSize(bound.GetWidth(), bound.GetHeight()))
|
||||||
return bound.getWxRect()
|
return bound.getWxRect()
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def get_pad_orientation_in_radians(pad):
|
||||||
|
return pad.GetOrientation().AsRadians() if GS.ki7 else pad.GetOrientationRadians()
|
||||||
|
|
||||||
# @staticmethod
|
# @staticmethod
|
||||||
# def create_wxpoint(x, y):
|
# def create_wxpoint(x, y):
|
||||||
# return pcbnew.wxPoint(x, y)
|
# return pcbnew.wxPoint(x, y)
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,7 @@ class PCB2Blender_ToolsOptions(VariantOptions):
|
||||||
os.makedirs(dir_name, exist_ok=True)
|
os.makedirs(dir_name, exist_ok=True)
|
||||||
fname = os.path.join(dir_name, self.board_bounds_file)
|
fname = os.path.join(dir_name, self.board_bounds_file)
|
||||||
# PCB bounding box using the PCB edge, converted to mm
|
# 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)
|
# Apply 1 mm margin (x, y, w, h)
|
||||||
bounds = (bounds[0]-1, bounds[1]-1, bounds[2]+2, bounds[3]+2)
|
bounds = (bounds[0]-1, bounds[1]-1, bounds[2]+2, bounds[3]+2)
|
||||||
with open(fname, 'wb') as f:
|
with open(fname, 'wb') as f:
|
||||||
|
|
@ -141,7 +141,7 @@ class PCB2Blender_ToolsOptions(VariantOptions):
|
||||||
pad.GetAttribute(),
|
pad.GetAttribute(),
|
||||||
pad.GetShape(),
|
pad.GetShape(),
|
||||||
*map(GS.to_mm, pad.GetSize()),
|
*map(GS.to_mm, pad.GetSize()),
|
||||||
pad.GetOrientationRadians(),
|
GS.get_pad_orientation_in_radians(pad),
|
||||||
pad.GetRoundRectRadiusRatio(),
|
pad.GetRoundRectRadiusRatio(),
|
||||||
pad.GetDrillShape(),
|
pad.GetDrillShape(),
|
||||||
*map(GS.to_mm, pad.GetDrillSize())))
|
*map(GS.to_mm, pad.GetDrillSize())))
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue