@tscircuit/core 0.0.1474 → 0.0.1476
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +108 -6
- package/dist/index.js +322 -47
- package/package.json +4 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as circuit_json from 'circuit-json';
|
|
2
|
-
import { PcbTraceError, PcbPlacementError, PcbManualEditConflictWarning, PcbViaClearanceError, LayerRef, AnyCircuitElement, Size, PcbTrace as PcbTrace$1, PcbVia as PcbVia$1, PcbTraceRoutePoint, AnySourceComponent, PcbComponent, SchematicPort, SchematicComponent, PcbSilkscreenGraphic, RouteHintPoint, CircuitJson } from 'circuit-json';
|
|
2
|
+
import { PcbTraceError, PcbPlacementError, PcbManualEditConflictWarning, PcbViaClearanceError, LayerRef, AnyCircuitElement, Size, PcbTrace as PcbTrace$1, PcbVia as PcbVia$1, PcbTraceRoutePoint, AnySourceComponent, PcbComponent, SchematicPort, SchematicComponent, PcbSilkscreenGraphic, RouteHintPoint, PcbBoard, CircuitJson } from 'circuit-json';
|
|
3
3
|
import * as _tscircuit_props from '@tscircuit/props';
|
|
4
|
-
import { PlatformConfig, traceProps, netProps, AutorouterProp, AutoroutingPhaseProps, subcircuitGroupProps, AutorouterConfig, PcbSx, portProps, SupplierPartNumbers, CadModelProp, SchematicPortArrangement, groupProps, boardProps, subcircuitProps, subpanelProps, capacitorProps, chipProps, pinoutProps, diodeProps, fuseProps, jumperProps, interconnectProps, solderjumperProps, ledProps, powerSourceProps, voltageSourceProps, currentSourceProps, ammeterProps, resistorProps, constraintProps, internalCircuitProps, drcCheckProps, autoroutingPhaseProps, fabricationNoteRectProps, fabricationNotePathProps, fabricationNoteTextProps, fabricationNoteDimensionProps, pcbNoteLineProps, pcbNoteRectProps, pcbNoteTextProps, pcbNotePathProps, pcbNoteDimensionProps, footprintProps, breakoutProps, breakoutPointProps, holeProps, pcbKeepoutProps, netLabelProps, cadmodelProps, cadassemblyProps, platedHoleProps, courtyardCircleProps, courtyardOutlineProps, courtyardRectProps, silkscreenCircleProps, silkscreenPathProps, silkscreenRectProps, silkscreenTextProps, silkscreenLineProps, silkscreenGraphicProps, smtPadProps, fiducialProps, differentialPairProps, traceHintProps, viaProps, copperPourProps, copperTextProps, cutoutProps, batteryProps, pinHeaderProps, resonatorProps, inductorProps, potentiometerProps, pushButtonProps, crystalProps, CrystalPinLabels, transistorProps, mosfetProps, opampProps, OpAmpPinLabels, switchProps, SwitchProps, testpointProps, schematicTextProps, schematicLineProps, schematicRectProps, schematicArcProps, schematicCircleProps, schematicPathProps, schematicBoxProps, schematicSectionProps, schematicSheetProps, schematicTableProps, schematicRowProps, schematicCellProps, symbolProps, analogSimulationProps, voltageProbeProps, spicemodelProps, CapacitorProps, ChipProps, DiodeProps, ResistorProps, ManualEditEvent, ManualEditsFile, ChipConnections, manual_edits_file } from '@tscircuit/props';
|
|
4
|
+
import { PlatformConfig, traceProps, netProps, AutorouterProp, AutoroutingPhaseProps, subcircuitGroupProps, AutorouterConfig, PcbSx, portProps, SupplierPartNumbers, CadModelProp, SchematicPortArrangement, groupProps, boardProps, subcircuitProps, subpanelProps, capacitorProps, chipProps, pinoutProps, diodeProps, fuseProps, jumperProps, interconnectProps, solderjumperProps, ledProps, powerSourceProps, voltageSourceProps, currentSourceProps, ammeterProps, resistorProps, constraintProps, internalCircuitProps, drcCheckProps, autoroutingPhaseProps, fabricationNoteRectProps, fabricationNotePathProps, fabricationNoteTextProps, fabricationNoteDimensionProps, pcbNoteLineProps, pcbNoteRectProps, pcbNoteTextProps, pcbNotePathProps, pcbNoteDimensionProps, footprintProps, breakoutProps, breakoutPointProps, holeProps, pcbKeepoutProps, netLabelProps, cadmodelProps, cadassemblyProps, platedHoleProps, courtyardCircleProps, courtyardOutlineProps, courtyardRectProps, silkscreenCircleProps, silkscreenPathProps, silkscreenRectProps, silkscreenTextProps, silkscreenLineProps, silkscreenGraphicProps, smtPadProps, fiducialProps, differentialPairProps, traceHintProps, viaProps, copperPourProps, copperTextProps, cutoutProps, enclosureCutoutApertureProps, enclosureFdmBoxProps, batteryProps, pinHeaderProps, resonatorProps, inductorProps, potentiometerProps, pushButtonProps, crystalProps, CrystalPinLabels, transistorProps, mosfetProps, opampProps, OpAmpPinLabels, switchProps, SwitchProps, testpointProps, schematicTextProps, schematicLineProps, schematicRectProps, schematicArcProps, schematicCircleProps, schematicPathProps, schematicBoxProps, schematicSectionProps, schematicSheetProps, schematicTableProps, schematicRowProps, schematicCellProps, symbolProps, analogSimulationProps, voltageProbeProps, spicemodelProps, EnclosureCutoutApertureProps, EnclosureFdmBoxProps, CapacitorProps, ChipProps, DiodeProps, ResistorProps, ManualEditEvent, ManualEditsFile, ChipConnections, manual_edits_file } from '@tscircuit/props';
|
|
5
5
|
export { kicadFootprintStrings } from '@tscircuit/props';
|
|
6
6
|
import * as react from 'react';
|
|
7
7
|
import react__default, { ReactElement } from 'react';
|
|
@@ -11,10 +11,11 @@ import { z, ZodType } from 'zod';
|
|
|
11
11
|
import { symbols, SchSymbol, BaseSymbolName } from 'schematic-symbols';
|
|
12
12
|
import { CircuitJsonUtilObjects } from '@tscircuit/circuit-json-util';
|
|
13
13
|
import { Matrix } from 'transformation-matrix';
|
|
14
|
-
import { PackSolver2 } from 'calculate-packing';
|
|
15
14
|
import { AutoroutingPipelineSolver, AssignableAutoroutingPipeline2, AssignableAutoroutingPipeline3, AutoroutingPipeline1_OriginalUnravel, AutoroutingPipelineSolver3_HgPortPointPathing, AutoroutingPipelineSolver4, AutoroutingPipelineSolver5, AutoroutingPipelineSolver8, SimplifiedPcbTrace as SimplifiedPcbTrace$1, SimpleRouteJson as SimpleRouteJson$1 } from '@tscircuit/capacity-autorouter';
|
|
16
15
|
import { CopperPourPipelineSolver } from '@tscircuit/copper-pour-solver';
|
|
16
|
+
import { CreateFdmEnclosureSolver, EnclosureApertureInput } from '@tscircuit/create-fdm-enclosure';
|
|
17
17
|
import { SchematicTracePipelineSolver } from '@tscircuit/schematic-trace-solver';
|
|
18
|
+
import { PackSolver2 } from 'calculate-packing';
|
|
18
19
|
import { Bounds } from '@tscircuit/math-utils';
|
|
19
20
|
import { ConnectivityMap } from 'circuit-json-to-connectivity-map';
|
|
20
21
|
import { GraphicsObject } from 'graphics-debug';
|
|
@@ -31,6 +32,7 @@ declare const SOLVERS: {
|
|
|
31
32
|
AutoroutingPipelineSolver7_MultiGraph: typeof AutoroutingPipelineSolver;
|
|
32
33
|
AutoroutingPipelineSolver8: typeof AutoroutingPipelineSolver8;
|
|
33
34
|
CopperPourPipelineSolver: typeof CopperPourPipelineSolver;
|
|
35
|
+
CreateFdmEnclosureSolver: typeof CreateFdmEnclosureSolver;
|
|
34
36
|
SchematicTracePipelineSolver: typeof SchematicTracePipelineSolver;
|
|
35
37
|
};
|
|
36
38
|
type SolverName = keyof typeof SOLVERS;
|
|
@@ -6320,7 +6322,7 @@ declare class Subpanel extends Group<typeof subpanelProps> {
|
|
|
6320
6322
|
topMargin?: string | number | undefined;
|
|
6321
6323
|
bottomMargin?: string | number | undefined;
|
|
6322
6324
|
}>>>;
|
|
6323
|
-
}, "width" | "
|
|
6325
|
+
}, "width" | "height" | "children" | "layoutMode"> & {
|
|
6324
6326
|
width: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
6325
6327
|
height: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
6326
6328
|
children: zod.ZodOptional<zod.ZodAny>;
|
|
@@ -7524,7 +7526,7 @@ declare class Panel extends Subpanel {
|
|
|
7524
7526
|
topMargin?: string | number | undefined;
|
|
7525
7527
|
bottomMargin?: string | number | undefined;
|
|
7526
7528
|
}>>>;
|
|
7527
|
-
}, "width" | "
|
|
7529
|
+
}, "width" | "height" | "children" | "layoutMode"> & {
|
|
7528
7530
|
width: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
7529
7531
|
height: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
7530
7532
|
children: zod.ZodOptional<zod.ZodAny>;
|
|
@@ -90489,6 +90491,98 @@ declare class Cutout extends PrimitiveComponent<typeof cutoutProps> {
|
|
|
90489
90491
|
}): void;
|
|
90490
90492
|
}
|
|
90491
90493
|
|
|
90494
|
+
interface GetFdmEnclosureSolverInputParams {
|
|
90495
|
+
board: Board;
|
|
90496
|
+
pcbBoard: PcbBoard;
|
|
90497
|
+
floorThickness: number;
|
|
90498
|
+
}
|
|
90499
|
+
|
|
90500
|
+
/**
|
|
90501
|
+
* Metadata consumed by enclosure generators. The aperture itself does not emit
|
|
90502
|
+
* Circuit JSON; its nearest ancestor with a pcb_component determines where the
|
|
90503
|
+
* enclosure opening is placed.
|
|
90504
|
+
*/
|
|
90505
|
+
declare class EnclosureCutoutAperture extends PrimitiveComponent<typeof enclosureCutoutApertureProps> {
|
|
90506
|
+
get config(): {
|
|
90507
|
+
componentName: string;
|
|
90508
|
+
zodProps: zod.ZodDiscriminatedUnion<"shape", [zod.ZodObject<{
|
|
90509
|
+
shape: zod.ZodLiteral<"pill">;
|
|
90510
|
+
width: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
90511
|
+
height: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
90512
|
+
} & {
|
|
90513
|
+
margin: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
90514
|
+
}, "strip", zod.ZodTypeAny, {
|
|
90515
|
+
shape: "pill";
|
|
90516
|
+
width: number;
|
|
90517
|
+
height: number;
|
|
90518
|
+
margin?: number | undefined;
|
|
90519
|
+
}, {
|
|
90520
|
+
shape: "pill";
|
|
90521
|
+
width: string | number;
|
|
90522
|
+
height: string | number;
|
|
90523
|
+
margin?: string | number | undefined;
|
|
90524
|
+
}>, zod.ZodObject<{
|
|
90525
|
+
shape: zod.ZodLiteral<"rect">;
|
|
90526
|
+
width: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
90527
|
+
height: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
90528
|
+
} & {
|
|
90529
|
+
margin: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
90530
|
+
}, "strip", zod.ZodTypeAny, {
|
|
90531
|
+
shape: "rect";
|
|
90532
|
+
width: number;
|
|
90533
|
+
height: number;
|
|
90534
|
+
margin?: number | undefined;
|
|
90535
|
+
}, {
|
|
90536
|
+
shape: "rect";
|
|
90537
|
+
width: string | number;
|
|
90538
|
+
height: string | number;
|
|
90539
|
+
margin?: string | number | undefined;
|
|
90540
|
+
}>, zod.ZodObject<{
|
|
90541
|
+
shape: zod.ZodLiteral<"circle">;
|
|
90542
|
+
radius: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
90543
|
+
} & {
|
|
90544
|
+
margin: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
90545
|
+
}, "strip", zod.ZodTypeAny, {
|
|
90546
|
+
shape: "circle";
|
|
90547
|
+
radius: number;
|
|
90548
|
+
margin?: number | undefined;
|
|
90549
|
+
}, {
|
|
90550
|
+
shape: "circle";
|
|
90551
|
+
radius: string | number;
|
|
90552
|
+
margin?: string | number | undefined;
|
|
90553
|
+
}>]>;
|
|
90554
|
+
};
|
|
90555
|
+
getFdmEnclosureSolverInput(params: GetFdmEnclosureSolverInputParams): EnclosureApertureInput;
|
|
90556
|
+
}
|
|
90557
|
+
|
|
90558
|
+
declare class EnclosureFdmBox extends PrimitiveComponent<typeof enclosureFdmBoxProps> {
|
|
90559
|
+
get config(): {
|
|
90560
|
+
componentName: string;
|
|
90561
|
+
zodProps: zod.ZodObject<{
|
|
90562
|
+
boardRef: zod.ZodString;
|
|
90563
|
+
width: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
90564
|
+
height: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
90565
|
+
depth: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
90566
|
+
wallThickness: zod.ZodDefault<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
90567
|
+
}, "strip", zod.ZodTypeAny, {
|
|
90568
|
+
boardRef: string;
|
|
90569
|
+
wallThickness: number;
|
|
90570
|
+
width?: number | undefined;
|
|
90571
|
+
height?: number | undefined;
|
|
90572
|
+
depth?: number | undefined;
|
|
90573
|
+
}, {
|
|
90574
|
+
boardRef: string;
|
|
90575
|
+
width?: string | number | undefined;
|
|
90576
|
+
height?: string | number | undefined;
|
|
90577
|
+
depth?: string | number | undefined;
|
|
90578
|
+
wallThickness?: string | number | undefined;
|
|
90579
|
+
}>;
|
|
90580
|
+
};
|
|
90581
|
+
doInitialSourceRender(): void;
|
|
90582
|
+
doInitialPcbComponentRender(): void;
|
|
90583
|
+
doInitialCadModelRender(): void;
|
|
90584
|
+
}
|
|
90585
|
+
|
|
90492
90586
|
declare class Battery extends NormalComponent<typeof batteryProps, PassivePorts> {
|
|
90493
90587
|
get config(): {
|
|
90494
90588
|
componentName: string;
|
|
@@ -158042,6 +158136,14 @@ declare class SpiceModel extends PrimitiveComponent<typeof spicemodelProps> {
|
|
|
158042
158136
|
private _insertSpiceModelError;
|
|
158043
158137
|
}
|
|
158044
158138
|
|
|
158139
|
+
declare const enclosure: {
|
|
158140
|
+
readonly cutoutaperture: react.FunctionComponent<EnclosureCutoutApertureProps>;
|
|
158141
|
+
readonly fdm: {
|
|
158142
|
+
readonly box: react.FunctionComponent<EnclosureFdmBoxProps>;
|
|
158143
|
+
readonly Box: react.FunctionComponent<EnclosureFdmBoxProps>;
|
|
158144
|
+
};
|
|
158145
|
+
};
|
|
158146
|
+
|
|
158045
158147
|
declare function resolveStaticFileImport(path: string, platform?: PlatformConfig): Promise<string>;
|
|
158046
158148
|
|
|
158047
158149
|
declare class RootCircuit extends IsolatedCircuit {
|
|
@@ -159574,4 +159676,4 @@ declare module "react/jsx-runtime" {
|
|
|
159574
159676
|
}
|
|
159575
159677
|
}
|
|
159576
159678
|
|
|
159577
|
-
export { Ammeter, AnalogSimulation, type AsyncEffect, type AutorouterCompleteEvent, type AutorouterErrorEvent, type AutorouterEvent, type AutorouterProgressEvent, type AutoroutingEndEvent, type AutoroutingErrorEvent, AutoroutingPhase, type AutoroutingProgressEvent, type AutoroutingStartEvent, Battery, Board, Breakout, BreakoutPoint, CadAssembly, CadModel, Capacitor, Chip, Circuit, type ComponentWithPins, Connector, Constraint, CopperPour, CopperText, CourtyardCircle, CourtyardOutline, CourtyardRect, Crystal, CurrentSource, Cutout, type DebugLogOutputEvent, DifferentialPair, Diode, DrcCheck, FabricationNoteDimension, FabricationNotePath, FabricationNoteRect, FabricationNoteText, Breakout as Fanout, BreakoutPoint as FanoutPoint, Fiducial, Footprint, Fuse, type GenericConnectionsAndSelectorsSel, type GenericLocalAutorouter, Group, Hole, type IIsolatedCircuit, type IRenderable, type IRootCircuit, Inductor, Interconnect, InternalCircuit, InternalCircuitMosfet, IsolatedCircuit, Jumper, Keepout, Led, type LocalCacheEngine, Mosfet, MountedBoard, Net, NetLabel, NormalComponent, type Obstacle, OpAmp, type PackingEndEvent, type PackingErrorEvent, type PackingStartEvent, Panel, PcbNoteDimension, PcbNoteLine, PcbNotePath, PcbNoteRect, PcbNoteText, PcbTrace, PcbVia, PinHeader, type PinLabelSpec, Pinout, PlatedHole, Port, Potentiometer, PowerSource, PrimitiveComponent, Project, PushButton, type RenderPhase, type RenderPhaseFn, type RenderPhaseFunctions, type RenderPhaseStates, Renderable, Resistor, Resonator, RootCircuit, type RootCircuitEventName, SOLVERS, SchematicArc, SchematicBox, SchematicCell, SchematicCircle, SchematicLine, SchematicPath, SchematicRect, SchematicRow, SchematicSection, SchematicSheet, SchematicTable, SchematicText, type Sel, SilkscreenCircle, SilkscreenGraphic, SilkscreenLine, SilkscreenPath, SilkscreenRect, SilkscreenText, type SimpleRouteConnection, type SimpleRouteDifferentialPair, type SimpleRouteJson, type SimplifiedPcbTrace, SmtPad, SolderJumper, type SolverName, type SolverStartedEvent, SpiceModel, type SrjConnectionName, Subcircuit, Subpanel, Switch, SymbolComponent as Symbol, TestPoint, Trace, TraceHint, Transistor, Via, VoltageProbe, VoltageSource, applyEditEvents, applyEditEventsToManualEditsFile, applyPcbEditEventsToManualEditsFile, applySchematicEditEventsToManualEditsFile, createUseComponent, getPhaseTimingsFromRenderEvents, getSimpleRouteJsonFromCircuitJson, normalizePinLabels, orderedRenderPhases, renderPhaseIndexMap, resolveStaticFileImport, sel, unrouteCircuitJson, useCapacitor, useChip, useDiode, useLed, useRenderedCircuit, useResistor };
|
|
159679
|
+
export { Ammeter, AnalogSimulation, type AsyncEffect, type AutorouterCompleteEvent, type AutorouterErrorEvent, type AutorouterEvent, type AutorouterProgressEvent, type AutoroutingEndEvent, type AutoroutingErrorEvent, AutoroutingPhase, type AutoroutingProgressEvent, type AutoroutingStartEvent, Battery, Board, Breakout, BreakoutPoint, CadAssembly, CadModel, Capacitor, Chip, Circuit, type ComponentWithPins, Connector, Constraint, CopperPour, CopperText, CourtyardCircle, CourtyardOutline, CourtyardRect, Crystal, CurrentSource, Cutout, type DebugLogOutputEvent, DifferentialPair, Diode, DrcCheck, EnclosureCutoutAperture, EnclosureFdmBox, FabricationNoteDimension, FabricationNotePath, FabricationNoteRect, FabricationNoteText, Breakout as Fanout, BreakoutPoint as FanoutPoint, Fiducial, Footprint, Fuse, type GenericConnectionsAndSelectorsSel, type GenericLocalAutorouter, Group, Hole, type IIsolatedCircuit, type IRenderable, type IRootCircuit, Inductor, Interconnect, InternalCircuit, InternalCircuitMosfet, IsolatedCircuit, Jumper, Keepout, Led, type LocalCacheEngine, Mosfet, MountedBoard, Net, NetLabel, NormalComponent, type Obstacle, OpAmp, type PackingEndEvent, type PackingErrorEvent, type PackingStartEvent, Panel, PcbNoteDimension, PcbNoteLine, PcbNotePath, PcbNoteRect, PcbNoteText, PcbTrace, PcbVia, PinHeader, type PinLabelSpec, Pinout, PlatedHole, Port, Potentiometer, PowerSource, PrimitiveComponent, Project, PushButton, type RenderPhase, type RenderPhaseFn, type RenderPhaseFunctions, type RenderPhaseStates, Renderable, Resistor, Resonator, RootCircuit, type RootCircuitEventName, SOLVERS, SchematicArc, SchematicBox, SchematicCell, SchematicCircle, SchematicLine, SchematicPath, SchematicRect, SchematicRow, SchematicSection, SchematicSheet, SchematicTable, SchematicText, type Sel, SilkscreenCircle, SilkscreenGraphic, SilkscreenLine, SilkscreenPath, SilkscreenRect, SilkscreenText, type SimpleRouteConnection, type SimpleRouteDifferentialPair, type SimpleRouteJson, type SimplifiedPcbTrace, SmtPad, SolderJumper, type SolverName, type SolverStartedEvent, SpiceModel, type SrjConnectionName, Subcircuit, Subpanel, Switch, SymbolComponent as Symbol, TestPoint, Trace, TraceHint, Transistor, Via, VoltageProbe, VoltageSource, applyEditEvents, applyEditEventsToManualEditsFile, applyPcbEditEventsToManualEditsFile, applySchematicEditEventsToManualEditsFile, createUseComponent, enclosure, getPhaseTimingsFromRenderEvents, getSimpleRouteJsonFromCircuitJson, normalizePinLabels, orderedRenderPhases, renderPhaseIndexMap, resolveStaticFileImport, sel, unrouteCircuitJson, useCapacitor, useChip, useDiode, useLed, useRenderedCircuit, useResistor };
|
package/dist/index.js
CHANGED
|
@@ -31,6 +31,8 @@ __export(components_exports, {
|
|
|
31
31
|
DifferentialPair: () => DifferentialPair,
|
|
32
32
|
Diode: () => Diode,
|
|
33
33
|
DrcCheck: () => DrcCheck,
|
|
34
|
+
EnclosureCutoutAperture: () => EnclosureCutoutAperture,
|
|
35
|
+
EnclosureFdmBox: () => EnclosureFdmBox,
|
|
34
36
|
FabricationNoteDimension: () => FabricationNoteDimension,
|
|
35
37
|
FabricationNotePath: () => FabricationNotePath,
|
|
36
38
|
FabricationNoteRect: () => FabricationNoteRect,
|
|
@@ -15750,12 +15752,11 @@ import Debug14 from "debug";
|
|
|
15750
15752
|
import "@tscircuit/capacity-autorouter";
|
|
15751
15753
|
|
|
15752
15754
|
// lib/solvers.ts
|
|
15753
|
-
import { PackSolver2 } from "calculate-packing";
|
|
15754
15755
|
import {
|
|
15755
|
-
AutoroutingPipelineSolver,
|
|
15756
15756
|
AssignableAutoroutingPipeline2,
|
|
15757
|
-
AutoroutingPipeline1_OriginalUnravel,
|
|
15758
15757
|
AssignableAutoroutingPipeline3,
|
|
15758
|
+
AutoroutingPipeline1_OriginalUnravel,
|
|
15759
|
+
AutoroutingPipelineSolver,
|
|
15759
15760
|
AutoroutingPipelineSolver3_HgPortPointPathing,
|
|
15760
15761
|
AutoroutingPipelineSolver4,
|
|
15761
15762
|
AutoroutingPipelineSolver5,
|
|
@@ -15763,7 +15764,9 @@ import {
|
|
|
15763
15764
|
AutoroutingPipelineSolver8
|
|
15764
15765
|
} from "@tscircuit/capacity-autorouter";
|
|
15765
15766
|
import { CopperPourPipelineSolver } from "@tscircuit/copper-pour-solver";
|
|
15767
|
+
import { CreateFdmEnclosureSolver } from "@tscircuit/create-fdm-enclosure";
|
|
15766
15768
|
import { SchematicTracePipelineSolver } from "@tscircuit/schematic-trace-solver";
|
|
15769
|
+
import { PackSolver2 } from "calculate-packing";
|
|
15767
15770
|
var SOLVERS = {
|
|
15768
15771
|
PackSolver2,
|
|
15769
15772
|
AutoroutingPipelineSolver,
|
|
@@ -15776,6 +15779,7 @@ var SOLVERS = {
|
|
|
15776
15779
|
AutoroutingPipelineSolver7_MultiGraph,
|
|
15777
15780
|
AutoroutingPipelineSolver8,
|
|
15778
15781
|
CopperPourPipelineSolver,
|
|
15782
|
+
CreateFdmEnclosureSolver,
|
|
15779
15783
|
SchematicTracePipelineSolver
|
|
15780
15784
|
};
|
|
15781
15785
|
|
|
@@ -19665,7 +19669,15 @@ function getTreeChildChipId(child, index) {
|
|
|
19665
19669
|
}
|
|
19666
19670
|
return null;
|
|
19667
19671
|
}
|
|
19668
|
-
|
|
19672
|
+
var getSchematicComponentForSourceComponent = ({
|
|
19673
|
+
db,
|
|
19674
|
+
sourceComponentId,
|
|
19675
|
+
schematicSheetId
|
|
19676
|
+
}) => db.schematic_component.getWhere({
|
|
19677
|
+
source_component_id: sourceComponentId,
|
|
19678
|
+
...schematicSheetId ? { schematic_sheet_id: schematicSheetId } : {}
|
|
19679
|
+
});
|
|
19680
|
+
function convertTreeToMatchPackInputProblem(tree, db, group, opts = {}) {
|
|
19669
19681
|
const problem = {
|
|
19670
19682
|
chipMap: {},
|
|
19671
19683
|
chipPinMap: {},
|
|
@@ -19699,8 +19711,10 @@ function convertTreeToMatchPackInputProblem(tree, db, group) {
|
|
|
19699
19711
|
}
|
|
19700
19712
|
if (child.nodeType === "component" && child.sourceComponent) {
|
|
19701
19713
|
const chipId = getTreeChildChipId(child, index);
|
|
19702
|
-
const schematicComponent =
|
|
19703
|
-
|
|
19714
|
+
const schematicComponent = getSchematicComponentForSourceComponent({
|
|
19715
|
+
db,
|
|
19716
|
+
sourceComponentId: child.sourceComponent.source_component_id,
|
|
19717
|
+
schematicSheetId: opts.schematicSheetId
|
|
19704
19718
|
});
|
|
19705
19719
|
if (!schematicComponent) return;
|
|
19706
19720
|
const component = group.children.find(
|
|
@@ -19980,7 +19994,7 @@ function convertTreeToMatchPackInputProblem(tree, db, group) {
|
|
|
19980
19994
|
}
|
|
19981
19995
|
return { inputProblem: problem, nestedGroupMatchpackProxyMap };
|
|
19982
19996
|
}
|
|
19983
|
-
function applySchematicMatchPackLayoutToTree(group, tree) {
|
|
19997
|
+
function applySchematicMatchPackLayoutToTree(group, tree, opts = {}) {
|
|
19984
19998
|
const { db } = group.root;
|
|
19985
19999
|
debug6(
|
|
19986
20000
|
`[${group.name}] Starting matchpack layout with ${tree.childNodes.length} children`
|
|
@@ -19993,7 +20007,7 @@ function applySchematicMatchPackLayoutToTree(group, tree) {
|
|
|
19993
20007
|
return;
|
|
19994
20008
|
}
|
|
19995
20009
|
debug6("Converting circuit tree to InputProblem...");
|
|
19996
|
-
const { inputProblem, nestedGroupMatchpackProxyMap } = convertTreeToMatchPackInputProblem(tree, db, group);
|
|
20010
|
+
const { inputProblem, nestedGroupMatchpackProxyMap } = convertTreeToMatchPackInputProblem(tree, db, group, opts);
|
|
19997
20011
|
if (debug6.enabled) {
|
|
19998
20012
|
group.root?.emit("debug:logOutput", {
|
|
19999
20013
|
type: "debug:logOutput",
|
|
@@ -20080,8 +20094,10 @@ function applySchematicMatchPackLayoutToTree(group, tree) {
|
|
|
20080
20094
|
debug6(`Skipping position update for fixed chip ${chipId}`);
|
|
20081
20095
|
continue;
|
|
20082
20096
|
}
|
|
20083
|
-
const schematicComponent =
|
|
20084
|
-
|
|
20097
|
+
const schematicComponent = getSchematicComponentForSourceComponent({
|
|
20098
|
+
db,
|
|
20099
|
+
sourceComponentId: treeNode.sourceComponent.source_component_id,
|
|
20100
|
+
schematicSheetId: opts.schematicSheetId
|
|
20085
20101
|
});
|
|
20086
20102
|
if (schematicComponent) {
|
|
20087
20103
|
debug6(`Moving component ${chipId} to (${newCenter.x}, ${newCenter.y})`);
|
|
@@ -20228,9 +20244,9 @@ function applySchematicMatchPackLayoutToTree(group, tree) {
|
|
|
20228
20244
|
import {
|
|
20229
20245
|
getCircuitJsonTree as getCircuitJsonTree2
|
|
20230
20246
|
} from "@tscircuit/circuit-json-util";
|
|
20231
|
-
function
|
|
20247
|
+
function getSchematicSheetIdBySourceGroupId({
|
|
20232
20248
|
circuitJson,
|
|
20233
|
-
|
|
20249
|
+
schematicSheetIdBySourceComponentId
|
|
20234
20250
|
}) {
|
|
20235
20251
|
const parentBySourceGroupId = /* @__PURE__ */ new Map();
|
|
20236
20252
|
for (const element of circuitJson) {
|
|
@@ -20241,34 +20257,36 @@ function getSchematicSheetIdByGroupId({
|
|
|
20241
20257
|
);
|
|
20242
20258
|
}
|
|
20243
20259
|
}
|
|
20244
|
-
const
|
|
20260
|
+
const schematicSheetIdBySourceGroupId = /* @__PURE__ */ new Map();
|
|
20245
20261
|
for (const element of circuitJson) {
|
|
20246
20262
|
if (element.type !== "source_component") continue;
|
|
20247
20263
|
if (!element.source_group_id) continue;
|
|
20248
|
-
const
|
|
20249
|
-
|
|
20250
|
-
|
|
20251
|
-
|
|
20252
|
-
|
|
20253
|
-
|
|
20264
|
+
const schematicSheetId = schematicSheetIdBySourceComponentId.get(
|
|
20265
|
+
element.source_component_id
|
|
20266
|
+
);
|
|
20267
|
+
if (schematicSheetId === void 0) continue;
|
|
20268
|
+
let sourceGroupId = element.source_group_id;
|
|
20269
|
+
while (sourceGroupId && !schematicSheetIdBySourceGroupId.has(sourceGroupId)) {
|
|
20270
|
+
schematicSheetIdBySourceGroupId.set(sourceGroupId, schematicSheetId);
|
|
20271
|
+
sourceGroupId = parentBySourceGroupId.get(sourceGroupId);
|
|
20254
20272
|
}
|
|
20255
20273
|
}
|
|
20256
|
-
return
|
|
20274
|
+
return schematicSheetIdBySourceGroupId;
|
|
20257
20275
|
}
|
|
20258
20276
|
function getCircuitJsonScopedToSchematicSheet({
|
|
20259
20277
|
circuitJson,
|
|
20260
|
-
|
|
20278
|
+
schematicSheetId,
|
|
20261
20279
|
rootSourceGroupId,
|
|
20262
|
-
|
|
20263
|
-
|
|
20280
|
+
schematicSheetIdBySourceComponentId,
|
|
20281
|
+
schematicSheetIdBySourceGroupId
|
|
20264
20282
|
}) {
|
|
20265
|
-
const isGroupOnSheet = (sourceGroupId) => sourceGroupId === rootSourceGroupId ||
|
|
20283
|
+
const isGroupOnSheet = (sourceGroupId) => sourceGroupId === rootSourceGroupId || schematicSheetIdBySourceGroupId.get(sourceGroupId) === schematicSheetId;
|
|
20266
20284
|
return circuitJson.filter((element) => {
|
|
20267
20285
|
if (element.type === "source_group") {
|
|
20268
20286
|
return isGroupOnSheet(element.source_group_id);
|
|
20269
20287
|
}
|
|
20270
20288
|
if (element.type === "source_component") {
|
|
20271
|
-
if (
|
|
20289
|
+
if (schematicSheetIdBySourceComponentId.get(element.source_component_id) !== schematicSheetId) {
|
|
20272
20290
|
return false;
|
|
20273
20291
|
}
|
|
20274
20292
|
return element.source_group_id ? isGroupOnSheet(element.source_group_id) : true;
|
|
@@ -20278,36 +20296,44 @@ function getCircuitJsonScopedToSchematicSheet({
|
|
|
20278
20296
|
}
|
|
20279
20297
|
function getSchematicCircuitJsonTrees(circuitJson, opts) {
|
|
20280
20298
|
const { source_group_id } = opts;
|
|
20281
|
-
const
|
|
20299
|
+
const schematicSheetIdBySourceComponentId = /* @__PURE__ */ new Map();
|
|
20282
20300
|
for (const element of circuitJson) {
|
|
20283
20301
|
if (element.type !== "schematic_component") continue;
|
|
20284
20302
|
if (!element.source_component_id) continue;
|
|
20285
20303
|
if (!element.schematic_sheet_id) continue;
|
|
20286
|
-
|
|
20304
|
+
schematicSheetIdBySourceComponentId.set(
|
|
20287
20305
|
element.source_component_id,
|
|
20288
20306
|
element.schematic_sheet_id
|
|
20289
20307
|
);
|
|
20290
20308
|
}
|
|
20291
|
-
const
|
|
20292
|
-
|
|
20293
|
-
|
|
20309
|
+
const schematicSheetIds = new Set(
|
|
20310
|
+
schematicSheetIdBySourceComponentId.values()
|
|
20311
|
+
);
|
|
20312
|
+
if (schematicSheetIds.size <= 1) {
|
|
20313
|
+
return [
|
|
20314
|
+
{
|
|
20315
|
+
tree: getCircuitJsonTree2(circuitJson, { source_group_id }),
|
|
20316
|
+
schematicSheetId: schematicSheetIds.values().next().value
|
|
20317
|
+
}
|
|
20318
|
+
];
|
|
20294
20319
|
}
|
|
20295
|
-
const
|
|
20320
|
+
const schematicSheetIdBySourceGroupId = getSchematicSheetIdBySourceGroupId({
|
|
20296
20321
|
circuitJson,
|
|
20297
|
-
|
|
20322
|
+
schematicSheetIdBySourceComponentId
|
|
20298
20323
|
});
|
|
20299
|
-
return Array.from(
|
|
20300
|
-
|
|
20324
|
+
return Array.from(schematicSheetIds).map((schematicSheetId) => ({
|
|
20325
|
+
tree: getCircuitJsonTree2(
|
|
20301
20326
|
getCircuitJsonScopedToSchematicSheet({
|
|
20302
20327
|
circuitJson,
|
|
20303
|
-
|
|
20328
|
+
schematicSheetId,
|
|
20304
20329
|
rootSourceGroupId: source_group_id,
|
|
20305
|
-
|
|
20306
|
-
|
|
20330
|
+
schematicSheetIdBySourceComponentId,
|
|
20331
|
+
schematicSheetIdBySourceGroupId
|
|
20307
20332
|
}),
|
|
20308
20333
|
{ source_group_id }
|
|
20309
|
-
)
|
|
20310
|
-
|
|
20334
|
+
),
|
|
20335
|
+
schematicSheetId
|
|
20336
|
+
}));
|
|
20311
20337
|
}
|
|
20312
20338
|
|
|
20313
20339
|
// lib/components/primitive-components/Group/Group_doInitialSchematicLayoutMatchPack.ts
|
|
@@ -20316,8 +20342,8 @@ function Group_doInitialSchematicLayoutMatchPack(group) {
|
|
|
20316
20342
|
const trees = getSchematicCircuitJsonTrees(db.toArray(), {
|
|
20317
20343
|
source_group_id: group.source_group_id
|
|
20318
20344
|
});
|
|
20319
|
-
for (const tree of trees) {
|
|
20320
|
-
applySchematicMatchPackLayoutToTree(group, tree);
|
|
20345
|
+
for (const { tree, schematicSheetId } of trees) {
|
|
20346
|
+
applySchematicMatchPackLayoutToTree(group, tree, { schematicSheetId });
|
|
20321
20347
|
}
|
|
20322
20348
|
}
|
|
20323
20349
|
|
|
@@ -22889,7 +22915,7 @@ function Group_getRoutingPhasePlans(group) {
|
|
|
22889
22915
|
var package_default = {
|
|
22890
22916
|
name: "@tscircuit/core",
|
|
22891
22917
|
type: "module",
|
|
22892
|
-
version: "0.0.
|
|
22918
|
+
version: "0.0.1475",
|
|
22893
22919
|
types: "dist/index.d.ts",
|
|
22894
22920
|
main: "dist/index.js",
|
|
22895
22921
|
module: "dist/index.js",
|
|
@@ -22927,6 +22953,7 @@ var package_default = {
|
|
|
22927
22953
|
"@tscircuit/circuit-json-util": "^0.0.97",
|
|
22928
22954
|
"@tscircuit/common": "^0.0.20",
|
|
22929
22955
|
"@tscircuit/copper-pour-solver": "0.0.39",
|
|
22956
|
+
"@tscircuit/create-fdm-enclosure": "0.0.2",
|
|
22930
22957
|
"@tscircuit/footprinter": "^0.0.380",
|
|
22931
22958
|
"@tscircuit/image-utils": "^0.0.8",
|
|
22932
22959
|
"@tscircuit/infer-cable-insertion-point": "^0.0.2",
|
|
@@ -22955,7 +22982,7 @@ var package_default = {
|
|
|
22955
22982
|
"circuit-json": "^0.0.450",
|
|
22956
22983
|
"circuit-json-to-bpc": "^0.0.13",
|
|
22957
22984
|
"circuit-json-to-connectivity-map": "^0.0.23",
|
|
22958
|
-
"circuit-json-to-gltf": "^0.0.
|
|
22985
|
+
"circuit-json-to-gltf": "^0.0.107",
|
|
22959
22986
|
"circuit-json-to-spice": "^0.0.43",
|
|
22960
22987
|
"circuit-to-svg": "^0.0.391",
|
|
22961
22988
|
concurrently: "^9.1.2",
|
|
@@ -22984,6 +23011,7 @@ var package_default = {
|
|
|
22984
23011
|
"@tscircuit/capacity-autorouter": "*",
|
|
22985
23012
|
"@tscircuit/checks": "*",
|
|
22986
23013
|
"@tscircuit/circuit-json-util": "*",
|
|
23014
|
+
"@tscircuit/create-fdm-enclosure": "*",
|
|
22987
23015
|
"@tscircuit/footprinter": "*",
|
|
22988
23016
|
"@tscircuit/infgrid-ijump-astar": "*",
|
|
22989
23017
|
"@tscircuit/math-utils": "*",
|
|
@@ -31631,6 +31659,228 @@ var CopperPour = class extends PrimitiveComponent2 {
|
|
|
31631
31659
|
}
|
|
31632
31660
|
};
|
|
31633
31661
|
|
|
31662
|
+
// lib/components/primitive-components/EnclosureCutoutAperture/EnclosureCutoutAperture.ts
|
|
31663
|
+
import { enclosureCutoutApertureProps } from "@tscircuit/props";
|
|
31664
|
+
|
|
31665
|
+
// lib/components/primitive-components/EnclosureCutoutAperture/get-aperture-height.ts
|
|
31666
|
+
var getApertureHeight = (aperture) => {
|
|
31667
|
+
const margin = aperture.margin ?? 0;
|
|
31668
|
+
return aperture.shape === "circle" ? 2 * (aperture.radius + margin) : aperture.height + margin * 2;
|
|
31669
|
+
};
|
|
31670
|
+
|
|
31671
|
+
// lib/components/primitive-components/EnclosureCutoutAperture/get-nearest-board-wall.ts
|
|
31672
|
+
var getNearestBoardWall = ({
|
|
31673
|
+
point: point6,
|
|
31674
|
+
board
|
|
31675
|
+
}) => {
|
|
31676
|
+
const halfWidth = (board.width ?? 0) / 2;
|
|
31677
|
+
const halfHeight = (board.height ?? 0) / 2;
|
|
31678
|
+
const distances = [
|
|
31679
|
+
["left", Math.abs(point6.x - (board.center.x - halfWidth))],
|
|
31680
|
+
["right", Math.abs(point6.x - (board.center.x + halfWidth))],
|
|
31681
|
+
["front", Math.abs(point6.y - (board.center.y - halfHeight))],
|
|
31682
|
+
["back", Math.abs(point6.y - (board.center.y + halfHeight))]
|
|
31683
|
+
];
|
|
31684
|
+
distances.sort((a, b) => a[1] - b[1]);
|
|
31685
|
+
return distances[0][0];
|
|
31686
|
+
};
|
|
31687
|
+
|
|
31688
|
+
// lib/components/primitive-components/EnclosureCutoutAperture/get-solver-wall.ts
|
|
31689
|
+
var getSolverWall = (boardWall) => {
|
|
31690
|
+
if (boardWall === "front") return "back";
|
|
31691
|
+
if (boardWall === "back") return "front";
|
|
31692
|
+
return boardWall;
|
|
31693
|
+
};
|
|
31694
|
+
|
|
31695
|
+
// lib/components/primitive-components/EnclosureCutoutAperture/get-fdm-enclosure-solver-input.ts
|
|
31696
|
+
var getFdmEnclosureSolverInput = (apertureComponent, { board, pcbBoard, floorThickness }) => {
|
|
31697
|
+
let owner = apertureComponent.parent;
|
|
31698
|
+
while (owner && owner !== board && !owner.pcb_component_id) {
|
|
31699
|
+
owner = owner.parent;
|
|
31700
|
+
}
|
|
31701
|
+
const pcbComponent = owner?.pcb_component_id ? apertureComponent.root?.db.pcb_component.get(owner.pcb_component_id) : null;
|
|
31702
|
+
if (!pcbComponent) {
|
|
31703
|
+
throw new Error(
|
|
31704
|
+
"<enclosure.cutoutaperture /> must be nested inside a component with a PCB footprint"
|
|
31705
|
+
);
|
|
31706
|
+
}
|
|
31707
|
+
const point6 = pcbComponent.cable_insertion_center ?? pcbComponent.center;
|
|
31708
|
+
const boardWall = getNearestBoardWall({ point: point6, board: pcbBoard });
|
|
31709
|
+
const aperture = apertureComponent._parsedProps;
|
|
31710
|
+
const commonInput = {
|
|
31711
|
+
wall: getSolverWall(boardWall),
|
|
31712
|
+
offset: boardWall === "left" || boardWall === "right" ? -(point6.y - pcbBoard.center.y) : point6.x - pcbBoard.center.x,
|
|
31713
|
+
centerZ: floorThickness + (pcbBoard.thickness ?? board.boardThickness) + getApertureHeight(aperture) / 2,
|
|
31714
|
+
margin: aperture.margin
|
|
31715
|
+
};
|
|
31716
|
+
switch (aperture.shape) {
|
|
31717
|
+
case "pill":
|
|
31718
|
+
case "rect":
|
|
31719
|
+
return {
|
|
31720
|
+
...commonInput,
|
|
31721
|
+
shape: aperture.shape,
|
|
31722
|
+
width: aperture.width,
|
|
31723
|
+
height: aperture.height
|
|
31724
|
+
};
|
|
31725
|
+
case "circle":
|
|
31726
|
+
return {
|
|
31727
|
+
...commonInput,
|
|
31728
|
+
shape: "circle",
|
|
31729
|
+
radius: aperture.radius
|
|
31730
|
+
};
|
|
31731
|
+
}
|
|
31732
|
+
};
|
|
31733
|
+
|
|
31734
|
+
// lib/components/primitive-components/EnclosureCutoutAperture/EnclosureCutoutAperture.ts
|
|
31735
|
+
var EnclosureCutoutAperture = class extends PrimitiveComponent2 {
|
|
31736
|
+
get config() {
|
|
31737
|
+
return {
|
|
31738
|
+
componentName: "EnclosureCutoutAperture",
|
|
31739
|
+
zodProps: enclosureCutoutApertureProps
|
|
31740
|
+
};
|
|
31741
|
+
}
|
|
31742
|
+
getFdmEnclosureSolverInput(params) {
|
|
31743
|
+
return getFdmEnclosureSolverInput(this, params);
|
|
31744
|
+
}
|
|
31745
|
+
};
|
|
31746
|
+
|
|
31747
|
+
// lib/components/primitive-components/EnclosureFdmBox.ts
|
|
31748
|
+
import { enclosureFdmBoxProps } from "@tscircuit/props";
|
|
31749
|
+
|
|
31750
|
+
// lib/components/primitive-components/EnclosureFdmBox_doInitialCadModelRender.ts
|
|
31751
|
+
import {
|
|
31752
|
+
CreateFdmEnclosureSolver as CreateFdmEnclosureSolver2
|
|
31753
|
+
} from "@tscircuit/create-fdm-enclosure";
|
|
31754
|
+
|
|
31755
|
+
// lib/components/primitive-components/get-referenced-enclosure-board.ts
|
|
31756
|
+
import { selectOne as selectOne2 } from "css-select";
|
|
31757
|
+
var getReferencedEnclosureBoard = (component, boardRef) => {
|
|
31758
|
+
const rootComponent = component.root?.firstChild;
|
|
31759
|
+
const selectedComponent = rootComponent ? selectOne2(boardRef, rootComponent, {
|
|
31760
|
+
adapter: cssSelectPrimitiveComponentAdapter
|
|
31761
|
+
}) : null;
|
|
31762
|
+
const board = selectedComponent instanceof Board ? selectedComponent : [rootComponent, ...rootComponent?.getDescendants() ?? []].find(
|
|
31763
|
+
(descendant) => descendant instanceof Board && descendant.isMatchingNameOrAlias(boardRef)
|
|
31764
|
+
);
|
|
31765
|
+
if (!(board instanceof Board)) {
|
|
31766
|
+
throw new Error(
|
|
31767
|
+
`Could not find a <board /> matching enclosure boardRef "${boardRef}"`
|
|
31768
|
+
);
|
|
31769
|
+
}
|
|
31770
|
+
return board;
|
|
31771
|
+
};
|
|
31772
|
+
|
|
31773
|
+
// lib/components/primitive-components/EnclosureFdmBox_doInitialCadModelRender.ts
|
|
31774
|
+
var EnclosureFdmBox_doInitialCadModelRender = (component) => {
|
|
31775
|
+
const root = component.root;
|
|
31776
|
+
if (!root || root.pcbDisabled || !component.source_component_id || !component.pcb_component_id) {
|
|
31777
|
+
return;
|
|
31778
|
+
}
|
|
31779
|
+
const { db } = root;
|
|
31780
|
+
const props = component._parsedProps;
|
|
31781
|
+
const board = getReferencedEnclosureBoard(component, props.boardRef);
|
|
31782
|
+
const pcbBoard = board.pcb_board_id ? db.pcb_board.get(board.pcb_board_id) : null;
|
|
31783
|
+
if (!pcbBoard?.width || !pcbBoard.height) {
|
|
31784
|
+
throw new Error(
|
|
31785
|
+
`Could not resolve dimensions for boardRef "${props.boardRef}"`
|
|
31786
|
+
);
|
|
31787
|
+
}
|
|
31788
|
+
const boardThickness = pcbBoard.thickness ?? board.boardThickness;
|
|
31789
|
+
const inputProblem = {
|
|
31790
|
+
board: {
|
|
31791
|
+
width: pcbBoard.width,
|
|
31792
|
+
height: pcbBoard.height,
|
|
31793
|
+
thickness: boardThickness
|
|
31794
|
+
},
|
|
31795
|
+
width: props.width,
|
|
31796
|
+
height: props.height,
|
|
31797
|
+
depth: props.depth,
|
|
31798
|
+
wallThickness: props.wallThickness,
|
|
31799
|
+
apertures: board.getDescendants().filter(
|
|
31800
|
+
(descendant) => descendant instanceof EnclosureCutoutAperture
|
|
31801
|
+
).map(
|
|
31802
|
+
(aperture) => aperture.getFdmEnclosureSolverInput({
|
|
31803
|
+
board,
|
|
31804
|
+
pcbBoard,
|
|
31805
|
+
floorThickness: props.wallThickness
|
|
31806
|
+
})
|
|
31807
|
+
)
|
|
31808
|
+
};
|
|
31809
|
+
const solver = new CreateFdmEnclosureSolver2(inputProblem);
|
|
31810
|
+
root.emit("solver:started", {
|
|
31811
|
+
type: "solver:started",
|
|
31812
|
+
solverName: "CreateFdmEnclosureSolver",
|
|
31813
|
+
solverParams: solver.getConstructorParams()[0],
|
|
31814
|
+
componentName: component.getString()
|
|
31815
|
+
});
|
|
31816
|
+
solver.solve();
|
|
31817
|
+
if (solver.failed) {
|
|
31818
|
+
throw new Error(solver.error ?? "Failed to create FDM enclosure");
|
|
31819
|
+
}
|
|
31820
|
+
const output = solver.getOutput();
|
|
31821
|
+
db.pcb_component.update(component.pcb_component_id, {
|
|
31822
|
+
center: pcbBoard.center,
|
|
31823
|
+
width: output.dimensions.width,
|
|
31824
|
+
height: output.dimensions.height
|
|
31825
|
+
});
|
|
31826
|
+
const cadComponent = db.cad_component.insert({
|
|
31827
|
+
position: {
|
|
31828
|
+
x: pcbBoard.center.x,
|
|
31829
|
+
y: pcbBoard.center.y,
|
|
31830
|
+
z: -boardThickness / 2 - output.dimensions.floorThickness
|
|
31831
|
+
},
|
|
31832
|
+
rotation: { x: 0, y: 0, z: 0 },
|
|
31833
|
+
pcb_component_id: component.pcb_component_id,
|
|
31834
|
+
source_component_id: component.source_component_id,
|
|
31835
|
+
model_jscad: output.jscadPlan,
|
|
31836
|
+
model_unit_to_mm_scale_factor: 1,
|
|
31837
|
+
model_object_fit: "contain_within_bounds",
|
|
31838
|
+
model_origin_alignment: "bottom_center_of_component",
|
|
31839
|
+
anchor_alignment: "center",
|
|
31840
|
+
show_as_translucent_model: false
|
|
31841
|
+
});
|
|
31842
|
+
component.cad_component_id = cadComponent.cad_component_id;
|
|
31843
|
+
};
|
|
31844
|
+
|
|
31845
|
+
// lib/components/primitive-components/EnclosureFdmBox.ts
|
|
31846
|
+
var EnclosureFdmBox = class extends PrimitiveComponent2 {
|
|
31847
|
+
get config() {
|
|
31848
|
+
return {
|
|
31849
|
+
componentName: "EnclosureFdmBox",
|
|
31850
|
+
zodProps: enclosureFdmBoxProps
|
|
31851
|
+
};
|
|
31852
|
+
}
|
|
31853
|
+
doInitialSourceRender() {
|
|
31854
|
+
const sourceComponent = this.root.db.source_component.insert({
|
|
31855
|
+
ftype: "simple_chip",
|
|
31856
|
+
name: this.name
|
|
31857
|
+
});
|
|
31858
|
+
this.source_component_id = sourceComponent.source_component_id;
|
|
31859
|
+
}
|
|
31860
|
+
doInitialPcbComponentRender() {
|
|
31861
|
+
const root = this.root;
|
|
31862
|
+
if (!root || root.pcbDisabled || !this.source_component_id) return;
|
|
31863
|
+
const board = getReferencedEnclosureBoard(this, this._parsedProps.boardRef);
|
|
31864
|
+
const pcbBoard = board.pcb_board_id ? root.db.pcb_board.get(board.pcb_board_id) : null;
|
|
31865
|
+
const center = pcbBoard?.center ?? board._getGlobalPcbPositionBeforeLayout();
|
|
31866
|
+
const pcbComponent = root.db.pcb_component.insert({
|
|
31867
|
+
center,
|
|
31868
|
+
width: 0,
|
|
31869
|
+
height: 0,
|
|
31870
|
+
layer: "top",
|
|
31871
|
+
rotation: 0,
|
|
31872
|
+
source_component_id: this.source_component_id,
|
|
31873
|
+
obstructs_within_bounds: false,
|
|
31874
|
+
do_not_place: true,
|
|
31875
|
+
is_allowed_to_be_off_board: true
|
|
31876
|
+
});
|
|
31877
|
+
this.pcb_component_id = pcbComponent.pcb_component_id;
|
|
31878
|
+
}
|
|
31879
|
+
doInitialCadModelRender() {
|
|
31880
|
+
EnclosureFdmBox_doInitialCadModelRender(this);
|
|
31881
|
+
}
|
|
31882
|
+
};
|
|
31883
|
+
|
|
31634
31884
|
// lib/components/normal-components/Battery.ts
|
|
31635
31885
|
import { batteryProps } from "@tscircuit/props";
|
|
31636
31886
|
var Battery = class extends NormalComponent3 {
|
|
@@ -32741,7 +32991,7 @@ var TestPoint = class extends NormalComponent3 {
|
|
|
32741
32991
|
}
|
|
32742
32992
|
};
|
|
32743
32993
|
|
|
32744
|
-
// lib/components/primitive-components/SchematicBox.ts
|
|
32994
|
+
// lib/components/primitive-components/SchematicBox/SchematicBox.ts
|
|
32745
32995
|
import { schematicBoxProps } from "@tscircuit/props";
|
|
32746
32996
|
|
|
32747
32997
|
// lib/components/primitive-components/getTitleAnchorAndPosition.ts
|
|
@@ -32817,7 +33067,7 @@ function getTitleAnchorAndPosition({
|
|
|
32817
33067
|
}
|
|
32818
33068
|
}
|
|
32819
33069
|
|
|
32820
|
-
// lib/components/primitive-components/SchematicBox.ts
|
|
33070
|
+
// lib/components/primitive-components/SchematicBox/SchematicBox.ts
|
|
32821
33071
|
var SchematicBox = class extends PrimitiveComponent2 {
|
|
32822
33072
|
isSchematicPrimitive = true;
|
|
32823
33073
|
get config() {
|
|
@@ -33684,6 +33934,26 @@ var SpiceModel = class extends PrimitiveComponent2 {
|
|
|
33684
33934
|
}
|
|
33685
33935
|
};
|
|
33686
33936
|
|
|
33937
|
+
// lib/namespaced-elements/create-namespaced-element.ts
|
|
33938
|
+
import { createElement } from "react";
|
|
33939
|
+
var createNamespacedElement = (hostType) => {
|
|
33940
|
+
const Component2 = (props) => createElement(hostType, props);
|
|
33941
|
+
Component2.displayName = hostType;
|
|
33942
|
+
return Component2;
|
|
33943
|
+
};
|
|
33944
|
+
|
|
33945
|
+
// lib/namespaced-elements/enclosure.ts
|
|
33946
|
+
var EnclosureFdmBoxElement = createNamespacedElement("enclosure.fdm.box");
|
|
33947
|
+
var enclosure = {
|
|
33948
|
+
cutoutaperture: createNamespacedElement(
|
|
33949
|
+
"enclosure.cutoutaperture"
|
|
33950
|
+
),
|
|
33951
|
+
fdm: {
|
|
33952
|
+
box: EnclosureFdmBoxElement,
|
|
33953
|
+
Box: EnclosureFdmBoxElement
|
|
33954
|
+
}
|
|
33955
|
+
};
|
|
33956
|
+
|
|
33687
33957
|
// lib/RootCircuit.ts
|
|
33688
33958
|
var RootCircuit = class extends IsolatedCircuit {
|
|
33689
33959
|
isRootCircuit = true;
|
|
@@ -33902,13 +34172,15 @@ var sel = new Proxy(
|
|
|
33902
34172
|
);
|
|
33903
34173
|
|
|
33904
34174
|
// lib/index.ts
|
|
33905
|
-
import { createElement } from "react";
|
|
34175
|
+
import { createElement as createElement2 } from "react";
|
|
33906
34176
|
import { kicadFootprintStrings } from "@tscircuit/props";
|
|
33907
34177
|
|
|
33908
34178
|
// lib/register-catalogue.ts
|
|
33909
34179
|
extendCatalogue(components_exports);
|
|
33910
34180
|
extendCatalogue({
|
|
33911
34181
|
Bug: Chip,
|
|
34182
|
+
"enclosure.cutoutaperture": EnclosureCutoutAperture,
|
|
34183
|
+
"enclosure.fdm.box": EnclosureFdmBox,
|
|
33912
34184
|
Fanout: Breakout,
|
|
33913
34185
|
FanoutPoint: BreakoutPoint
|
|
33914
34186
|
});
|
|
@@ -33941,6 +34213,8 @@ export {
|
|
|
33941
34213
|
DifferentialPair,
|
|
33942
34214
|
Diode,
|
|
33943
34215
|
DrcCheck,
|
|
34216
|
+
EnclosureCutoutAperture,
|
|
34217
|
+
EnclosureFdmBox,
|
|
33944
34218
|
FabricationNoteDimension,
|
|
33945
34219
|
FabricationNotePath,
|
|
33946
34220
|
FabricationNoteRect,
|
|
@@ -34024,8 +34298,9 @@ export {
|
|
|
34024
34298
|
applyEditEventsToManualEditsFile,
|
|
34025
34299
|
applyPcbEditEventsToManualEditsFile,
|
|
34026
34300
|
applySchematicEditEventsToManualEditsFile,
|
|
34027
|
-
createElement,
|
|
34301
|
+
createElement2 as createElement,
|
|
34028
34302
|
createUseComponent,
|
|
34303
|
+
enclosure,
|
|
34029
34304
|
getPhaseTimingsFromRenderEvents,
|
|
34030
34305
|
getSimpleRouteJsonFromCircuitJson,
|
|
34031
34306
|
kicadFootprintStrings,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tscircuit/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.1476",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
"@tscircuit/circuit-json-util": "^0.0.97",
|
|
40
40
|
"@tscircuit/common": "^0.0.20",
|
|
41
41
|
"@tscircuit/copper-pour-solver": "0.0.39",
|
|
42
|
+
"@tscircuit/create-fdm-enclosure": "0.0.2",
|
|
42
43
|
"@tscircuit/footprinter": "^0.0.380",
|
|
43
44
|
"@tscircuit/image-utils": "^0.0.8",
|
|
44
45
|
"@tscircuit/infer-cable-insertion-point": "^0.0.2",
|
|
@@ -67,7 +68,7 @@
|
|
|
67
68
|
"circuit-json": "^0.0.450",
|
|
68
69
|
"circuit-json-to-bpc": "^0.0.13",
|
|
69
70
|
"circuit-json-to-connectivity-map": "^0.0.23",
|
|
70
|
-
"circuit-json-to-gltf": "^0.0.
|
|
71
|
+
"circuit-json-to-gltf": "^0.0.107",
|
|
71
72
|
"circuit-json-to-spice": "^0.0.43",
|
|
72
73
|
"circuit-to-svg": "^0.0.391",
|
|
73
74
|
"concurrently": "^9.1.2",
|
|
@@ -96,6 +97,7 @@
|
|
|
96
97
|
"@tscircuit/capacity-autorouter": "*",
|
|
97
98
|
"@tscircuit/checks": "*",
|
|
98
99
|
"@tscircuit/circuit-json-util": "*",
|
|
100
|
+
"@tscircuit/create-fdm-enclosure": "*",
|
|
99
101
|
"@tscircuit/footprinter": "*",
|
|
100
102
|
"@tscircuit/infgrid-ijump-astar": "*",
|
|
101
103
|
"@tscircuit/math-utils": "*",
|