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
3 changes: 3 additions & 0 deletions lib/components/base-components/Renderable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export const orderedRenderPhases = [
"PcbPlacementDesignRuleChecks",
"PcbTraceRender",
"PcbRouteNetIslands",
"PcbTraceTeardropRender",
"PcbCopperPourRender",
"PcbViaStitchRender",
"PcbCopperPourCleanup",
Expand Down Expand Up @@ -125,12 +126,14 @@ const asyncPhaseDependencies: Partial<Record<RenderPhase, RenderPhase[]>> = {
PcbBoardAutoSize: ["PcbFootprintStringRender", "FetchPartFootprint"],
PcbTraceHintRender: ["PcbFootprintStringRender", "FetchPartFootprint"],
PcbManualTraceRender: ["PcbFootprintStringRender", "FetchPartFootprint"],
PcbTraceTeardropRender: ["PcbTraceRender", "PcbRouteNetIslands"],
PcbCopperPourRender: [
"PcbFootprintStringRender",
"FetchPartFootprint",
"PcbPlacementDesignRuleChecks",
"PcbTraceRender",
"PcbRouteNetIslands",
"PcbTraceTeardropRender",
],
PcbViaStitchRender: [
"PcbFootprintStringRender",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import {
resolveSavedTraceRouteWidths,
getSavedTraceViaContactWidths,
} from "lib/utils/autorouting/resolve-saved-trace-route-widths"
import { getViaBoardLayers } from "lib/utils/getViaSpanLayers"
import { applyToPoint, compose, translate } from "transformation-matrix"
import type {
Expand Down Expand Up @@ -57,7 +61,7 @@ export function getSavedFanoutTraces(
translate(-localExit.x, -localExit.y),
)
const originalExit = applyToPoint(transform, localExit)
const route = path.route.map((point) => {
const route = resolveSavedTraceRouteWidths(path.route).map((point) => {
const position = applyToPoint(transform, point)
return {
...point,
Expand Down Expand Up @@ -103,23 +107,30 @@ export function getSavedFanoutTraces(
)
// Explicit wire contacts keep Circuit JSON connectivity checks aware of
// the pad/exit layer without changing the saved copper or via position.
const width =
route.find((point) => point.route_type === "wire")?.width ??
input.minTraceWidth
const startContactWidths = getSavedTraceViaContactWidths(
route,
0,
input.minTraceWidth,
)
const endContactWidths = getSavedTraceViaContactWidths(
route,
route.length - 1,
input.minTraceWidth,
)
if (first.route_type === "via") {
route.splice(1, 0, {
route_type: "wire",
x: first.x,
y: first.y,
layer: first.to_layer,
width,
width: startContactWidths.toWidth,
})
route.unshift({
route_type: "wire",
x: first.x,
y: first.y,
layer: first.from_layer,
width,
width: startContactWidths.fromWidth,
})
}
if (last.route_type === "via") {
Expand All @@ -128,14 +139,14 @@ export function getSavedFanoutTraces(
x: last.x,
y: last.y,
layer: last.from_layer,
width,
width: endContactWidths.fromWidth,
})
route.push({
route_type: "wire",
x: last.x,
y: last.y,
layer: last.to_layer,
width,
width: endContactWidths.toWidth,
})
}
if (last.route_type === "via") {
Expand All @@ -146,7 +157,7 @@ export function getSavedFanoutTraces(
x: last.x,
y: last.y,
layer: last.to_layer,
width,
width: endContactWidths.toWidth,
})
}
coveredConnections.add(connection)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import {
resolveSavedTraceRouteWidths,
getSavedTraceViaContactWidths,
} from "lib/utils/autorouting/resolve-saved-trace-route-widths"
import { applyToPoint } from "transformation-matrix"
import { fanoutTracePath } from "@tscircuit/props"
import type { z } from "zod"
Expand Down Expand Up @@ -106,7 +110,7 @@ export function getSavedAutoroutingPhaseTracesFromPaths({
`Saved phase path "${path.connection}" starts at an endpoint already joined by another path`,
)
const transform = getSavedPcbTracePathTransform(group, port)
const route = path.route.map((point) => ({
const route = resolveSavedTraceRouteWidths(path.route).map((point) => ({
...point,
...applyToPoint(transform, point),
}))
Expand Down Expand Up @@ -168,37 +172,43 @@ export function getSavedAutoroutingPhaseTracesFromPaths({
}
// Explicit wire contacts expose via connectivity to Circuit JSON consumers
// without moving any saved copper. Interior vias need contacts too.
const width =
route.find((point) => point.route_type === "wire")?.width ??
input.minTraceWidth
const routeWithViaContacts = route.flatMap((point): typeof route =>
point.route_type === "via"
? [
{
route_type: "wire",
x: point.x,
y: point.y,
layer: point.from_layer,
width,
},
point,
{
route_type: "wire",
x: point.x,
y: point.y,
layer: point.to_layer,
width,
},
]
: [point],
)
const routeWithViaContacts = route.flatMap((point, index): typeof route => {
if (point.route_type !== "via") return [point]
const { fromWidth, toWidth } = getSavedTraceViaContactWidths(
route,
index,
input.minTraceWidth,
)
return [
{
route_type: "wire",
x: point.x,
y: point.y,
layer: point.from_layer,
width: fromWidth,
},
point,
{
route_type: "wire",
x: point.x,
y: point.y,
layer: point.to_layer,
width: toWidth,
},
]
})
if (last.route_type === "via") {
const { toWidth } = getSavedTraceViaContactWidths(
route,
route.length - 1,
input.minTraceWidth,
)
routeWithViaContacts.push({
route_type: "wire",
x: last.x,
y: last.y,
layer: last.to_layer,
width,
width: toWidth,
})
}
coveredConnections.add(connection)
Expand Down
9 changes: 9 additions & 0 deletions lib/components/primitive-components/Trace/Trace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import type { TraceI } from "./TraceI"
import { Trace__doInitialSchematicTraceRenderWithDisplayLabel } from "./Trace__doInitialSchematicTraceRenderWithDisplayLabel"
import { Trace__findConnectedPorts } from "./Trace__findConnectedPorts"
import { Trace_doInitialPcbManualTraceRender } from "./Trace_doInitialPcbManualTraceRender"
import { Trace_doInitialPcbTraceTeardropRender } from "./Trace_doInitialPcbTraceTeardropRender"
import { Trace_doInitialPcbTraceRender } from "./Trace_doInitialPcbTraceRender"
import { Trace_doInitialSchematicTraceRender } from "./Trace_doInitialSchematicTraceRender"
import { getMaxLengthFromConnectedComponents } from "./trace-utils/get-max-length-from-connected-components"
Expand Down Expand Up @@ -368,6 +369,14 @@ export class Trace
Trace_doInitialPcbManualTraceRender(this)
}

doInitialPcbTraceTeardropRender(): void {
Trace_doInitialPcbTraceTeardropRender(this)
}

updatePcbTraceTeardropRender(): void {
Trace_doInitialPcbTraceTeardropRender(this)
}

doInitialPcbTraceRender(): void {
Trace_doInitialPcbTraceRender(this)
}
Expand Down
Loading
Loading