Skip to content

Commit

Permalink
Merge pull request #42 from tscircuit/round-hole
Browse files Browse the repository at this point in the history
Detect round holes as obstacles fix
  • Loading branch information
seveibar authored Sep 7, 2024
2 parents fd23af0 + ca36e08 commit 65e6bf0
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 4 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/bun-formatcheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Created using @tscircuit/plop (npm install -g @tscircuit/plop)
name: Format Check

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
format-check:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Setup bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest

- name: Install dependencies
run: bun install

- name: Run format check
run: bun run format:check
10 changes: 9 additions & 1 deletion biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,15 @@
"indentStyle": "space"
},
"files": {
"ignore": ["cosmos-export", "dist", "package.json"]
"ignore": [
"cosmos-export",
"dist",
"package.json",
"static-server",
"frontend-dist",
".vercel",
".vscode"
]
},
"javascript": {
"formatter": {
Expand Down
19 changes: 16 additions & 3 deletions module/lib/solver-utils/getObstaclesFromCircuitJson.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ export const getObstaclesFromCircuitJson = (soup: AnySoupElement[]) => {
connectedTo: [],
})
}
}
else if (element.type === "pcb_hole") {
} else if (element.type === "pcb_hole") {
if (element.hole_shape === "oval") {
obstacles.push({
// @ts-ignore
Expand All @@ -80,6 +79,17 @@ export const getObstaclesFromCircuitJson = (soup: AnySoupElement[]) => {
height: element.hole_diameter,
connectedTo: [],
})
} else if (element.hole_shape === "round") {
obstacles.push({
type: "rect",
center: {
x: element.x,
y: element.y,
},
width: element.hole_diameter,
height: element.hole_diameter,
connectedTo: [],
})
}
} else if (element.type === "pcb_plated_hole") {
if (element.shape === "circle") {
Expand Down Expand Up @@ -108,7 +118,10 @@ export const getObstaclesFromCircuitJson = (soup: AnySoupElement[]) => {
})
}
} else if (element.type === "pcb_trace") {
const traceObstacles = getObstaclesFromRoute(element.route, element.source_trace_id!)
const traceObstacles = getObstaclesFromRoute(
element.route,
element.source_trace_id!,
)
obstacles.push(...traceObstacles)
}
}
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"build:cli": "tsup ./module/cli.ts --dts --sourcemap --out-dir ./dist",
"build-and-serve": "npm run build && bun --hot module/cli.ts server start",
"format": "biome format --write .",
"format:check": "biome format .",
"build:static": "bun run build && bun scripts/build-static.ts",
"build:infgrid-ijump-astar": "tsup-node ./algos/infinite-grid-ijump-astar/v2/index.ts -d ./algos/infinite-grid-ijump-astar/dist --format esm --dts --sourcemap"
},
Expand Down

0 comments on commit 65e6bf0

Please sign in to comment.