Skip to content

Commit

Permalink
Automatically generate clean svg and dxf files for the cases
Browse files Browse the repository at this point in the history
The other svg files I rendered are nice for preview, but they contain
some hidden text for the dummy footprint and are not very clean to pass
on to a manufacturer.

These contain only the necessary information.
  • Loading branch information
pierrechevalier83 committed Apr 5, 2021
1 parent 9cbc161 commit 16a0177
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 42 deletions.
24 changes: 24 additions & 0 deletions .kiplot.dxf_edge_cuts.yml → .kiplot.edge_cuts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,27 @@ outputs:
layers:
- layer: Edge.Cuts
suffix: Edge_Cuts

- name: SVG
comment: "SVG files"
type: svg
dir: .
options:
exclude_edge_layer: true
exclude_pads_from_silkscreen: true
use_aux_axis_as_origin: false
plot_sheet_reference: false
plot_footprint_refs: false
plot_footprint_values: false
force_plot_invisible_refs_vals: false
tent_vias: false
check_zone_fills: false

# SVG options
line_width: 0.1
drill_marks: full
mirror_plot: false
negative_plot: false
layers:
- layer: Edge.Cuts
suffix: Edge_Cuts
15 changes: 8 additions & 7 deletions automation/configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,20 +303,21 @@ def add_zip_gerber_rule(ninja, variant):
ninja.newline()


def add_dxf_edge_cuts_rule(ninja, reldir, basename):
dxf_edge_cuts_rule = make_rule_name(reldir, f"{basename}_dxf_edge_cuts")
def add_edge_cuts_rule(ninja, reldir, basename):
edge_cuts_rule = make_rule_name(reldir, f"{basename}_edge_cuts")
board = make_pcb_file_name(reldir, basename)
config = ".kiplot.dxf_edge_cuts.yml"
config = ".kiplot.edge_cuts.yml"
out_dir = make_variant_out_dir(reldir)
kiplot = "kiplot"

ninja.rule(
name=dxf_edge_cuts_rule,
name=edge_cuts_rule,
command=[f"mkdir -p {out_dir} && {kiplot} -b {board} -c {config} -d {out_dir}"],
)
ninja.build(
outputs=make_output_file_path(reldir, f"{basename}-Edge_Cuts.dxf"),
rule=dxf_edge_cuts_rule,
outputs=[make_output_file_path(reldir, f"{basename}-Edge_Cuts.dxf"),
make_output_file_path(reldir, f"{basename}-Edge_Cuts.svg")],
rule=edge_cuts_rule,
)
ninja.newline()

Expand All @@ -327,7 +328,7 @@ def add_case_pcb_rules(ninja, variant, case, already_checked):
if not (variant, case_dir, basename) in already_checked:
add_drc_rule(ninja, f"{variant}/cases/{case_dir}", basename)
add_render_front_rule(ninja, f"{variant}/cases/{case_dir}", basename)
add_dxf_edge_cuts_rule(ninja, f"{variant}/cases/{case_dir}", basename)
add_edge_cuts_rule(ninja, f"{variant}/cases/{case_dir}", basename)
already_checked.add((variant, case_dir, basename))


Expand Down
77 changes: 42 additions & 35 deletions build.ninja
Original file line number Diff line number Diff line change
Expand Up @@ -495,12 +495,13 @@ build build/0.2/bling/cases/mid_profile/left_switch_plate_front.svg: $
automation/tools/PcbDraw/pcbdraw/styles/set-white-enig.json $
0.2/bling/cases/mid_profile/left_switch_plate.kicad_pcb

rule 0_2_bling_cases_mid_profile_left_switch_plate_dxf_edge_cuts
rule 0_2_bling_cases_mid_profile_left_switch_plate_edge_cuts
command = mkdir -p build/0.2/bling/cases/mid_profile && kiplot -b $
0.2/bling/cases/mid_profile/left_switch_plate.kicad_pcb -c $
.kiplot.dxf_edge_cuts.yml -d build/0.2/bling/cases/mid_profile
build build/0.2/bling/cases/mid_profile/left_switch_plate-Edge_Cuts.dxf: $
0_2_bling_cases_mid_profile_left_switch_plate_dxf_edge_cuts
.kiplot.edge_cuts.yml -d build/0.2/bling/cases/mid_profile
build build/0.2/bling/cases/mid_profile/left_switch_plate-Edge_Cuts.dxf $
build/0.2/bling/cases/mid_profile/left_switch_plate-Edge_Cuts.svg: $
0_2_bling_cases_mid_profile_left_switch_plate_edge_cuts

rule 0_2_bling_cases_mid_profile_right_switch_plate_drc
command = ./automation/run_drc.sh $
Expand All @@ -522,12 +523,13 @@ build build/0.2/bling/cases/mid_profile/right_switch_plate_front.svg: $
automation/tools/PcbDraw/pcbdraw/styles/set-white-enig.json $
0.2/bling/cases/mid_profile/right_switch_plate.kicad_pcb

rule 0_2_bling_cases_mid_profile_right_switch_plate_dxf_edge_cuts
rule 0_2_bling_cases_mid_profile_right_switch_plate_edge_cuts
command = mkdir -p build/0.2/bling/cases/mid_profile && kiplot -b $
0.2/bling/cases/mid_profile/right_switch_plate.kicad_pcb -c $
.kiplot.dxf_edge_cuts.yml -d build/0.2/bling/cases/mid_profile
build build/0.2/bling/cases/mid_profile/right_switch_plate-Edge_Cuts.dxf: $
0_2_bling_cases_mid_profile_right_switch_plate_dxf_edge_cuts
.kiplot.edge_cuts.yml -d build/0.2/bling/cases/mid_profile
build build/0.2/bling/cases/mid_profile/right_switch_plate-Edge_Cuts.dxf $
build/0.2/bling/cases/mid_profile/right_switch_plate-Edge_Cuts.svg: $
0_2_bling_cases_mid_profile_right_switch_plate_edge_cuts

rule 0_2_bling_cases_mid_profile_lip_drc
command = ./automation/run_drc.sh 0.2/bling/cases/mid_profile/lip.kicad_pcb
Expand All @@ -546,12 +548,13 @@ build build/0.2/bling/cases/mid_profile/lip_front.svg: $
automation/tools/PcbDraw/pcbdraw/styles/set-white-enig.json $
0.2/bling/cases/mid_profile/lip.kicad_pcb

rule 0_2_bling_cases_mid_profile_lip_dxf_edge_cuts
rule 0_2_bling_cases_mid_profile_lip_edge_cuts
command = mkdir -p build/0.2/bling/cases/mid_profile && kiplot -b $
0.2/bling/cases/mid_profile/lip.kicad_pcb -c $
.kiplot.dxf_edge_cuts.yml -d build/0.2/bling/cases/mid_profile
build build/0.2/bling/cases/mid_profile/lip-Edge_Cuts.dxf: $
0_2_bling_cases_mid_profile_lip_dxf_edge_cuts
0.2/bling/cases/mid_profile/lip.kicad_pcb -c .kiplot.edge_cuts.yml -d $
build/0.2/bling/cases/mid_profile
build build/0.2/bling/cases/mid_profile/lip-Edge_Cuts.dxf $
build/0.2/bling/cases/mid_profile/lip-Edge_Cuts.svg: $
0_2_bling_cases_mid_profile_lip_edge_cuts

rule 0_2_bling_cases_mid_profile_bottom_plate_puck_drc
command = ./automation/run_drc.sh $
Expand All @@ -573,12 +576,13 @@ build build/0.2/bling/cases/mid_profile/bottom_plate_puck_front.svg: $
automation/tools/PcbDraw/pcbdraw/styles/set-white-enig.json $
0.2/bling/cases/mid_profile/bottom_plate_puck.kicad_pcb

rule 0_2_bling_cases_mid_profile_bottom_plate_puck_dxf_edge_cuts
rule 0_2_bling_cases_mid_profile_bottom_plate_puck_edge_cuts
command = mkdir -p build/0.2/bling/cases/mid_profile && kiplot -b $
0.2/bling/cases/mid_profile/bottom_plate_puck.kicad_pcb -c $
.kiplot.dxf_edge_cuts.yml -d build/0.2/bling/cases/mid_profile
build build/0.2/bling/cases/mid_profile/bottom_plate_puck-Edge_Cuts.dxf: $
0_2_bling_cases_mid_profile_bottom_plate_puck_dxf_edge_cuts
.kiplot.edge_cuts.yml -d build/0.2/bling/cases/mid_profile
build build/0.2/bling/cases/mid_profile/bottom_plate_puck-Edge_Cuts.dxf $
build/0.2/bling/cases/mid_profile/bottom_plate_puck-Edge_Cuts.svg: $
0_2_bling_cases_mid_profile_bottom_plate_puck_edge_cuts

rule 0_2_bling_cases_mid_profile_bottom_plate_no_puck_drc
command = ./automation/run_drc.sh $
Expand All @@ -600,12 +604,13 @@ build build/0.2/bling/cases/mid_profile/bottom_plate_no_puck_front.svg: $
automation/tools/PcbDraw/pcbdraw/styles/set-white-enig.json $
0.2/bling/cases/mid_profile/bottom_plate_no_puck.kicad_pcb

rule 0_2_bling_cases_mid_profile_bottom_plate_no_puck_dxf_edge_cuts
rule 0_2_bling_cases_mid_profile_bottom_plate_no_puck_edge_cuts
command = mkdir -p build/0.2/bling/cases/mid_profile && kiplot -b $
0.2/bling/cases/mid_profile/bottom_plate_no_puck.kicad_pcb -c $
.kiplot.dxf_edge_cuts.yml -d build/0.2/bling/cases/mid_profile
build build/0.2/bling/cases/mid_profile/bottom_plate_no_puck-Edge_Cuts.dxf: $
0_2_bling_cases_mid_profile_bottom_plate_no_puck_dxf_edge_cuts
.kiplot.edge_cuts.yml -d build/0.2/bling/cases/mid_profile
build build/0.2/bling/cases/mid_profile/bottom_plate_no_puck-Edge_Cuts.dxf $
build/0.2/bling/cases/mid_profile/bottom_plate_no_puck-Edge_Cuts.svg: $
0_2_bling_cases_mid_profile_bottom_plate_no_puck_edge_cuts

build 0.2/bling: phony build/0.2/bling/gerbers.zip $
build/0.2/bling/ferris_front.svg build/0.2/bling/ferris_back.svg $
Expand Down Expand Up @@ -732,12 +737,13 @@ build build/0.2/compact/cases/low_profile/metal_plate_front.svg: $
automation/tools/PcbDraw/pcbdraw/styles/set-white-enig.json $
0.2/compact/cases/low_profile/metal_plate.kicad_pcb

rule 0_2_compact_cases_low_profile_metal_plate_dxf_edge_cuts
rule 0_2_compact_cases_low_profile_metal_plate_edge_cuts
command = mkdir -p build/0.2/compact/cases/low_profile && kiplot -b $
0.2/compact/cases/low_profile/metal_plate.kicad_pcb -c $
.kiplot.dxf_edge_cuts.yml -d build/0.2/compact/cases/low_profile
build build/0.2/compact/cases/low_profile/metal_plate-Edge_Cuts.dxf: $
0_2_compact_cases_low_profile_metal_plate_dxf_edge_cuts
.kiplot.edge_cuts.yml -d build/0.2/compact/cases/low_profile
build build/0.2/compact/cases/low_profile/metal_plate-Edge_Cuts.dxf $
build/0.2/compact/cases/low_profile/metal_plate-Edge_Cuts.svg: $
0_2_compact_cases_low_profile_metal_plate_edge_cuts

rule 0_2_compact_cases_low_profile_cork_spacer_and_lip_drc
command = ./automation/run_drc.sh $
Expand All @@ -759,13 +765,13 @@ build build/0.2/compact/cases/low_profile/cork_spacer_and_lip_front.svg: $
automation/tools/PcbDraw/pcbdraw/styles/set-white-enig.json $
0.2/compact/cases/low_profile/cork_spacer_and_lip.kicad_pcb

rule 0_2_compact_cases_low_profile_cork_spacer_and_lip_dxf_edge_cuts
rule 0_2_compact_cases_low_profile_cork_spacer_and_lip_edge_cuts
command = mkdir -p build/0.2/compact/cases/low_profile && kiplot -b $
0.2/compact/cases/low_profile/cork_spacer_and_lip.kicad_pcb -c $
.kiplot.dxf_edge_cuts.yml -d build/0.2/compact/cases/low_profile
build $
build/0.2/compact/cases/low_profile/cork_spacer_and_lip-Edge_Cuts.dxf: $
0_2_compact_cases_low_profile_cork_spacer_and_lip_dxf_edge_cuts
.kiplot.edge_cuts.yml -d build/0.2/compact/cases/low_profile
build build/0.2/compact/cases/low_profile/cork_spacer_and_lip-Edge_Cuts.dxf $
build/0.2/compact/cases/low_profile/cork_spacer_and_lip-Edge_Cuts.svg: $
0_2_compact_cases_low_profile_cork_spacer_and_lip_edge_cuts

rule 0_2_compact_cases_low_profile_lip_drc
command = ./automation/run_drc.sh $
Expand All @@ -785,12 +791,13 @@ build build/0.2/compact/cases/low_profile/lip_front.svg: $
automation/tools/PcbDraw/pcbdraw/styles/set-white-enig.json $
0.2/compact/cases/low_profile/lip.kicad_pcb

rule 0_2_compact_cases_low_profile_lip_dxf_edge_cuts
rule 0_2_compact_cases_low_profile_lip_edge_cuts
command = mkdir -p build/0.2/compact/cases/low_profile && kiplot -b $
0.2/compact/cases/low_profile/lip.kicad_pcb -c $
.kiplot.dxf_edge_cuts.yml -d build/0.2/compact/cases/low_profile
build build/0.2/compact/cases/low_profile/lip-Edge_Cuts.dxf: $
0_2_compact_cases_low_profile_lip_dxf_edge_cuts
0.2/compact/cases/low_profile/lip.kicad_pcb -c .kiplot.edge_cuts.yml $
-d build/0.2/compact/cases/low_profile
build build/0.2/compact/cases/low_profile/lip-Edge_Cuts.dxf $
build/0.2/compact/cases/low_profile/lip-Edge_Cuts.svg: $
0_2_compact_cases_low_profile_lip_edge_cuts

build 0.2/compact: phony build/0.2/compact/gerbers.zip $
build/0.2/compact/ferris_front.svg build/0.2/compact/ferris_back.svg $
Expand Down

0 comments on commit 16a0177

Please sign in to comment.