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",
|
||||
"# CONNECTION_PINS_RADIUS = 16.5\n",
|
||||
"\n",
|
||||
"USE_SPIRAL = False"
|
||||
"USE_SPIRAL = False\n",
|
||||
"\n",
|
||||
"LAYERS = 2"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -448,23 +450,32 @@
|
|||
"metadata": {},
|
||||
"outputs": [],
|
||||
"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",
|
||||
"json_result = dump_json(\n",
|
||||
" \"coils_12.json\",\n",
|
||||
" STATOR_RADIUS,\n",
|
||||
" STATOR_HOLE_RADIUS,\n",
|
||||
" TRACK_WIDTH,\n",
|
||||
" PIN_DIAM,\n",
|
||||
" PIN_DRILL,\n",
|
||||
" VIA_DIAM,\n",
|
||||
" VIA_DRILL,\n",
|
||||
" vias,\n",
|
||||
" pins,\n",
|
||||
" pads,\n",
|
||||
" silk,\n",
|
||||
" tracks_f,\n",
|
||||
" tracks_b,\n",
|
||||
" mounting_holes,\n",
|
||||
" filename=\"coils_12.json\",\n",
|
||||
" stator_radius=STATOR_RADIUS,\n",
|
||||
" stator_hole_radius=STATOR_HOLE_RADIUS,\n",
|
||||
" track_width=TRACK_WIDTH,\n",
|
||||
" pin_diam=PIN_DIAM,\n",
|
||||
" pin_drill=PIN_DRILL,\n",
|
||||
" via_diam=VIA_DIAM,\n",
|
||||
" via_drill=VIA_DRILL,\n",
|
||||
" vias=vias,\n",
|
||||
" pins=pins,\n",
|
||||
" pads=pads,\n",
|
||||
" silk=silk,\n",
|
||||
" tracks_f=tracks_f,\n",
|
||||
" tracks_in1=tracks_in1,\n",
|
||||
" tracks_in2=tracks_in2,\n",
|
||||
" tracks_b=tracks_b,\n",
|
||||
" mounting_holes=mounting_holes,\n",
|
||||
")"
|
||||
]
|
||||
},
|
||||
|
@ -499,7 +510,7 @@
|
|||
},
|
||||
"vscode": {
|
||||
"interpreter": {
|
||||
"hash": "fc384f9db26c31784edfba3761ba3d2c7b2f9b8a63e03a9eb0778fc35334efe1"
|
||||
"hash": "1ce20143987840b9786ebb5907032c9c3a8efacbb887dbb0ebc4934f2ad26cb3"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -79,7 +79,9 @@
|
|||
"# where to place the pins\n",
|
||||
"CONNECTION_PINS_RADIUS = 16.5\n",
|
||||
"\n",
|
||||
"USE_SPIRAL = False"
|
||||
"USE_SPIRAL = False\n",
|
||||
"\n",
|
||||
"LAYERS = 4"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -493,23 +495,32 @@
|
|||
"metadata": {},
|
||||
"outputs": [],
|
||||
"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",
|
||||
"json_result = dump_json(\n",
|
||||
" \"coils_6.json\",\n",
|
||||
" STATOR_RADIUS,\n",
|
||||
" STATOR_HOLE_RADIUS,\n",
|
||||
" TRACK_WIDTH,\n",
|
||||
" PIN_DIAM,\n",
|
||||
" PIN_DRILL,\n",
|
||||
" VIA_DIAM,\n",
|
||||
" VIA_DRILL,\n",
|
||||
" vias,\n",
|
||||
" pins,\n",
|
||||
" pads,\n",
|
||||
" silk,\n",
|
||||
" tracks_f,\n",
|
||||
" tracks_b,\n",
|
||||
" mounting_holes,\n",
|
||||
" filename=\"coils_6.json\",\n",
|
||||
" stator_radius=STATOR_RADIUS,\n",
|
||||
" stator_hole_radius=STATOR_HOLE_RADIUS,\n",
|
||||
" track_width=TRACK_WIDTH,\n",
|
||||
" pin_diam=PIN_DIAM,\n",
|
||||
" pin_drill=PIN_DRILL,\n",
|
||||
" via_diam=VIA_DIAM,\n",
|
||||
" via_drill=VIA_DRILL,\n",
|
||||
" vias=vias,\n",
|
||||
" pins=pins,\n",
|
||||
" pads=pads,\n",
|
||||
" silk=silk,\n",
|
||||
" tracks_f=tracks_f,\n",
|
||||
" tracks_in1=tracks_in1,\n",
|
||||
" tracks_in2=tracks_in2,\n",
|
||||
" tracks_b=tracks_b,\n",
|
||||
" mounting_holes=mounting_holes,\n",
|
||||
")"
|
||||
]
|
||||
},
|
||||
|
@ -544,7 +555,7 @@
|
|||
},
|
||||
"vscode": {
|
||||
"interpreter": {
|
||||
"hash": "fc384f9db26c31784edfba3761ba3d2c7b2f9b8a63e03a9eb0778fc35334efe1"
|
||||
"hash": "1ce20143987840b9786ebb5907032c9c3a8efacbb887dbb0ebc4934f2ad26cb3"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -57,15 +57,15 @@ class CoilPlugin(pcbnew.ActionPlugin):
|
|||
# put everything in a group to make it easier to manage
|
||||
pcb_group = pcbnew.PCB_GROUP(board)
|
||||
# board.Add(pcb_group)
|
||||
# find the matching net for the track
|
||||
net = board.FindNet("coils")
|
||||
if net is None:
|
||||
net = pcbnew.NETINFO_ITEM(board, "coils")
|
||||
board.Add(net)
|
||||
# raise "Net not found: {}".format(track["net"])
|
||||
|
||||
# create tracks
|
||||
for track in coil_data["tracks"]["f"]:
|
||||
# find the matching net for the track
|
||||
net = board.FindNet("coils")
|
||||
if net is None:
|
||||
net = pcbnew.NETINFO_ITEM(board, "coils")
|
||||
board.Add(net)
|
||||
# raise "Net not found: {}".format(track["net"])
|
||||
create_tracks(
|
||||
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
|
||||
)
|
||||
|
||||
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
|
||||
for via in coil_data["vias"]:
|
||||
pcb_via = pcbnew.PCB_VIA(board)
|
||||
|
|
|
@ -67,6 +67,8 @@ def dump_json(
|
|||
pads,
|
||||
silk,
|
||||
tracks_f,
|
||||
tracks_in1,
|
||||
tracks_in2,
|
||||
tracks_b,
|
||||
mounting_holes,
|
||||
):
|
||||
|
@ -87,6 +89,8 @@ def dump_json(
|
|||
"silk": silk,
|
||||
"tracks": {
|
||||
"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],
|
||||
},
|
||||
"mountingHoles": mounting_holes,
|
||||
|
|
Loading…
Reference in a new issue