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
15 changes: 14 additions & 1 deletion lib/utils/autorouting/getSimpleRouteJsonFromCircuitJson.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type { CircuitJsonUtilObjects } from "@tscircuit/circuit-json-util"
import type { Trace } from "lib/components"
import type { SimpleRouteConnection } from "./SimpleRouteJson"
import type { SimpleRouteJson } from "./SimpleRouteJson"
import type { AnyCircuitElement } from "circuit-json"
Expand Down Expand Up @@ -157,6 +156,20 @@ export const getSimpleRouteJsonFromCircuitJson = ({

// TODO handle trace.connected_source_net_ids
const [portA, portB] = connectedPorts

if (portA.x === undefined || portA.y === undefined) {
console.error(
`(source_port_id: ${portA.source_port_id}) for trace ${trace.source_trace_id} does not have x/y coordinates. Skipping this trace.`,
)
return null
}
if (portB.x === undefined || portB.y === undefined) {
console.error(
`(source_port_id: ${portB.source_port_id}) for trace ${trace.source_trace_id} does not have x/y coordinates. Skipping this trace.`,
)
return null
}

const layerA = portA.layers?.[0] ?? "top"
const layerB = portB.layers?.[0] ?? "top"

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"circuit-json-to-gltf": "^0.0.31",
"circuit-json-to-simple-3d": "^0.0.9",
"circuit-json-to-spice": "^0.0.25",
"circuit-to-svg": "^0.0.279",
"circuit-to-svg": "^0.0.280",
"concurrently": "^9.1.2",
"connectivity-map": "^1.0.0",
"debug": "^4.3.6",
Expand Down