Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions lib/components/normal-components/Board.ts
Original file line number Diff line number Diff line change
Expand Up @@ -552,9 +552,20 @@ export class Board
this.getInheritedProperty("routingDisabled")
const pcbDisabled = this.root?.pcbDisabled

const shouldRunNetlistChecks = true
const shouldRunPlacementChecks = !pcbDisabled
const shouldRunRoutingChecks = !pcbDisabled && !routingDisabled
const netlistDrcChecksDisabled =
this.root?.platform?.netlistDrcChecksDisabled ??
this.getInheritedProperty("netlistDrcChecksDisabled")
const placementDrcChecksDisabled =
this.root?.platform?.placementDrcChecksDisabled ??
this.getInheritedProperty("placementDrcChecksDisabled")
const routingDrcChecksDisabled =
this.root?.platform?.routingDrcChecksDisabled ??
this.getInheritedProperty("routingDrcChecksDisabled")

const shouldRunNetlistChecks = !netlistDrcChecksDisabled
const shouldRunPlacementChecks = !pcbDisabled && !placementDrcChecksDisabled
const shouldRunRoutingChecks =
!pcbDisabled && !routingDisabled && !routingDrcChecksDisabled

// If async trace routing is still in progress anywhere in this board subtree,
// wait so routing DRC sees final routed traces and doesn't mark DRC complete early.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"@tscircuit/math-utils": "^0.0.29",
"@tscircuit/miniflex": "^0.0.4",
"@tscircuit/ngspice-spice-engine": "^0.0.8",
"@tscircuit/props": "^0.0.485",
"@tscircuit/props": "^0.0.487",
"@tscircuit/schematic-match-adapt": "^0.0.16",
"@tscircuit/schematic-trace-solver": "^v0.0.45",
"@tscircuit/solver-utils": "^0.0.3",
Expand Down
64 changes: 64 additions & 0 deletions tests/root-circuit/platform-drc-checks-disabled.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import { expect, test } from "bun:test"
import { getTestFixture } from "tests/fixtures/get-test-fixture"

const getErrorTypes = (circuitJson: Array<{ type: string }>) =>
new Set(
circuitJson
.filter((elm) => elm.type.includes("error"))
.map((elm) => elm.type),
)

test("platform netlistDrcChecksDisabled disables netlist DRC errors", async () => {
const { circuit } = getTestFixture({
platform: {
netlistDrcChecksDisabled: true,
},
})

circuit.add(
<board width="10mm" height="10mm" routingDisabled>
<resistor footprint="0402" resistance={1000} name="R1" pcbX={-2} />
<resistor footprint="0402" resistance={1000} name="R2" pcbX={2} />
<trace from=".R1 .1" to=".R2 .1" />
</board>,
)

await circuit.renderUntilSettled()

expect(
getErrorTypes(circuit.getCircuitJson() as Array<{ type: string }>),
).toEqual(new Set())
})

test("platform placementDrcChecksDisabled disables placement DRC errors", async () => {
const { circuit } = getTestFixture({
platform: {
placementDrcChecksDisabled: true,
},
})

circuit.add(
<board width="10mm" height="10mm" routingDisabled>
<resistor
footprint="0402"
resistance={1000}
name="R1"
pcbX={0}
pcbY={0}
/>
<resistor
footprint="0402"
resistance={1000}
name="R2"
pcbX={0}
pcbY={0}
/>
</board>,
)

await circuit.renderUntilSettled()

expect(
getErrorTypes(circuit.getCircuitJson() as Array<{ type: string }>),
).toEqual(new Set())
})