Skip to content

Commit

Permalink
Updated to KiCad 8 (#36)
Browse files Browse the repository at this point in the history
* Updated to KiCad 8

* Updated Kibot config to new format
  • Loading branch information
PatrickBaus authored Jul 30, 2024
1 parent 593d7fc commit c1c68d5
Show file tree
Hide file tree
Showing 7 changed files with 15,621 additions and 6,568 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ jobs:
submodules: true

- name: Run ERC
uses: INTI-CMNB/KiBot@v2_k7
uses: INTI-CMNB/KiBot@v2_k8
with:
config: ${{ env.KIBOT_CONFIG }}
schema: ${{ env.SCHEMATIC_FILE }}
Expand All @@ -116,7 +116,7 @@ jobs:
submodules: true

- name: Run DRC
uses: INTI-CMNB/KiBot@v2_k7
uses: INTI-CMNB/KiBot@v2_k8
with:
config: ${{ env.KIBOT_CONFIG }}
board: ${{ env.PCB_FILE }}
Expand All @@ -143,7 +143,7 @@ jobs:
with:
submodules: true

- uses: INTI-CMNB/KiBot@v2_k7
- uses: INTI-CMNB/KiBot@v2_k8
with:
config: ${{ env.KIBOT_CONFIG }}
schema: ${{ env.SCHEMATIC_FILE }}
Expand Down
40 changes: 20 additions & 20 deletions KiCAD_CopperFillPoly.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
#!/usr/bin/env python
import sys, os
import shutil
import math

LIST_pts = [" (polygon\n (pts\n (xy "," (filled_polygon\n (pts\n (xy ",") (xy ",")\n )\n )"]


ARC = " (gr_arc (start {center[x]:.4f} {center[y]:.4f}) (end {start[x]:.4f} {start[y]:.4f}) (angle {angle:.4f}) (layer Edge.Cuts) (width 0.15))"
import uuid

def draw_slotted_arc(center, inner_radius, outer_radius, slot_angle, angle_offset):
start_angle = math.radians(45 - slot_angle / 2 + angle_offset) # radians
start_angle = math.radians(angle_offset) # radians
angle = math.radians(slot_angle) # radians

start_inner = {'x': inner_radius * math.cos(start_angle) + center['x'], 'y': -1 * inner_radius * math.sin(start_angle) + center['y']}
start_outer = {'x': outer_radius * math.cos(start_angle) + center['x'], 'y': -1 * outer_radius * math.sin(start_angle) + center['y']}
center_endcap1 = {'x': (outer_radius + inner_radius) / 2 * math.cos(start_angle) + center['x'], 'y': -1 * (outer_radius + inner_radius) / 2 * math.sin(start_angle) + center['y']}
center_endcap2 = {'x': (outer_radius + inner_radius) / 2 * math.cos(start_angle + angle) + center['x'], 'y': -1 * (outer_radius + inner_radius) / 2 * math.sin(start_angle + angle) + center['y']}
start_endcap2 = {'x': outer_radius * math.cos(start_angle + angle) + center['x'], 'y': -1 * outer_radius * math.sin(start_angle + angle) + center['y']}

print(ARC.format(center=center, start=start_inner, angle=-1*math.degrees(angle)))
print(ARC.format(center=center, start=start_outer, angle=-1*math.degrees(angle)))
print(ARC.format(center=center_endcap1, start=start_inner, angle=-180))
print(ARC.format(center=center_endcap2, start=start_endcap2, angle=-180))

start = {'x': math.cos(start_angle - angle/2), 'y': -1 * math.sin(start_angle - angle/2)}
mid = {'x': math.cos(start_angle), 'y': -1 * math.sin(start_angle)}
end = {'x': math.cos(start_angle + angle/2), 'y': -1 * math.sin(start_angle + angle/2)}
endcap_angle_offset = 2 * math.asin((outer_radius - inner_radius) / 2 / (outer_radius + inner_radius))
endcap_mid_end = {'x': math.cos(start_angle + angle/2 + endcap_angle_offset), 'y': -1 * math.sin(start_angle + angle/2 + endcap_angle_offset)}
endcap_mid_start = {'x': math.cos(start_angle - angle/2 - endcap_angle_offset), 'y': -1 * math.sin(start_angle - angle/2 - endcap_angle_offset)}

for radius in [inner_radius, outer_radius]:
print(
f'\t(gr_arc\n\t\t(start {start["x"]*radius+center["x"]:.6f} {start["y"]*radius+center["y"]:.6f})\n\t\t(mid {mid["x"]*radius+center["x"]:.6f} {mid["y"]*radius+center["y"]:.6f})\n\t\t(end {end["x"]*radius+center["x"]:.6f} {end["y"]*radius+center["y"]:.6f})\n\t\t(stroke\n\t\t\t(width 0.15)\n\t\t\t(type solid)\n\t\t)\n\t\t(layer Edge.Cuts)\n\t\t(uuid "{uuid.uuid4()}")\n\t)'
)
print(
f'\t(gr_arc\n\t\t(start {end["x"]*outer_radius+center["x"]:.6f} {end["y"]*outer_radius+center["y"]:.6f})\n\t\t(mid {endcap_mid_end["x"]*(inner_radius+outer_radius)/2+center["x"]:.6f} {endcap_mid_end["y"]*(inner_radius+outer_radius)/2+center["y"]:.6f})\n\t\t(end {end["x"]*inner_radius+center["x"]:.6f} {end["y"]*inner_radius+center["y"]:.6f})\n\t\t(stroke\n\t\t\t(width 0.15)\n\t\t\t(type solid)\n\t\t)\n\t\t(layer Edge.Cuts)\n\t\t(uuid "{uuid.uuid4()}")\n\t)'
)
print(
f'\t(gr_arc\n\t\t(start {start["x"]*outer_radius+center["x"]:.6f} {start["y"]*outer_radius+center["y"]:.6f})\n\t\t(mid {endcap_mid_start["x"]*(inner_radius+outer_radius)/2+center["x"]:.6f} {endcap_mid_start["y"]*(inner_radius+outer_radius)/2+center["y"]:.6f})\n\t\t(end {start["x"]*inner_radius+center["x"]:.6f} {start["y"]*inner_radius+center["y"]:.6f})\n\t\t(stroke\n\t\t\t(width 0.15)\n\t\t\t(type solid)\n\t\t)\n\t\t(layer Edge.Cuts)\n\t\t(uuid "{uuid.uuid4()}")\n\t)'
)

if __name__ == '__main__':

Expand All @@ -31,6 +31,6 @@ def draw_slotted_arc(center, inner_radius, outer_radius, slot_angle, angle_offse
outer_radius = 8 # mm
angle = 60 # degrees

for offset in [0, 90, 180, 270]:
for offset in [45, 135, 225, 315]:
draw_slotted_arc(center=center, inner_radius=inner_radius, outer_radius=outer_radius, slot_angle=angle, angle_offset=offset)

Loading

0 comments on commit c1c68d5

Please sign in to comment.