import { Component } from "../../component.js"; import { Pin } from "../../pin.js"; export interface IPadResolutionFailure { pinNumber: string; component: Component; reason: 'no_owner' | 'footprint_unparseable' | 'pad_not_found' | 'pad_data_unextractable' | 'unknown'; availablePads: (string | number)[]; } /** * Geometry information for a component pad on the PCB. */ export interface IPadGeometry { /** Absolute center position on the PCB in mm */ center: { x: number; y: number; }; /** Pad shape type */ shape: 'circle' | 'rect' | 'oval' | 'roundrect' | 'custom'; /** Pad type (SMD or through-hole) */ type: 'smd' | 'thru_hole' | 'np_thru_hole' | 'connect'; /** Pad size in mm */ size: { width: number; height: number; }; /** Absolute rotation in degrees */ rotation: number; /** Layer the pad is on (e.g., 'F.Cu', 'B.Cu'). For through-hole pads, this is the primary layer but the pad exists on all layers */ layer: string; /** All layers this pad exists on (for through-hole pads, includes all copper layers) */ layers: string[]; /** Pad number/name */ number: string | number; /** Net name this pad belongs to (for net-aware routing) */ net?: string; /** Component reference (for debugging) */ componentRef?: string; } /** * Resolves pin objects to their physical pad positions on the PCB. * Handles coordinate transformation from footprint-relative to board-absolute coordinates. */ export declare class PadResolver { private static _parseCache; private static getCachedParse; static clearParseCache(): void; /** * Get the absolute center position of a pin's pad on the PCB. * * @param pin - The pin to resolve * @returns The absolute X,Y coordinates in mm, or null if unable to resolve * * @example * ```ts * const center = PadResolver.getPadCenter(resistor.pin(1)); * if (center) { * logger.log(`Pad is at ${center.x}, ${center.y}`); * } * ``` */ static getPadCenter(pin: Pin): { x: number; y: number; layer: string; } | null; static getPadCenterWithFailure(pin: Pin): { x: number; y: number; layer: string; } | { failure: IPadResolutionFailure; }; /** * Get complete geometry information for a specific pad. * * @param component - The component containing the pad * @param pinNumber - The pin/pad number to look up * @returns Complete pad geometry, or null if not found * * @example * ```ts * const padGeom = PadResolver.getPadGeometry(resistor, 1); * if (padGeom) { * logger.log(`Pad shape: ${padGeom.shape}, size: ${padGeom.size.width}x${padGeom.size.height}mm`); * } * ``` */ static getPadGeometry(component: Component, pinNumber: string | number): IPadGeometry | null; static getPadGeometryWithFailure(component: Component, pinNumber: string | number): IPadGeometry | { failure: IPadResolutionFailure; }; /** * Find a pad node in the footprint S-expression tree. * @private */ private static findPadNode; private static collectAvailablePadNumbers; /** * Extract pad data from a pad S-expression node. * @private */ private static extractPadData; /** * Transform pad data from footprint-relative to board-absolute coordinates. * @private */ private static transformToAbsolute; /** * Get all pad geometries for a component. * Useful for obstacle detection and collision checking. * * @param component - The component to get pads from * @returns Array of pad geometries */ static getAllPadGeometries(component: Component): IPadGeometry[]; } //# sourceMappingURL=pad_resolver.d.ts.map