@tscircuit/autorouting-cache-engine
Advanced tools
Comparing version
@@ -46,3 +46,3 @@ import { CircuitJson, PcbTrace } from 'circuit-json'; | ||
} | ||
interface NormalizedTrace { | ||
interface NormalizedTraceObstacle { | ||
type: "trace"; | ||
@@ -64,3 +64,3 @@ net: number | null; | ||
} | ||
type NormalizedObject = NormalizedPad | NormalizedHole | NormalizedTrace; | ||
type NormalizedObject = NormalizedPad | NormalizedHole | NormalizedTraceObstacle; | ||
type NormalizedAutoroutingJson = { | ||
@@ -89,6 +89,7 @@ allowed_layers: number; | ||
declare const denormalizeTraces: ({ normalizationTransform, circuitJson, normalizedTraces, }: { | ||
declare const denormalizeTraces: ({ normalizationTransform, circuitJson, normalizedTraces, subcircuitId, }: { | ||
normalizationTransform: NormalizationTransform; | ||
circuitJson: CircuitJson; | ||
normalizedTraces: NormalizedAutoroutingTrace[]; | ||
subcircuitId?: string; | ||
}) => PcbTrace[]; | ||
@@ -109,2 +110,2 @@ | ||
export { type NormalizationOptions, type NormalizationTransform, type NormalizedAutoroutingJson, type NormalizedAutoroutingTrace, type NormalizedHole, type NormalizedObject, type NormalizedPad, type NormalizedRoutePoint, type NormalizedTrace, convertCircuitJsonToNormalizedAutoroutingJson, denormalizeTraces, generateCacheKey, normalizePcbTraces }; | ||
export { type NormalizationOptions, type NormalizationTransform, type NormalizedAutoroutingJson, type NormalizedAutoroutingTrace, type NormalizedHole, type NormalizedObject, type NormalizedPad, type NormalizedRoutePoint, type NormalizedTraceObstacle, convertCircuitJsonToNormalizedAutoroutingJson, denormalizeTraces, generateCacheKey, normalizePcbTraces }; |
@@ -302,3 +302,4 @@ // lib/convertCircuitJsonToNormalizedAutoroutingJson.ts | ||
circuitJson, | ||
normalizedTraces | ||
normalizedTraces, | ||
subcircuitId | ||
}) => { | ||
@@ -344,3 +345,3 @@ const { offsetX: targetOffsetX, offsetY: targetOffsetY } = normalizationTransform; | ||
source_trace_id: sourceTrace?.source_trace_id, | ||
pcb_trace_id: `pcb_trace_${++highestPcbTraceIdNumber}`, | ||
pcb_trace_id: `pcb_trace_${++highestPcbTraceIdNumber}${subcircuitId ? `_${subcircuitId}` : ""}`, | ||
route: denormalizedRoute | ||
@@ -347,0 +348,0 @@ }; |
@@ -5,3 +5,3 @@ import type { PcbTrace } from "circuit-json" | ||
NormalizedObject, | ||
NormalizedTrace, | ||
NormalizedTraceObstacle, | ||
} from "../types" | ||
@@ -15,3 +15,3 @@ | ||
normalizationTransform: { offsetX: number; offsetY: number }, | ||
): NormalizedTrace["route_segments"] => { | ||
): NormalizedTraceObstacle["route_segments"] => { | ||
const { offsetX, offsetY } = normalizationTransform | ||
@@ -18,0 +18,0 @@ const segments = [] |
import type { PcbTrace } from "circuit-json" | ||
import type { NormalizedTrace } from "../types" | ||
import type { NormalizedTraceObstacle } from "../types" | ||
@@ -10,4 +10,4 @@ export const getViasFromTrace = ( | ||
}, | ||
): NormalizedTrace["vias"] => { | ||
const vias: NormalizedTrace["vias"] = [] | ||
): NormalizedTraceObstacle["vias"] => { | ||
const vias: NormalizedTraceObstacle["vias"] = [] | ||
for (const point of trace.route) { | ||
@@ -14,0 +14,0 @@ if (point.route_type === "via") { |
@@ -19,2 +19,3 @@ import type { | ||
normalizedTraces, | ||
subcircuitId, | ||
}: { | ||
@@ -24,2 +25,3 @@ normalizationTransform: NormalizationTransform | ||
normalizedTraces: NormalizedAutoroutingTrace[] | ||
subcircuitId?: string | ||
}): PcbTrace[] => { | ||
@@ -80,3 +82,5 @@ const { offsetX: targetOffsetX, offsetY: targetOffsetY } = | ||
source_trace_id: sourceTrace?.source_trace_id, | ||
pcb_trace_id: `pcb_trace_${++highestPcbTraceIdNumber}`, | ||
pcb_trace_id: `pcb_trace_${++highestPcbTraceIdNumber}${ | ||
subcircuitId ? `_${subcircuitId}` : "" | ||
}`, | ||
route: denormalizedRoute, | ||
@@ -83,0 +87,0 @@ } |
@@ -48,3 +48,3 @@ export interface NormalizedRoutePoint { | ||
export interface NormalizedTrace { | ||
export interface NormalizedTraceObstacle { | ||
type: "trace" | ||
@@ -67,3 +67,6 @@ net: number | null | ||
export type NormalizedObject = NormalizedPad | NormalizedHole | NormalizedTrace | ||
export type NormalizedObject = | ||
| NormalizedPad | ||
| NormalizedHole | ||
| NormalizedTraceObstacle | ||
@@ -70,0 +73,0 @@ export type NormalizedAutoroutingJson = { |
{ | ||
"name": "@tscircuit/autorouting-cache-engine", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"repository": "https://github.com/tscircuit/autorouting-cache-engine", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
628218
0.07%19583
0.05%