@typecad/typecad
Version:
🤖programmatically 💥create 🛰️hardware
342 lines (341 loc) • 7.68 kB
TypeScript
import { Schematic } from "../schematic";
import { Pin } from "../pin";
import { RoutingAlgorithm } from "../routing/router_registry";
export interface ILengthMatchPatternConfig {
type: 'sawtooth';
amplitude?: number;
pitch?: number;
}
export interface ILengthMatchConfig {
tolerance: number;
pattern?: ILengthMatchPatternConfig;
minStraightSegment?: number;
maxIterations?: number;
debug?: boolean;
}
export interface IPcbOptions {
Schematic?: Schematic;
remove_orphans?: boolean;
thickness?: number;
copper_thickness?: number;
}
export interface INetResolution {
found: boolean;
netCode: number;
netName: string;
schematicNetCode?: number;
schematicNetName?: string;
}
export interface IVia {
uuid?: string;
netCode?: number;
net?: string;
layers?: string[];
at?: {
x: number;
y: number;
};
size?: number;
drill?: number;
powerInfo?: IViaPowerInfo;
}
export interface IGraphicPrimitive {
uuid: string;
layer: string;
strokeWidth: number;
}
export interface IGrLine extends IGraphicPrimitive {
type: 'line';
start: {
x: number;
y: number;
};
end: {
x: number;
y: number;
};
locked?: boolean;
net?: string;
}
export interface IGrArc extends IGraphicPrimitive {
type: 'arc';
start: {
x: number;
y: number;
};
mid: {
x: number;
y: number;
};
end: {
x: number;
y: number;
};
}
export interface IGrCircle extends IGraphicPrimitive {
type: 'circle';
center: {
x: number;
y: number;
};
end: {
x: number;
y: number;
};
fill?: boolean;
locked?: boolean;
}
export interface IGrRect extends IGraphicPrimitive {
type: 'rect';
start: {
x: number;
y: number;
};
end: {
x: number;
y: number;
};
fill?: boolean;
locked?: boolean;
}
export interface IGrPoly extends IGraphicPrimitive {
type: 'poly';
points: {
x: number;
y: number;
}[];
fill?: boolean;
locked?: boolean;
}
export type OutlineElement = IGrLine | IGrArc;
export interface ISourceInfo {
file: string;
line: number;
column?: number;
variable?: string;
params?: Record<string, any>;
}
export interface IOutline {
uuid: string;
x: number;
y: number;
width: number;
height: number;
filletRadius: number;
elements: OutlineElement[];
sourceInfo?: ISourceInfo;
}
export interface IPowerInfo {
current: number;
maxTempRise?: number;
thickness?: number;
}
export interface IViaPowerInfo {
current: number;
maxTempRise?: number;
thickness?: number;
}
export interface IPinPowerInfo {
minimum_voltage?: number;
maximum_voltage?: number;
current?: number;
}
export interface ITrackDetails {
start: {
x: number;
y: number;
};
end: {
x: number;
y: number;
};
width: number;
layer: string;
locked: boolean;
powerInfo?: IPowerInfo;
}
export interface IGeneratedElement {
type: 'track' | 'via';
uuid: string;
details: ITrackDetails | IVia;
}
export interface ITextPositioning {
x: number;
y: number;
rotation?: number;
layer?: string;
width?: number;
height?: number;
fontSize?: number;
thickness?: number;
bold?: boolean;
italic?: boolean;
justify?: {
horizontal?: 'left' | 'right' | 'center';
vertical?: 'top' | 'bottom' | 'middle';
mirror?: boolean;
};
show?: boolean;
}
export interface IGrTextOptions {
text: string;
x: number;
y: number;
rotation?: number;
layer?: string;
font?: string;
width?: number;
height?: number;
thickness?: number;
bold?: boolean;
italic?: boolean;
justify?: {
horizontal?: 'left' | 'right' | 'center';
vertical?: 'top' | 'bottom' | 'middle';
mirror?: boolean;
};
hide?: boolean;
uuid?: string;
}
export interface IZone {
uuid: string;
layers: string[];
x: number;
y: number;
width: number;
height: number;
polygon: {
x: number;
y: number;
}[];
priority?: number;
locked?: boolean;
name?: string;
}
export interface IFilledZone extends IZone {
net?: string;
netCode?: number;
netName?: string;
fillMode?: 'solid' | 'hatched';
filled?: boolean;
hatchStyle?: 'none' | 'edge' | 'full';
hatchPitch?: number;
minThickness?: number;
clearance?: number;
connectPads?: 'thru_hole_only' | 'full' | 'no';
thermalGap?: number;
thermalBridgeWidth?: number;
smoothing?: 'chamfer' | 'fillet' | 'none';
smoothingRadius?: number;
islandRemovalMode?: number;
islandAreaMin?: number;
hatchThickness?: number;
hatchGap?: number;
hatchOrientation?: number;
hatchSmoothingLevel?: number;
hatchSmoothingValue?: number;
hatchBorderAlgorithm?: 'hatch_thickness' | 'min_thickness';
hatchMinHoleArea?: number;
fillArcSegments?: number;
filledAreasThickness?: boolean;
}
export interface IKeepoutZone extends IZone {
restrictions?: {
tracks?: boolean;
vias?: boolean;
pads?: boolean;
copperpour?: boolean;
footprints?: boolean;
};
hatchStyle?: 'none' | 'edge' | 'full';
hatchPitch?: number;
smoothing?: 'chamfer' | 'fillet' | 'none';
smoothingRadius?: number;
}
export interface IAutorouteWaypoint {
x: number;
y: number;
layer?: string;
}
export interface IAutorouteVia {
x: number;
y: number;
layer: string;
}
export interface IRouteDirectives {
waypoints?: IAutorouteWaypoint[];
vias?: IAutorouteVia[];
}
export interface IImpedanceConstraint {
target: number;
tolerance: number;
}
export interface IConnectionIdentifier {
from: Pin;
to: Pin;
}
export interface IManualRoute {
from?: Pin;
to?: Pin;
route: IRoutePath | IAutorouteResult;
}
export interface IAutorouteOptions {
from: Pin | Pin[];
to: Pin | Pin[];
waypoints?: IAutorouteWaypoint[];
vias?: IAutorouteVia[];
impedance?: IImpedanceConstraint;
layers?: string[];
algorithm?: RoutingAlgorithm;
maxIterations?: number;
viaCost?: number;
bendCost?: number;
allowVias?: boolean;
width?: number;
debug?: boolean;
clearance?: number;
viaClearance?: number;
gridResolution?: number;
heuristicWeight?: number;
parallelMSTWorkers?: number;
net?: string;
powerInfo?: IPowerInfo;
locked?: boolean;
useSteinerOptimization?: boolean;
routes?: (IRoutePath | IAutorouteResult)[];
deferStaging?: boolean;
excludeConnections?: IConnectionIdentifier[];
lengthMatch?: ILengthMatchConfig;
}
export interface IRoutePath {
nodes: {
x: number;
y: number;
layer: string;
}[];
gridNodes?: {
gridX: number;
gridY: number;
layer: string;
}[];
length: number;
viaCount: number;
success: boolean;
error?: string;
segments?: IRoutePath[];
}
export interface IRouteMetadata {
length: number;
viaCount: number;
layers: string[];
success: boolean;
error?: string;
path?: IRoutePath;
}
export interface IAutorouteResult extends Array<import("./pcb_track_builder").TrackBuilder> {
success: boolean;
routeCount: number;
completedCount: number;
routeDetails: IRouteMetadata[];
}
export type IAutorouteRouteOptions = Omit<IAutorouteOptions, 'from' | 'to'>;