Skip to content

Commit 158c62c

Browse files
committed
up
1 parent f0ae119 commit 158c62c

1 file changed

Lines changed: 7 additions & 17 deletions

File tree

  • src/gerber/convert-soup-to-gerber-commands

src/gerber/convert-soup-to-gerber-commands/index.ts

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -48,20 +48,6 @@ const getGerberInnerLayerName = (layerRef: LayerRef) => {
4848
return `In${layerRef.replace("inner", "")}_Cu` as const
4949
}
5050

51-
const getPlatedHoleCcwRotation = (
52-
platedHole: PcbPlatedHole | undefined,
53-
): number => {
54-
if (!platedHole) return 0
55-
switch (platedHole.shape) {
56-
case "oval":
57-
case "pill":
58-
case "hole_with_polygon_pad":
59-
return platedHole.ccw_rotation ?? 0
60-
default:
61-
return 0
62-
}
63-
}
64-
6551
/**
6652
* Converts Circuit JSON to arrays of Gerber commands for each layer
6753
*/
@@ -778,12 +764,16 @@ export const convertSoupToGerberCommands = (
778764
: 0
779765
if (!rotation) {
780766
const platedHole = circuitJson.find(
781-
(candidate): candidate is PcbPlatedHole =>
767+
(
768+
candidate,
769+
): candidate is PcbPlatedHole & { ccw_rotation: number } =>
782770
candidate.type === "pcb_plated_hole" &&
783771
candidate.x === element.x &&
784-
candidate.y === element.y,
772+
candidate.y === element.y &&
773+
"ccw_rotation" in candidate &&
774+
typeof candidate.ccw_rotation === "number",
785775
)
786-
rotation = getPlatedHoleCcwRotation(platedHole)
776+
rotation = platedHole?.ccw_rotation ?? 0
787777
}
788778
const apertureConfig =
789779
element.shape === "pill" && (rotation === 90 || rotation === 270)

0 commit comments

Comments
 (0)