Skip to content

Commit

Permalink
upgrade snapshots, fix issue where regular holes weren't being drawn
Browse files Browse the repository at this point in the history
  • Loading branch information
seveibar committed Oct 25, 2024
1 parent 124595f commit c1ce7cb
Show file tree
Hide file tree
Showing 14 changed files with 69 additions and 70 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -183,3 +183,4 @@ yalc.lock
gerber-output
gerber-output.zip
.aider*
*.diff.png
19 changes: 12 additions & 7 deletions src/excellon-drill/convert-soup-to-excellon-drill-commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,19 @@ export const convertSoupToExcellonDrillCommands = ({
element.type === "pcb_via"
) {
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") {
} 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,
Expand Down Expand Up @@ -95,16 +98,18 @@ export const convertSoupToExcellonDrillCommands = ({
)
continue
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") {
}

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

// For pill shapes, we need to route the hole
if (diameterToToolNumber[hole_diameter] === i) {
const y_multiplier = flip_y_axis ? -1 : 1

if (element.hole_width > element.hole_height) {
// Horizontal pill
const offset = (element.hole_width - element.hole_height) / 2
Expand Down
1 change: 0 additions & 1 deletion tests/fixtures/preload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ async function toMatchGerberSnapshot(
}

expect.extend({
// biome-ignore lint/suspicious/noExplicitAny:
toMatchGerberSnapshot: toMatchGerberSnapshot as any,
})

Expand Down
Binary file removed tests/gerber/__snapshots__/pill-shape-bottom.diff.png
Binary file not shown.
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.
Binary file removed tests/gerber/__snapshots__/pill-shape-top.diff.png
Binary file not shown.
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.
Loading

0 comments on commit c1ce7cb

Please sign in to comment.