mirror of
https://github.com/atomic14/kicad-coil-plugins.git
synced 2024-10-18 09:06:57 +00:00
Updated plugin for KiCad 7
KiCad 7 seems to have changed some calls and broke the old implementation. These changes work for me on Ubuntu 20.04
This commit is contained in:
parent
216a77b6a4
commit
6d5f2ac702
1 changed files with 16 additions and 16 deletions
|
@ -16,8 +16,8 @@ def create_tracks(board, group, net, layer, thickness, coords):
|
|||
y = coord["y"] + CENTER_Y
|
||||
track = pcbnew.PCB_TRACK(board)
|
||||
if last_x is not None:
|
||||
track.SetStart(pcbnew.wxPointMM(float(last_x), float(last_y)))
|
||||
track.SetEnd(pcbnew.wxPointMM(float(x), float(y)))
|
||||
track.SetStart(pcbnew.VECTOR2I_MM(float(last_x), float(last_y)))
|
||||
track.SetEnd(pcbnew.VECTOR2I_MM(float(x), float(y)))
|
||||
track.SetWidth(int(thickness * 1e6))
|
||||
track.SetLayer(layer)
|
||||
if net is not None:
|
||||
|
@ -89,7 +89,7 @@ class CoilPlugin(pcbnew.ActionPlugin):
|
|||
net = self.findNet(board, via)
|
||||
pcb_via = pcbnew.PCB_VIA(board)
|
||||
pcb_via.SetPosition(
|
||||
pcbnew.wxPointMM(via["x"] + CENTER_X, via["y"] + CENTER_Y)
|
||||
pcbnew.VECTOR2I_MM(via["x"] + CENTER_X, via["y"] + CENTER_Y)
|
||||
)
|
||||
pcb_via.SetWidth(int(via_diameter * 1e6))
|
||||
pcb_via.SetDrill(int(via_drill_diameter * 1e6))
|
||||
|
@ -102,7 +102,7 @@ class CoilPlugin(pcbnew.ActionPlugin):
|
|||
# x = pin["x"] + CENTER_X
|
||||
# y = pin["y"] + CENTER_Y
|
||||
# module = pcbnew.FOOTPRINT(board)
|
||||
# module.SetPosition(pcbnew.wxPointMM(x, y))
|
||||
# module.SetPosition(pcbnew.VECTOR2I_MM(x, y))
|
||||
# board.Add(module)
|
||||
# pcb_pad = pcbnew.PAD(module)
|
||||
# pcb_pad.SetSize(pcbnew.wxSizeMM(pin_diameter, pin_diameter))
|
||||
|
@ -110,7 +110,7 @@ class CoilPlugin(pcbnew.ActionPlugin):
|
|||
# pcb_pad.SetAttribute(pcbnew.PAD_ATTRIB_PTH)
|
||||
# pcb_pad.SetLayerSet(pcb_pad.PTHMask())
|
||||
# pcb_pad.SetDrillSize(pcbnew.wxSizeMM(pin_drill, pin_drill))
|
||||
# pcb_pad.SetPosition(pcbnew.wxPointMM(x, y))
|
||||
# pcb_pad.SetPosition(pcbnew.VECTOR2I_MM(x, y))
|
||||
# pcb_pad.SetNetCode(net.GetNetCode())
|
||||
# module.Add(pcb_pad)
|
||||
|
||||
|
@ -122,7 +122,7 @@ class CoilPlugin(pcbnew.ActionPlugin):
|
|||
x = pin["x"] + CENTER_X
|
||||
y = pin["y"] + CENTER_Y
|
||||
module = pcbnew.FOOTPRINT(board)
|
||||
module.SetPosition(pcbnew.wxPointMM(x, y))
|
||||
module.SetPosition(pcbnew.VECTOR2I_MM(x, y))
|
||||
board.Add(module)
|
||||
pcb_pad = pcbnew.PAD(module)
|
||||
pcb_pad.SetSize(pcbnew.wxSizeMM(pin["width"], pin["height"]))
|
||||
|
@ -130,9 +130,9 @@ class CoilPlugin(pcbnew.ActionPlugin):
|
|||
pcb_pad.SetAttribute(pcbnew.PAD_ATTRIB_SMD)
|
||||
pcb_pad.SetLayerSet(pcb_pad.SMDMask())
|
||||
# pcb_pad.SetLayerSet(lset)
|
||||
pcb_pad.SetPosition(pcbnew.wxPointMM(x, y))
|
||||
pcb_pad.SetPosition(pcbnew.VECTOR2I_MM(x, y))
|
||||
pcb_pad.SetNetCode(net.GetNetCode())
|
||||
pcb_pad.Flip(pcbnew.wxPointMM(x, y), False)
|
||||
pcb_pad.Flip(pcbnew.VECTOR2I_MM(x, y), False)
|
||||
module.Add(pcb_pad)
|
||||
|
||||
# create any silk screen
|
||||
|
@ -141,9 +141,9 @@ class CoilPlugin(pcbnew.ActionPlugin):
|
|||
y = text["y"] + CENTER_Y
|
||||
pcb_txt = pcbnew.PCB_TEXT(board)
|
||||
pcb_txt.SetText(text["text"])
|
||||
pcb_txt.SetPosition(pcbnew.wxPointMM(x, y))
|
||||
pcb_txt.SetPosition(pcbnew.VECTOR2I_MM(x, y))
|
||||
pcb_txt.SetHorizJustify(pcbnew.GR_TEXT_HJUSTIFY_CENTER)
|
||||
pcb_txt.Rotate(pcbnew.wxPointMM(x, y), text["angle"])
|
||||
pcb_txt.Rotate(pcbnew.VECTOR2I_MM(x, y), text["angle"])
|
||||
pcb_txt.SetTextSize(
|
||||
pcbnew.wxSize(
|
||||
text["size"] * pcbnew.IU_PER_MM,
|
||||
|
@ -152,7 +152,7 @@ class CoilPlugin(pcbnew.ActionPlugin):
|
|||
)
|
||||
pcb_txt.SetLayer(pcbnew.F_SilkS)
|
||||
if text["layer"] == "b":
|
||||
pcb_txt.Flip(pcbnew.wxPointMM(x, y), True)
|
||||
pcb_txt.Flip(pcbnew.VECTOR2I_MM(x, y), True)
|
||||
board.Add(pcb_txt)
|
||||
pcb_group.AddItem(pcb_txt)
|
||||
|
||||
|
@ -161,7 +161,7 @@ class CoilPlugin(pcbnew.ActionPlugin):
|
|||
# x = hole["x"] + CENTER_X
|
||||
# y = hole["y"] + CENTER_Y
|
||||
# module = pcbnew.FOOTPRINT(board)
|
||||
# module.SetPosition(pcbnew.wxPointMM(x, y))
|
||||
# module.SetPosition(pcbnew.VECTOR2I_MM(x, y))
|
||||
# board.Add(module)
|
||||
# pcb_pad = pcbnew.PAD(module)
|
||||
# pcb_pad.SetSize(pcbnew.wxSizeMM(hole["diameter"], hole["diameter"]))
|
||||
|
@ -171,7 +171,7 @@ class CoilPlugin(pcbnew.ActionPlugin):
|
|||
# pcb_pad.SetDrillSize(
|
||||
# pcbnew.wxSizeMM(hole["diameter"], hole["diameter"])
|
||||
# )
|
||||
# pcb_pad.SetPosition(pcbnew.wxPointMM(x, y))
|
||||
# pcb_pad.SetPosition(pcbnew.VECTOR2I_MM(x, y))
|
||||
# module.Add(pcb_pad)
|
||||
# pcb_group.AddItem(pcb_hole)
|
||||
|
||||
|
@ -186,7 +186,7 @@ class CoilPlugin(pcbnew.ActionPlugin):
|
|||
for point in edge_cut:
|
||||
x = point["x"] + CENTER_X
|
||||
y = point["y"] + CENTER_Y
|
||||
v.append(pcbnew.wxPointMM(x, y))
|
||||
v.append(pcbnew.VECTOR2I_MM(x, y))
|
||||
ec.SetPolyPoints(v)
|
||||
board.Add(ec)
|
||||
|
||||
|
@ -201,7 +201,7 @@ class CoilPlugin(pcbnew.ActionPlugin):
|
|||
for point in edge_cut:
|
||||
x = point["x"] + CENTER_X
|
||||
y = point["y"] + CENTER_Y
|
||||
v.append(pcbnew.wxPointMM(x, y))
|
||||
v.append(pcbnew.VECTOR2I_MM(x, y))
|
||||
ec.SetPolyPoints(v)
|
||||
board.Add(ec)
|
||||
|
||||
|
@ -215,7 +215,7 @@ class CoilPlugin(pcbnew.ActionPlugin):
|
|||
for point in edge_cut:
|
||||
x = point["x"] + CENTER_X
|
||||
y = point["y"] + CENTER_Y
|
||||
v.append(pcbnew.wxPointMM(x, y))
|
||||
v.append(pcbnew.VECTOR2I_MM(x, y))
|
||||
ec.SetPolyPoints(v)
|
||||
board.Add(ec)
|
||||
|
||||
|
|
Loading…
Reference in a new issue