@typecad/typecad
Version:
🤖programmatically 💥create 🛰️hardware
234 lines (233 loc) • 8.37 kB
TypeScript
import { Component } from "../component";
import { Schematic, ISchematicNetDefinition } from "../schematic";
import { Pin } from "../pin";
import { TrackBuilder } from './pcb_track_builder';
import type { IPcbOptions, INetResolution, IVia, IGrLine, IGrCircle, IGrRect, IGrPoly, IOutline, IGrTextOptions, IFilledZone, IKeepoutZone, IAutorouteOptions, IAutorouteResult } from './pcb_interfaces';
import { RoutingGrid } from '../routing/shared/routing_grid';
export { TrackBuilder } from './pcb_track_builder';
export type { IPcbOptions, INetResolution, IVia, IGraphicPrimitive, IGrLine, IGrArc, IGrCircle, IGrRect, IGrPoly, OutlineElement, IOutline, ISourceInfo, IGeneratedElement, IGrTextOptions, IZone, IFilledZone, IKeepoutZone, IAutorouteOptions, IAutorouteResult, IAutorouteWaypoint, IImpedanceConstraint, IRouteMetadata, IConnectionIdentifier, IManualRoute, IAutorouteRouteOptions } from './pcb_interfaces';
export declare class PCB {
#private;
Boardname: string;
Schematic: Schematic;
thickness: number;
copper_thickness: number;
outlines: IOutline[];
tracks: IOutline[];
constructor(Boardname: string, options?: IPcbOptions);
registerRouter(registerFn: {
(registry: {
register(name: string, factory: (grid: RoutingGrid, options: unknown) => any, options?: {
configureGrid?: (context: any) => {
gridResolution?: number;
reason?: string;
} | void;
}): void;
}, algorithm?: string): void;
}): void;
createRouter(name: string, grid: RoutingGrid, options: unknown): any;
getRouterGridConfigurator(name: string): ((context: any) => {
gridResolution?: number;
reason?: string;
} | void) | undefined;
getRegisteredRouters(): string[];
get option(): IPcbOptions;
get grLines(): IGrLine[];
get grCircles(): IGrCircle[];
get grRects(): IGrRect[];
get grPolys(): IGrPoly[];
get stagedOutlines(): IOutline[];
get zones(): IFilledZone[];
get keepoutZones(): IKeepoutZone[];
get components(): Component[];
get stagedComponents(): Component[];
get groups(): string[];
get groupsAsMap(): Map<string, any>;
get existingBoardElements(): any[];
get grTexts(): IGrTextOptions[];
get pcb(): string;
get outlines_public(): IOutline[];
get options(): IPcbOptions;
resolveNet(componentReference: string, pinNumber: string, componentUuid?: string, boardNetNameToCodeMap?: Map<string, number>, fallbackNetName?: string): INetResolution;
_addComponentToBoardPublic(component: Component): void;
_resolveNetPublic(componentReference: string, pinNumber: string, componentUuid?: string, boardNetNameToCodeMap?: Map<string, number>, fallbackNetName?: string): INetResolution;
_createFootprintNodePublic(component: Component, boardNetNameToCodeMap?: Map<string, number>): any[];
_updateFootprintNodePublic(node: any[], component: Component, boardNetNameToCodeMap?: Map<string, number>): any[];
_clearComponents(): void;
_clearOutlines(): void;
_clearGroups(): void;
_setPcb(content: string): void;
place(...components: Component[]): void;
stage(...components: Component[]): void;
group(group_name: string, ...items: Array<Component | TrackBuilder>): void;
text(options: IGrTextOptions): void;
create(...items: Array<Component | TrackBuilder>): Promise<void>;
getCallSite(): {
file: string;
line: number;
column: number;
} | undefined;
private calculateViaCurrentCapacity;
via({ at, size, drill, net, powerInfo }?: Omit<IVia, 'uuid' | 'netCode' | 'layers'>): Component;
zone(options: {
pin?: any;
net?: string;
layers: string[];
x: number;
y: number;
width: number;
height: number;
fillMode?: 'solid' | 'hatched';
filled?: boolean;
priority?: number;
locked?: boolean;
name?: string;
minThickness?: number;
hatchStyle?: 'none' | 'edge' | 'full';
hatchPitch?: 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;
}): void;
keepout(options: {
layers: string[];
x: number;
y: number;
width: number;
height: number;
restrictions?: {
tracks?: boolean;
vias?: boolean;
pads?: boolean;
copperpour?: boolean;
footprints?: boolean;
};
priority?: number;
locked?: boolean;
name?: string;
hatchStyle?: 'none' | 'edge' | 'full';
hatchPitch?: number;
smoothing?: 'chamfer' | 'fillet' | 'none';
smoothingRadius?: number;
}): void;
line(options: {
start: {
x: number;
y: number;
};
end: {
x: number;
y: number;
};
layer?: string;
width?: number;
locked?: boolean;
}): void;
circle(options: {
center: {
x: number;
y: number;
};
radius?: number;
end?: {
x: number;
y: number;
};
layer?: string;
width?: number;
fill?: boolean;
locked?: boolean;
}): void;
rect(options: {
x?: number;
y?: number;
width?: number;
height?: number;
start?: {
x: number;
y: number;
};
end?: {
x: number;
y: number;
};
layer?: string;
strokeWidth?: number;
fill?: boolean;
locked?: boolean;
}): void;
poly(options: {
points: {
x: number;
y: number;
}[];
layer?: string;
width?: number;
fill?: boolean;
locked?: boolean;
}): void;
outline(x: number, y: number, width: number, height: number, filletRadius?: number, conceptualUuidFromUser?: string): void;
_getStagedOutlines(): IOutline[];
_getKeepoutZones(): IKeepoutZone[];
_getComponents(): Component[];
_getStagedComponents(): Component[];
_removeStagedOutlinesByUuid(uuids: string[]): void;
_track(start: {
x: number;
y: number;
}, end: {
x: number;
y: number;
}, width?: number, layer?: string, locked?: boolean, uuid?: string, net?: string): string;
track(options?: {
locked?: boolean;
net?: string;
deferStaging?: boolean;
}): TrackBuilder;
private _pinToIdentifier;
private _pinsMatch;
private _connectionMatches;
route(options: IAutorouteOptions): Promise<IAutorouteResult>;
route(netDefinition: ISchematicNetDefinition, options?: import('./pcb_interfaces').IAutorouteRouteOptions): Promise<IAutorouteResult>;
private autoroute;
waitForPendingAutoroutes(): Promise<void>;
private _pointOnLineSegment;
autorouteBatch(items: Array<{
from: Pin | Pin[];
to: Pin | Pin[];
options?: import('./pcb_interfaces').IAutorouteRouteOptions;
name?: string;
}>, batchOptions?: {
rounds?: number;
reorder?: 'none' | 'reverse' | 'byDistance';
relaxViaCostPerRound?: number;
increaseIterationsPerRound?: number;
}): Promise<{
results: IAutorouteResult[];
success: boolean;
rounds: number;
}>;
private calculateBoardBounds;
private calculateMinTraceWidth;
net(...pins: Pin[]): ISchematicNetDefinition;
named(name: string): this;
bom(output_folder?: string): void;
erc(): void;
add(...components: Component[]): void;
_getTrackData(uuid: string): IGrLine | null;
private prettyPrintSExpr;
}