import { PcbSmtPad, PcbPlatedHole, AnyCircuitElement } from 'circuit-json'; interface DsnPcb { is_dsn_pcb: true; is_dsn_session?: false; filename: string; parser: { string_quote: string; host_version: string; space_in_quoted_tokens: string; host_cad: string; }; resolution: { unit: string; value: number; }; unit: string; structure: { layers: Array<{ name: string; type: string; property: { index: number; }; }>; boundary: { path: { layer: string; width: number; coordinates: number[]; }; }; via: string; rule: { clearances: Array<{ value: number; type?: string; }>; width: number; }; }; placement: { components: Array; }; library: { images: Image[]; padstacks: Padstack[]; }; network: { nets: Array<{ name: string; pins: string[]; }>; classes: Array<{ name: string; description: string; net_names: string[]; circuit: { use_via: string; }; rule: { clearances: Array<{ type?: any; value: number; }>; width: number; }; }>; }; wiring: { wires: Array<{ path: { layer: string; width: number; /** * TODO UNIT? */ coordinates: number[]; }; net: string; type: string; }>; }; } interface ComponentPlacement { name: string; places: Array<{ refdes: string; PN?: string; x: number; y: number; side: "front" | "back"; rotation: number; }>; } interface Parser { string_quote: string; space_in_quoted_tokens: string; host_cad: string; host_version: string; } interface Resolution { unit: string; value: number; } interface Structure { layers: Layer[]; boundary: Boundary; via: string; rule: Rule; } interface Layer { name: string; type: string; property: { index: number; }; } interface Boundary { rect?: { type: string; coordinates: number[]; }; polygon?: { type: string; width: number; coordinates: number[]; }; path?: { layer: string; width: number; coordinates: number[]; }; } interface Path { layer: string; width: number; coordinates: number[]; } interface Rule { width: number; clearances: Clearance[]; } interface Clearance { value: number; type?: string; } interface Placement { components: ComponentPlacement[]; } interface Component { name: string; places: Places[]; } interface Places { refdes: string; x: number; y: number; side: string; rotation: number; PN: string; } interface Library { images: Image[]; padstacks: Padstack[]; } interface Image { name: string; outlines: Outline[]; pins: Pin[]; } interface Outline { path: Path; } interface Pin { padstack_name: string; pin_number: number | string; x: number; y: number; } interface Padstack { name: string; shapes: Shape[]; attach: string; hole?: { shape: "circle" | "square" | "oval"; width?: number; height?: number; diameter?: number; }; } interface PadDimensions { width: number; height: number; radius?: number; } type Shape = PolygonShape | CircleShape | RectShape | PathShape; interface BaseShape { shapeType: string; layer: string; } interface PolygonShape extends BaseShape { shapeType: "polygon"; width: number; coordinates: number[]; } interface CircleShape extends BaseShape { shapeType: "circle"; diameter: number; } interface RectShape extends BaseShape { shapeType: "rect"; coordinates: number[]; } interface PathShape extends BaseShape { shapeType: "path"; width: number; coordinates: number[]; } interface Network { nets: Net[]; classes: Class[]; } interface Net { name: string; pins: string[]; } interface Class { name: string; description: string; net_names: string[]; circuit: Circuit; rule: Rule; } interface Circuit { use_via: string; } interface Wiring { wires: Wire[]; } interface Wire { polyline_path?: { layer: string; width: number; coordinates: number[]; }; path?: { layer: string; width: number; coordinates: number[]; }; net?: string; clearance_class?: string; type?: string; } interface Via { x: number; y: number; } interface DsnSession { is_dsn_session: true; is_dsn_pcb?: false; filename: string; placement: { resolution: Resolution; components: Array; }; routes: { resolution: Resolution; parser: Parser; library_out?: { images: Image[]; padstacks: Padstack[]; }; network_out: { nets: Array<{ name: string; wires: Wire[]; vias?: Via[]; }>; }; }; } interface ComponentGroup { pcb_component_id: string; pcb_smtpads: PcbSmtPad[]; pcb_plated_holes: PcbPlatedHole[]; } type DsnJson = DsnPcb | DsnSession; declare function convertCircuitJsonToDsnJson(circuitElements: AnyCircuitElement[], options?: { traceClearance?: number; }): DsnPcb; declare function mergeDsnSessionIntoDsnPcb(dsnPcb: DsnPcb, dsnSession: DsnSession): DsnPcb; declare const convertCircuitJsonToDsnString: (circuitJson: AnyCircuitElement[], options?: { traceClearance?: number; }) => string; declare function convertCircuitJsonToDsnSession(dsnPcb: DsnPcb, circuitJson: AnyCircuitElement[]): DsnSession; declare function convertDsnPcbToCircuitJson(dsnPcb: DsnPcb, fromSessionSpace?: boolean): AnyCircuitElement[]; declare const stringifyDsnJson: (dsnJson: DsnPcb) => string; declare const stringifyDsnSession: (session: DsnSession) => string; /** * @deprecated use convertDsnPcbToCircuitJson instead */ declare function convertDsnJsonToCircuitJson(dsnPcb: DsnPcb): AnyCircuitElement[]; declare const parseDsnToCircuitJson: (dsnString: string) => AnyCircuitElement[]; interface ASTNode { type: "List" | "Atom"; value?: string | number; children?: ASTNode[]; } declare function parseDsnToDsnJson(dsnString: string): DsnJson; declare function processPCB(nodes: ASTNode[]): DsnPcb; declare function processParser(nodes: ASTNode[]): Parser; declare function processResolution(nodes: ASTNode[]): Resolution; declare function processStructure(nodes: ASTNode[]): Structure; declare function processPlacement(nodes: ASTNode[]): Placement; declare function processLibrary(nodes: ASTNode[]): Library; declare function processNetwork(nodes: ASTNode[]): Network; declare function processWiring(nodes: ASTNode[]): Wiring; declare function convertDsnSessionToCircuitJson(dsnInput: DsnPcb, dsnSession: DsnSession, circuitJson?: AnyCircuitElement[]): AnyCircuitElement[]; export { type BaseShape, type Boundary, type CircleShape, type Circuit, type Class, type Clearance, type Component, type ComponentGroup, type ComponentPlacement, type DsnJson, type DsnPcb, type DsnSession, type Image, type Layer, type Library, type Net, type Network, type Outline, type PadDimensions, type Padstack, type Parser, type Path, type PathShape, type Pin, type Placement, type Places, type PolygonShape, type RectShape, type Resolution, type Rule, type Shape, type Structure, type Via, type Wire, type Wiring, convertCircuitJsonToDsnJson, convertCircuitJsonToDsnSession, convertCircuitJsonToDsnString, convertDsnJsonToCircuitJson, convertDsnPcbToCircuitJson, convertDsnSessionToCircuitJson, mergeDsnSessionIntoDsnPcb, parseDsnToCircuitJson, parseDsnToDsnJson, processLibrary, processNetwork, processPCB, processParser, processPlacement, processResolution, processStructure, processWiring, stringifyDsnJson, stringifyDsnSession };