Skip to content

Commit

Permalink
pill drill initial
Browse files Browse the repository at this point in the history
  • Loading branch information
seveibar committed Oct 25, 2024
1 parent 095bc04 commit cfaf70c
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 20 deletions.
30 changes: 24 additions & 6 deletions src/excellon-drill/convert-soup-to-excellon-drill-commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,26 @@ export const convertSoupToExcellonDrillCommands = ({
element.type === "pcb_hole" ||
element.type === "pcb_via"
) {
if (!("hole_diameter" in element)) continue
if (!diameterToToolNumber[element.hole_diameter]) {
let hole_diameter: number | undefined

if ("hole_diameter" in element) {
hole_diameter = element.hole_diameter
} else if (element.type === "pcb_plated_hole" && element.shape === "pill") {
// For pill shapes, use the minimum dimension as the hole diameter
hole_diameter = Math.min(element.hole_width, element.hole_height)
}

if (!hole_diameter) continue

if (!diameterToToolNumber[hole_diameter]) {
builder.add("aper_function_header", {
is_plated: true,
})
builder.add("define_tool", {
tool_number: tool_counter,
diameter: element.hole_diameter,
diameter: hole_diameter,
})
diameterToToolNumber[element.hole_diameter] = tool_counter
diameterToToolNumber[hole_diameter] = tool_counter
tool_counter++
}
}
Expand All @@ -84,8 +94,16 @@ export const convertSoupToExcellonDrillCommands = ({
(element.type === "pcb_plated_hole" || element.type === "pcb_via")
)
continue
if (!("hole_diameter" in element)) continue
if (diameterToToolNumber[element.hole_diameter] === i) {
let hole_diameter: number | undefined

if ("hole_diameter" in element) {
hole_diameter = element.hole_diameter
} else if (element.type === "pcb_plated_hole" && element.shape === "pill") {
hole_diameter = Math.min(element.hole_width, element.hole_height)
}

if (!hole_diameter) continue
if (diameterToToolNumber[hole_diameter] === i) {
builder.add("drill_at", {
x: element.x,
y: element.y * (flip_y_axis ? -1 : 1),
Expand Down
14 changes: 7 additions & 7 deletions tests/gerber/__snapshots__/pill-shape-bottom.snap.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 7 additions & 7 deletions tests/gerber/__snapshots__/pill-shape-top.snap.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit cfaf70c

Please sign in to comment.