mirror of
https://github.com/atomic14/kicad-coil-plugins.git
synced 2024-10-18 09:06:57 +00:00
support for 4 layers
This commit is contained in:
parent
e0080a35e5
commit
7c7df2add0
4 changed files with 77 additions and 40 deletions
|
@ -79,7 +79,9 @@
|
||||||
"# where to place the pins\n",
|
"# where to place the pins\n",
|
||||||
"# CONNECTION_PINS_RADIUS = 16.5\n",
|
"# CONNECTION_PINS_RADIUS = 16.5\n",
|
||||||
"\n",
|
"\n",
|
||||||
"USE_SPIRAL = False"
|
"USE_SPIRAL = False\n",
|
||||||
|
"\n",
|
||||||
|
"LAYERS = 2"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -448,23 +450,32 @@
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
|
"# if we are doing four layers then duplicate the front and back layers on (front and inner1), (inner2 and back)\n",
|
||||||
|
"tracks_in1 = []\n",
|
||||||
|
"tracks_in2 = []\n",
|
||||||
|
"if LAYERS == 4:\n",
|
||||||
|
" tracks_in1 = tracks_b\n",
|
||||||
|
" tracks_in2 = tracks_f\n",
|
||||||
|
"\n",
|
||||||
"# dump out the json version\n",
|
"# dump out the json version\n",
|
||||||
"json_result = dump_json(\n",
|
"json_result = dump_json(\n",
|
||||||
" \"coils_12.json\",\n",
|
" filename=\"coils_12.json\",\n",
|
||||||
" STATOR_RADIUS,\n",
|
" stator_radius=STATOR_RADIUS,\n",
|
||||||
" STATOR_HOLE_RADIUS,\n",
|
" stator_hole_radius=STATOR_HOLE_RADIUS,\n",
|
||||||
" TRACK_WIDTH,\n",
|
" track_width=TRACK_WIDTH,\n",
|
||||||
" PIN_DIAM,\n",
|
" pin_diam=PIN_DIAM,\n",
|
||||||
" PIN_DRILL,\n",
|
" pin_drill=PIN_DRILL,\n",
|
||||||
" VIA_DIAM,\n",
|
" via_diam=VIA_DIAM,\n",
|
||||||
" VIA_DRILL,\n",
|
" via_drill=VIA_DRILL,\n",
|
||||||
" vias,\n",
|
" vias=vias,\n",
|
||||||
" pins,\n",
|
" pins=pins,\n",
|
||||||
" pads,\n",
|
" pads=pads,\n",
|
||||||
" silk,\n",
|
" silk=silk,\n",
|
||||||
" tracks_f,\n",
|
" tracks_f=tracks_f,\n",
|
||||||
" tracks_b,\n",
|
" tracks_in1=tracks_in1,\n",
|
||||||
" mounting_holes,\n",
|
" tracks_in2=tracks_in2,\n",
|
||||||
|
" tracks_b=tracks_b,\n",
|
||||||
|
" mounting_holes=mounting_holes,\n",
|
||||||
")"
|
")"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -499,7 +510,7 @@
|
||||||
},
|
},
|
||||||
"vscode": {
|
"vscode": {
|
||||||
"interpreter": {
|
"interpreter": {
|
||||||
"hash": "fc384f9db26c31784edfba3761ba3d2c7b2f9b8a63e03a9eb0778fc35334efe1"
|
"hash": "1ce20143987840b9786ebb5907032c9c3a8efacbb887dbb0ebc4934f2ad26cb3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -79,7 +79,9 @@
|
||||||
"# where to place the pins\n",
|
"# where to place the pins\n",
|
||||||
"CONNECTION_PINS_RADIUS = 16.5\n",
|
"CONNECTION_PINS_RADIUS = 16.5\n",
|
||||||
"\n",
|
"\n",
|
||||||
"USE_SPIRAL = False"
|
"USE_SPIRAL = False\n",
|
||||||
|
"\n",
|
||||||
|
"LAYERS = 4"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -493,23 +495,32 @@
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
|
"# if we are doing four layers then duplicate the front and back layers on (front and inner1), (inner2 and back)\n",
|
||||||
|
"tracks_in1 = []\n",
|
||||||
|
"tracks_in2 = []\n",
|
||||||
|
"if LAYERS == 4:\n",
|
||||||
|
" tracks_in1 = tracks_b\n",
|
||||||
|
" tracks_in2 = tracks_f\n",
|
||||||
|
"\n",
|
||||||
"# dump out the json version\n",
|
"# dump out the json version\n",
|
||||||
"json_result = dump_json(\n",
|
"json_result = dump_json(\n",
|
||||||
" \"coils_6.json\",\n",
|
" filename=\"coils_6.json\",\n",
|
||||||
" STATOR_RADIUS,\n",
|
" stator_radius=STATOR_RADIUS,\n",
|
||||||
" STATOR_HOLE_RADIUS,\n",
|
" stator_hole_radius=STATOR_HOLE_RADIUS,\n",
|
||||||
" TRACK_WIDTH,\n",
|
" track_width=TRACK_WIDTH,\n",
|
||||||
" PIN_DIAM,\n",
|
" pin_diam=PIN_DIAM,\n",
|
||||||
" PIN_DRILL,\n",
|
" pin_drill=PIN_DRILL,\n",
|
||||||
" VIA_DIAM,\n",
|
" via_diam=VIA_DIAM,\n",
|
||||||
" VIA_DRILL,\n",
|
" via_drill=VIA_DRILL,\n",
|
||||||
" vias,\n",
|
" vias=vias,\n",
|
||||||
" pins,\n",
|
" pins=pins,\n",
|
||||||
" pads,\n",
|
" pads=pads,\n",
|
||||||
" silk,\n",
|
" silk=silk,\n",
|
||||||
" tracks_f,\n",
|
" tracks_f=tracks_f,\n",
|
||||||
" tracks_b,\n",
|
" tracks_in1=tracks_in1,\n",
|
||||||
" mounting_holes,\n",
|
" tracks_in2=tracks_in2,\n",
|
||||||
|
" tracks_b=tracks_b,\n",
|
||||||
|
" mounting_holes=mounting_holes,\n",
|
||||||
")"
|
")"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -544,7 +555,7 @@
|
||||||
},
|
},
|
||||||
"vscode": {
|
"vscode": {
|
||||||
"interpreter": {
|
"interpreter": {
|
||||||
"hash": "fc384f9db26c31784edfba3761ba3d2c7b2f9b8a63e03a9eb0778fc35334efe1"
|
"hash": "1ce20143987840b9786ebb5907032c9c3a8efacbb887dbb0ebc4934f2ad26cb3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -57,15 +57,15 @@ class CoilPlugin(pcbnew.ActionPlugin):
|
||||||
# put everything in a group to make it easier to manage
|
# put everything in a group to make it easier to manage
|
||||||
pcb_group = pcbnew.PCB_GROUP(board)
|
pcb_group = pcbnew.PCB_GROUP(board)
|
||||||
# board.Add(pcb_group)
|
# board.Add(pcb_group)
|
||||||
|
|
||||||
# create tracks
|
|
||||||
for track in coil_data["tracks"]["f"]:
|
|
||||||
# find the matching net for the track
|
# find the matching net for the track
|
||||||
net = board.FindNet("coils")
|
net = board.FindNet("coils")
|
||||||
if net is None:
|
if net is None:
|
||||||
net = pcbnew.NETINFO_ITEM(board, "coils")
|
net = pcbnew.NETINFO_ITEM(board, "coils")
|
||||||
board.Add(net)
|
board.Add(net)
|
||||||
# raise "Net not found: {}".format(track["net"])
|
# raise "Net not found: {}".format(track["net"])
|
||||||
|
|
||||||
|
# create tracks
|
||||||
|
for track in coil_data["tracks"]["f"]:
|
||||||
create_tracks(
|
create_tracks(
|
||||||
board, pcb_group, net, pcbnew.F_Cu, track_width, track
|
board, pcb_group, net, pcbnew.F_Cu, track_width, track
|
||||||
)
|
)
|
||||||
|
@ -75,6 +75,17 @@ class CoilPlugin(pcbnew.ActionPlugin):
|
||||||
board, pcb_group, net, pcbnew.B_Cu, track_width, track
|
board, pcb_group, net, pcbnew.B_Cu, track_width, track
|
||||||
)
|
)
|
||||||
|
|
||||||
|
for track in coil_data["tracks"]["in1"]:
|
||||||
|
create_tracks(
|
||||||
|
board, pcb_group, net, pcbnew.In1_Cu, track_width, track
|
||||||
|
)
|
||||||
|
|
||||||
|
for track in coil_data["tracks"]["in2"]:
|
||||||
|
create_tracks(
|
||||||
|
board, pcb_group, net, pcbnew.In2_Cu, track_width, track
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
# create the vias
|
# create the vias
|
||||||
for via in coil_data["vias"]:
|
for via in coil_data["vias"]:
|
||||||
pcb_via = pcbnew.PCB_VIA(board)
|
pcb_via = pcbnew.PCB_VIA(board)
|
||||||
|
|
|
@ -67,6 +67,8 @@ def dump_json(
|
||||||
pads,
|
pads,
|
||||||
silk,
|
silk,
|
||||||
tracks_f,
|
tracks_f,
|
||||||
|
tracks_in1,
|
||||||
|
tracks_in2,
|
||||||
tracks_b,
|
tracks_b,
|
||||||
mounting_holes,
|
mounting_holes,
|
||||||
):
|
):
|
||||||
|
@ -87,6 +89,8 @@ def dump_json(
|
||||||
"silk": silk,
|
"silk": silk,
|
||||||
"tracks": {
|
"tracks": {
|
||||||
"f": [create_track_json(points) for points in tracks_f],
|
"f": [create_track_json(points) for points in tracks_f],
|
||||||
|
"in1": [create_track_json(points) for points in tracks_in1],
|
||||||
|
"in2": [create_track_json(points) for points in tracks_in2],
|
||||||
"b": [create_track_json(points) for points in tracks_b],
|
"b": [create_track_json(points) for points in tracks_b],
|
||||||
},
|
},
|
||||||
"mountingHoles": mounting_holes,
|
"mountingHoles": mounting_holes,
|
||||||
|
|
Loading…
Reference in a new issue