always add vias at all coil_interconnection points to connect inner layers in parallel

This commit is contained in:
heartwerker 2024-02-13 23:39:50 +01:00
parent 2551eaa5a2
commit 872c43269e
3 changed files with 80 additions and 29 deletions

View file

@ -435,9 +435,7 @@
" + draw_arc(angleAt(c1), angleAt(c2), radius)\n",
" + [coils_bot[c2][-1]] )}) \n",
" \n",
"def connect_coils_with_arc(c1, c2 , tracks_ref, radius, radius_points, \n",
" append_coils = True, \n",
" append_vias = False):\n",
"def connect_coils_with_arc(c1, c2 , tracks_ref, radius, radius_points):\n",
" pts = draw_arc(angleAt(c1), angleAt(c2), radius)\n",
"\n",
" if radius_points != 0:\n",
@ -447,11 +445,10 @@
" \"net\": nameAt(c1),\n",
" \"pts\": pts}) \n",
" \n",
" if append_coils != 0:\n",
" appendAt(coils_top, c1, radius)\n",
" appendAt(coils_top, c2, radius)\n",
"\n",
" if append_vias:\n",
" # append vias everywhere to connect middle layers properly in parallel.\n",
" appendVia(c1, radius)\n",
" appendVia(c2, radius)\n",
"\n",
@ -471,7 +468,7 @@
" for c in range(1, 12, 3):\n",
" point = pointAt(c, radius_coni_B)\n",
" coils_bot[c].append(point)\n",
" # vias.append(create_via(point, nameAt(c)))\n",
" vias.append(create_via(point, nameAt(c)))\n",
" for con in range(2):\n",
" connect_coils_auto_arc(con*6+1, con*6+4, tracks_bot, radius_coni_B)\n",
" \n",
@ -489,24 +486,19 @@
" # connects the middle/star point\n",
" r = RADIUS_CONNECTIONS_OUTSIDE\n",
" r_inc = - 5 * TRACK_SPACING \n",
" connect_coils_with_arc(9, 11, tracks_top, r, 0, \n",
" append_coils=True, \n",
" append_vias=False)\n",
"\n",
" connect_coils_with_arc(9, 11, tracks_top, r, 0)\n",
" appendAt(coils_top, 10, r)\n",
" appendVia(10, r)\n",
"\n",
" r += r_inc\n",
" connect_coils_with_arc(3, 6, tracks_top, r, 0,\n",
" append_coils=True, \n",
" append_vias=False)\n",
" connect_coils_with_arc(3, 6, tracks_top, r, 0)\n",
"\n",
" r += r_inc\n",
" connect_coils_with_arc(4, 7, tracks_bot, r, 0,\n",
" append_coils=True, \n",
" append_vias=True)\n",
" connect_coils_with_arc(4, 7, tracks_bot, r, 0)\n",
"\n",
" r += r_inc\n",
" connect_coils_with_arc(5, 8, tracks_bot, r, 0,\n",
" append_coils=True, \n",
" append_vias=True)\n",
" connect_coils_with_arc(5, 8, tracks_bot, r, 0,)\n",
"\n",
"# create the pads for connecting the inputs to the coils\n",
"if PAD_ENABLE:\n",

View file

@ -273,6 +273,9 @@
" )\n",
"print(\"Total length front\", total_length_front)\n",
"\n",
"\n",
"points_b = points_f\n",
"\n",
"total_length_back = 0\n",
"for i in range(len(points_b) - 1):\n",
" total_length_back += np.linalg.norm(\n",
@ -323,7 +326,7 @@
"\n",
" tracks_f.append(coil_A_f)\n",
" tracks_b.append(coil_A_b)\n",
" vias.append(create_via(get_arc_point(angle, COIL_VIA_RADIUS)), COIL_NET_NAME)\n",
" vias.append(create_via(get_arc_point(angle, COIL_VIA_RADIUS), COIL_NET_NAME))\n",
" silk.append(\n",
" create_silk(get_arc_point(angle, COIL_CENTER_RADIUS), coil_labels[i % 3], COIL_NET_NAME)\n",
" )\n",
@ -379,10 +382,10 @@
"coils_b[8].append(coil_C3_C4_inner[0])\n",
"coils_b[11].append(coil_C3_C4_inner[-1])\n",
"# add the vias to stitch them together\n",
"vias.append(create_via(coil_C1_C2_inner[0]), COIL_NET_NAME)\n",
"vias.append(create_via(coil_C1_C2_inner[-1]), COIL_NET_NAME)\n",
"vias.append(create_via(coil_C3_C4_inner[0]), COIL_NET_NAME)\n",
"vias.append(create_via(coil_C3_C4_inner[-1]), COIL_NET_NAME)\n",
"vias.append(create_via(coil_C1_C2_inner[0], COIL_NET_NAME))\n",
"vias.append(create_via(coil_C1_C2_inner[-1], COIL_NET_NAME))\n",
"vias.append(create_via(coil_C3_C4_inner[0], COIL_NET_NAME))\n",
"vias.append(create_via(coil_C3_C4_inner[-1], COIL_NET_NAME))\n",
"\n",
"# connect the last three coils together\n",
"common_connection_radius = SCREW_HOLE_RADIUS - (SCREW_HOLE_DRILL_DIAM / 2 + 0.5)\n",
@ -455,7 +458,7 @@
"vias.append(create_via(get_arc_point(coil_angles[0], pad_connection_point_x)), COIL_NET_NAME)\n",
"# connect coil B to the middle pad\n",
"coils_f[1].append((pad_connection_point_x + PAD_WIDTH / 2 + VIA_DIAM / 2, 0), COIL_NET_NAME)\n",
"vias.append(create_via(((pad_connection_point_x + PAD_WIDTH / 2 + VIA_DIAM / 2, 0))))\n",
"vias.append(create_via(((pad_connection_point_x + PAD_WIDTH / 2 + VIA_DIAM / 2, 0))), COIL_NET_NAME)\n",
"# connect coil C to the bottom pad\n",
"coils_f[2].append(get_arc_point(coil_angles[2], pad_connection_point_x))\n",
"vias.append(create_via(get_arc_point(coil_angles[2], pad_connection_point_x)), COIL_NET_NAME)"
@ -569,7 +572,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.0 (main, Oct 24 2022, 18:26:48) [MSC v.1933 64 bit (AMD64)]"
"version": "3.11.6"
},
"vscode": {
"interpreter": {

56
errorslogging.md Normal file
View file

@ -0,0 +1,56 @@
Traceback (most recent call last):
File "/Users/dspeith/Documents/KiCad/7.0/scripting/plugins/coil_plugin.py", line 146, in Run
# pcb_txt.Rotate(pcbnew.VECTOR2I_MM(x, y), text["angle"])
File "/Applications/KiCad/KiCad.app/Contents/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pcbnew.py", line 9262, in Rotate
return _pcbnew.BOARD_ITEM_Rotate(self, aRotCentre, aAngle)
TypeError: in method 'BOARD_ITEM_Rotate', argument 3 of type 'EDA_ANGLE const &'
--------
Traceback (most recent call last):
File "/Users/dspeith/Documents/KiCad/7.0/scripting/plugins/coil_plugin.py", line 146, in Run
pcb_txt.Rotate(pcbnew.VECTOR2I_MM(x, y), text["angle"])
File "/Applications/KiCad/KiCad.app/Contents/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pcbnew.py", line 9262, in Rotate
return _pcbnew.BOARD_ITEM_Rotate(self, aRotCentre, aAngle)
TypeError: in method 'BOARD_ITEM_Rotate', argument 3 of type 'EDA_ANGLE const &'
Traceback (most recent call last):
File "/Users/dspeith/Documents/KiCad/7.0/scripting/plugins/coil_plugin.py", line 149, in Run
text["size"] * pcbnew.IU_PER_MM,
AttributeError: module 'pcbnew' has no attribute 'IU_PER_MM'
Traceback (most recent call last):
File "/Users/dspeith/Documents/KiCad/7.0/scripting/plugins/coil_plugin.py", line 149, in Run
text["size"] * pcbnew.EDA_IU_SCALE.IU_PER_MM,
AttributeError: module 'pcbnew' has no attribute 'IU_PER_MM'
Traceback (most recent call last):
File "/Users/dspeith/Documents/KiCad/7.0/scripting/plugins/coil_plugin.py", line 147, in Run
pcb_txt.SetTextSize(
File "/Applications/KiCad/KiCad.app/Contents/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pcbnew.py", line 2772, in SetTextSize
return _pcbnew.EDA_TEXT_SetTextSize(self, aNewSize)
TypeError: in method 'EDA_TEXT_SetTextSize', argument 2 of type 'VECTOR2I const &'