Fix drawing circles

This commit is contained in:
Chris Greening 2022-10-09 23:27:22 +01:00
parent 6eff5bcc3a
commit 811bb423cc
2 changed files with 25 additions and 24 deletions

View file

@ -478,8 +478,8 @@
")\n", ")\n",
"\n", "\n",
"# wires for connecting to opposite coils\n", "# wires for connecting to opposite coils\n",
"connection_radius1 = STATOR_HOLE_RADIUS + (TRACK_SPACING)\n", "connection_radius1 = STATOR_HOLE_RADIUS + (2 * TRACK_SPACING)\n",
"connection_radius2 = connection_radius1 + (TRACK_SPACING + VIA_DIAM / 2)\n", "connection_radius2 = connection_radius1 + (2 * TRACK_SPACING + VIA_DIAM / 2)\n",
"\n", "\n",
"# draw a 45 degree line from each coil at connection radius 1\n", "# draw a 45 degree line from each coil at connection radius 1\n",
"# then connect up to connection radius 2\n", "# then connect up to connection radius 2\n",

View file

@ -51,28 +51,6 @@ class CoilPlugin(pcbnew.ActionPlugin):
pcb_group = pcbnew.PCB_GROUP(board) pcb_group = pcbnew.PCB_GROUP(board)
# board.Add(pcb_group) # board.Add(pcb_group)
# create the center hole
arc = pcbnew.PCB_SHAPE(board)
arc.SetShape(pcbnew.SHAPE_T_ARC)
arc.SetStart(pcbnew.wxPointMM(stator_hole_radius, 0))
arc.SetCenter(pcbnew.wxPointMM(0, 0))
arc.SetArcAngleAndEnd(0, False)
arc.SetLayer(pcbnew.Edge_Cuts)
arc.SetWidth(int(0.1 * pcbnew.IU_PER_MM))
board.Add(arc)
# pcb_group.AddItem(arc)
# create the stator outline
arc = pcbnew.PCB_SHAPE(board)
arc.SetShape(pcbnew.SHAPE_T_ARC)
arc.SetStart(pcbnew.wxPointMM(stator_radius, 0))
arc.SetCenter(pcbnew.wxPointMM(0, 0))
arc.SetArcAngleAndEnd(0, False)
arc.SetLayer(pcbnew.Edge_Cuts)
arc.SetWidth(int(0.1 * pcbnew.IU_PER_MM))
board.Add(arc)
# pcb_group.AddItem(arc)
# create tracks # create tracks
for track in coil_data["tracks"]["f"]: for track in coil_data["tracks"]["f"]:
# find the matching net for the track # find the matching net for the track
@ -128,5 +106,28 @@ class CoilPlugin(pcbnew.ActionPlugin):
# pcb_group.AddItem(pcb_txt) # pcb_group.AddItem(pcb_txt)
# create the stator outline
arc = pcbnew.PCB_SHAPE(board)
arc.SetShape(pcbnew.SHAPE_T_CIRCLE)
arc.SetFilled(False)
arc.SetStart(pcbnew.wxPointMM(0, 0))
arc.SetEnd(pcbnew.wxPointMM(stator_radius, 0))
arc.SetCenter(pcbnew.wxPointMM(0, 0))
arc.SetLayer(pcbnew.Edge_Cuts)
arc.SetWidth(int(0.1 * pcbnew.IU_PER_MM))
board.Add(arc)
# pcb_group.AddItem(arc)
# create the center hole
arc = pcbnew.PCB_SHAPE(board)
arc.SetShape(pcbnew.SHAPE_T_CIRCLE)
arc.SetFilled(False)
arc.SetStart(pcbnew.wxPointMM(0, 0))
arc.SetEnd(pcbnew.wxPointMM(stator_hole_radius, 0))
arc.SetCenter(pcbnew.wxPointMM(0, 0))
arc.SetLayer(pcbnew.Edge_Cuts)
arc.SetWidth(int(0.1 * pcbnew.IU_PER_MM))
board.Add(arc)
# pcb_group.AddItem(arc)
CoilPlugin().register() # Instantiate and register to Pcbnew]) CoilPlugin().register() # Instantiate and register to Pcbnew])