@tscircuit/core 0.0.53 → 0.0.55
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 +83 -3
- package/dist/index.js +83 -19
- package/lib/components/index.ts +2 -0
- package/lib/components/primitive-components/FabricationNotePath.ts +50 -0
- package/lib/components/primitive-components/FabricationNoteText.ts +25 -0
- package/lib/components/primitive-components/Net.ts +1 -1
- package/lib/components/primitive-components/Trace.ts +15 -19
- package/package.json +3 -2
package/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { ReactElement } from 'react';
|
|
|
6
6
|
import { Matrix } from 'transformation-matrix';
|
|
7
7
|
import { SchSymbol, BaseSymbolName } from 'schematic-symbols';
|
|
8
8
|
import * as Props from '@tscircuit/props';
|
|
9
|
-
import { traceProps, groupProps, boardProps, footprintProps, smtPadProps, resistorProps, ledProps, diodeProps, capacitorProps, traceHintProps, chipProps, jumperProps, silkscreenPathProps, platedHoleProps, constraintProps, holeProps, silkscreenTextProps, pcbKeepoutProps } from '@tscircuit/props';
|
|
9
|
+
import { traceProps, groupProps, boardProps, footprintProps, smtPadProps, resistorProps, ledProps, diodeProps, capacitorProps, traceHintProps, chipProps, jumperProps, silkscreenPathProps, platedHoleProps, constraintProps, holeProps, silkscreenTextProps, pcbKeepoutProps, fabricationNoteTextProps, fabricationNotePathProps } from '@tscircuit/props';
|
|
10
10
|
|
|
11
11
|
declare class Circuit {
|
|
12
12
|
firstChild: PrimitiveComponent | null;
|
|
@@ -244,7 +244,7 @@ declare const netProps: z.ZodObject<{
|
|
|
244
244
|
declare class Net extends PrimitiveComponent<typeof netProps> {
|
|
245
245
|
source_net_id?: string;
|
|
246
246
|
getPortSelector(): string;
|
|
247
|
-
|
|
247
|
+
doInitialSourceRender(): void;
|
|
248
248
|
/**
|
|
249
249
|
* Get all ports connected to this net.
|
|
250
250
|
*
|
|
@@ -4106,6 +4106,86 @@ declare class Keepout extends PrimitiveComponent<typeof pcbKeepoutProps> {
|
|
|
4106
4106
|
doInitialPcbPrimitiveRender(): void;
|
|
4107
4107
|
}
|
|
4108
4108
|
|
|
4109
|
+
declare class FabricationNoteText extends PrimitiveComponent<typeof fabricationNoteTextProps> {
|
|
4110
|
+
doInitialPcbPrimitiveRender(): void;
|
|
4111
|
+
}
|
|
4112
|
+
|
|
4113
|
+
declare class FabricationNotePath extends PrimitiveComponent<typeof fabricationNotePathProps> {
|
|
4114
|
+
fabrication_note_path_id: string | null;
|
|
4115
|
+
get config(): {
|
|
4116
|
+
zodProps: zod.ZodObject<zod.objectUtil.extendShape<Omit<{
|
|
4117
|
+
pcbX: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
4118
|
+
pcbY: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
4119
|
+
pcbRotation: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
4120
|
+
layer: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodEnum<["top", "bottom", "inner1", "inner2", "inner3", "inner4", "inner5", "inner6"]>, zod.ZodObject<{
|
|
4121
|
+
name: zod.ZodEnum<["top", "bottom", "inner1", "inner2", "inner3", "inner4", "inner5", "inner6"]>;
|
|
4122
|
+
}, "strip", zod.ZodTypeAny, {
|
|
4123
|
+
name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
|
|
4124
|
+
}, {
|
|
4125
|
+
name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
|
|
4126
|
+
}>]>, "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6", "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | {
|
|
4127
|
+
name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
|
|
4128
|
+
}>>;
|
|
4129
|
+
}, "pcbRotation" | "pcbX" | "pcbY">, {
|
|
4130
|
+
route: zod.ZodArray<zod.ZodObject<{
|
|
4131
|
+
x: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
4132
|
+
y: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
4133
|
+
via: zod.ZodOptional<zod.ZodBoolean>;
|
|
4134
|
+
to_layer: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodEnum<["top", "bottom", "inner1", "inner2", "inner3", "inner4", "inner5", "inner6"]>, zod.ZodObject<{
|
|
4135
|
+
name: zod.ZodEnum<["top", "bottom", "inner1", "inner2", "inner3", "inner4", "inner5", "inner6"]>;
|
|
4136
|
+
}, "strip", zod.ZodTypeAny, {
|
|
4137
|
+
name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
|
|
4138
|
+
}, {
|
|
4139
|
+
name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
|
|
4140
|
+
}>]>, "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6", "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | {
|
|
4141
|
+
name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
|
|
4142
|
+
}>>;
|
|
4143
|
+
trace_width: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
4144
|
+
}, "strip", zod.ZodTypeAny, {
|
|
4145
|
+
x: number;
|
|
4146
|
+
y: number;
|
|
4147
|
+
trace_width?: number | undefined;
|
|
4148
|
+
via?: boolean | undefined;
|
|
4149
|
+
to_layer?: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | undefined;
|
|
4150
|
+
}, {
|
|
4151
|
+
x: string | number;
|
|
4152
|
+
y: string | number;
|
|
4153
|
+
trace_width?: string | number | undefined;
|
|
4154
|
+
via?: boolean | undefined;
|
|
4155
|
+
to_layer?: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | {
|
|
4156
|
+
name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
|
|
4157
|
+
} | undefined;
|
|
4158
|
+
}>, "many">;
|
|
4159
|
+
strokeWidth: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
4160
|
+
}>, "strip", zod.ZodTypeAny, {
|
|
4161
|
+
route: {
|
|
4162
|
+
x: number;
|
|
4163
|
+
y: number;
|
|
4164
|
+
trace_width?: number | undefined;
|
|
4165
|
+
via?: boolean | undefined;
|
|
4166
|
+
to_layer?: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | undefined;
|
|
4167
|
+
}[];
|
|
4168
|
+
layer?: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | undefined;
|
|
4169
|
+
strokeWidth?: number | undefined;
|
|
4170
|
+
}, {
|
|
4171
|
+
route: {
|
|
4172
|
+
x: string | number;
|
|
4173
|
+
y: string | number;
|
|
4174
|
+
trace_width?: string | number | undefined;
|
|
4175
|
+
via?: boolean | undefined;
|
|
4176
|
+
to_layer?: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | {
|
|
4177
|
+
name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
|
|
4178
|
+
} | undefined;
|
|
4179
|
+
}[];
|
|
4180
|
+
layer?: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | {
|
|
4181
|
+
name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
|
|
4182
|
+
} | undefined;
|
|
4183
|
+
strokeWidth?: string | number | undefined;
|
|
4184
|
+
}>;
|
|
4185
|
+
};
|
|
4186
|
+
doInitialPcbPrimitiveRender(): void;
|
|
4187
|
+
}
|
|
4188
|
+
|
|
4109
4189
|
declare global {
|
|
4110
4190
|
namespace JSX {
|
|
4111
4191
|
interface IntrinsicElements {
|
|
@@ -4152,4 +4232,4 @@ declare global {
|
|
|
4152
4232
|
}
|
|
4153
4233
|
}
|
|
4154
4234
|
|
|
4155
|
-
export { Board, Capacitor, Chip, Circuit, Constraint, Diode, Footprint, Group, Hole, type IRenderable, Jumper, Keepout, Led, Net, NormalComponent, PlatedHole, Port, PrimitiveComponent, Project, Renderable, Resistor, SilkscreenPath, SilkscreenText, SmtPad, Trace, TraceHint };
|
|
4235
|
+
export { Board, Capacitor, Chip, Circuit, Constraint, Diode, FabricationNotePath, FabricationNoteText, Footprint, Group, Hole, type IRenderable, Jumper, Keepout, Led, Net, NormalComponent, PlatedHole, Port, PrimitiveComponent, Project, Renderable, Resistor, SilkscreenPath, SilkscreenText, SmtPad, Trace, TraceHint };
|
package/dist/index.js
CHANGED
|
@@ -12,6 +12,8 @@ __export(components_exports, {
|
|
|
12
12
|
Chip: () => Chip,
|
|
13
13
|
Constraint: () => Constraint2,
|
|
14
14
|
Diode: () => Diode,
|
|
15
|
+
FabricationNotePath: () => FabricationNotePath,
|
|
16
|
+
FabricationNoteText: () => FabricationNoteText,
|
|
15
17
|
Footprint: () => Footprint,
|
|
16
18
|
Group: () => Group,
|
|
17
19
|
Hole: () => Hole,
|
|
@@ -1489,7 +1491,7 @@ var Net = class extends PrimitiveComponent {
|
|
|
1489
1491
|
getPortSelector() {
|
|
1490
1492
|
return `net.${this.props.name}`;
|
|
1491
1493
|
}
|
|
1492
|
-
|
|
1494
|
+
doInitialSourceRender() {
|
|
1493
1495
|
const { db } = this.root;
|
|
1494
1496
|
const { _parsedProps: props } = this;
|
|
1495
1497
|
const net = db.source_net.insert({
|
|
@@ -2074,8 +2076,7 @@ import "zod";
|
|
|
2074
2076
|
import { traceProps } from "@tscircuit/props";
|
|
2075
2077
|
import {
|
|
2076
2078
|
IJumpAutorouter,
|
|
2077
|
-
getObstaclesFromSoup
|
|
2078
|
-
markObstaclesAsConnected
|
|
2079
|
+
getObstaclesFromSoup
|
|
2079
2080
|
} from "@tscircuit/infgrid-ijump-astar";
|
|
2080
2081
|
|
|
2081
2082
|
// lib/utils/autorouting/computeObstacleBounds.ts
|
|
@@ -2234,6 +2235,7 @@ function tryNow(fn) {
|
|
|
2234
2235
|
}
|
|
2235
2236
|
|
|
2236
2237
|
// lib/components/primitive-components/Trace.ts
|
|
2238
|
+
import { getFullConnectivityMapFromCircuitJson } from "circuit-json-to-connectivity-map";
|
|
2237
2239
|
var portToObjective = (port) => {
|
|
2238
2240
|
const portPosition = port._getGlobalPcbPositionAfterLayout();
|
|
2239
2241
|
return {
|
|
@@ -2458,14 +2460,17 @@ searched component ${targetComponent.getString()}, which has ports: ${targetComp
|
|
|
2458
2460
|
);
|
|
2459
2461
|
return;
|
|
2460
2462
|
}
|
|
2461
|
-
const
|
|
2463
|
+
const connMap = getFullConnectivityMapFromCircuitJson(
|
|
2464
|
+
this.root.db.toArray()
|
|
2465
|
+
);
|
|
2466
|
+
const [obstacles, errGettingObstacles] = tryNow(
|
|
2462
2467
|
() => getObstaclesFromSoup(this.root.db.toArray())
|
|
2463
2468
|
);
|
|
2464
|
-
if (
|
|
2469
|
+
if (errGettingObstacles) {
|
|
2465
2470
|
this.renderError({
|
|
2466
2471
|
type: "pcb_error",
|
|
2467
2472
|
error_type: "pcb_trace_error",
|
|
2468
|
-
message: `Error getting obstacles for autorouting: ${
|
|
2473
|
+
message: `Error getting obstacles for autorouting: ${errGettingObstacles.message}`,
|
|
2469
2474
|
source_trace_id: this.source_trace_id,
|
|
2470
2475
|
center: { x: 0, y: 0 },
|
|
2471
2476
|
pcb_port_ids: ports.map((p) => p.pcb_port_id),
|
|
@@ -2474,19 +2479,13 @@ searched component ${targetComponent.getString()}, which has ports: ${targetComp
|
|
|
2474
2479
|
});
|
|
2475
2480
|
return;
|
|
2476
2481
|
}
|
|
2477
|
-
markObstaclesAsConnected(
|
|
2478
|
-
obstacles,
|
|
2479
|
-
orderedRouteObjectives,
|
|
2480
|
-
this.source_trace_id
|
|
2481
|
-
);
|
|
2482
|
-
const allConnectedTraceIds = this._getAllTracesConnectedToSameNet().map(
|
|
2483
|
-
(t) => t.source_trace_id
|
|
2484
|
-
);
|
|
2485
2482
|
for (const obstacle of obstacles) {
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2483
|
+
const connectedTo = obstacle.connectedTo;
|
|
2484
|
+
if (connectedTo.length > 0) {
|
|
2485
|
+
const netId = connMap.getNetConnectedToId(obstacle.connectedTo[0]);
|
|
2486
|
+
if (netId) {
|
|
2487
|
+
obstacle.connectedTo.push(netId);
|
|
2488
|
+
}
|
|
2490
2489
|
}
|
|
2491
2490
|
}
|
|
2492
2491
|
const candidateLayerSelections = candidateLayerCombinations[0].layer_path;
|
|
@@ -2509,7 +2508,7 @@ searched component ${targetComponent.getString()}, which has ports: ${targetComp
|
|
|
2509
2508
|
obstacles,
|
|
2510
2509
|
connections: [
|
|
2511
2510
|
{
|
|
2512
|
-
name: this.source_trace_id,
|
|
2511
|
+
name: connMap.getNetConnectedToId(this.source_trace_id),
|
|
2513
2512
|
pointsToConnect: [
|
|
2514
2513
|
{ ...a, layer: dominantLayer ?? "top" },
|
|
2515
2514
|
{ ...b, layer: dominantLayer ?? "top" }
|
|
@@ -3369,6 +3368,69 @@ var SilkscreenText = class extends PrimitiveComponent {
|
|
|
3369
3368
|
}
|
|
3370
3369
|
};
|
|
3371
3370
|
|
|
3371
|
+
// lib/components/primitive-components/FabricationNoteText.ts
|
|
3372
|
+
import "@tscircuit/props";
|
|
3373
|
+
var FabricationNoteText = class extends PrimitiveComponent {
|
|
3374
|
+
doInitialPcbPrimitiveRender() {
|
|
3375
|
+
const { db } = this.root;
|
|
3376
|
+
const { _parsedProps: props } = this;
|
|
3377
|
+
const container = this.getPrimitiveContainer();
|
|
3378
|
+
db.pcb_fabrication_note_text.insert({
|
|
3379
|
+
anchor_alignment: props.anchorAlignment,
|
|
3380
|
+
anchor_position: {
|
|
3381
|
+
x: props.pcbX ?? 0,
|
|
3382
|
+
y: props.pcbY ?? 0
|
|
3383
|
+
},
|
|
3384
|
+
font: props.font ?? "tscircuit2024",
|
|
3385
|
+
font_size: props.fontSize ?? 1,
|
|
3386
|
+
layer: "top",
|
|
3387
|
+
text: props.text ?? "",
|
|
3388
|
+
pcb_component_id: container.pcb_component_id
|
|
3389
|
+
});
|
|
3390
|
+
}
|
|
3391
|
+
};
|
|
3392
|
+
|
|
3393
|
+
// lib/components/primitive-components/FabricationNotePath.ts
|
|
3394
|
+
import { fabricationNotePathProps } from "@tscircuit/props";
|
|
3395
|
+
import { applyToPoint as applyToPoint5 } from "transformation-matrix";
|
|
3396
|
+
var FabricationNotePath = class extends PrimitiveComponent {
|
|
3397
|
+
fabrication_note_path_id = null;
|
|
3398
|
+
get config() {
|
|
3399
|
+
return {
|
|
3400
|
+
zodProps: fabricationNotePathProps
|
|
3401
|
+
};
|
|
3402
|
+
}
|
|
3403
|
+
doInitialPcbPrimitiveRender() {
|
|
3404
|
+
const { db } = this.root;
|
|
3405
|
+
const { _parsedProps: props } = this;
|
|
3406
|
+
const layer = props.layer ?? "top";
|
|
3407
|
+
if (layer !== "top" && layer !== "bottom") {
|
|
3408
|
+
throw new Error(
|
|
3409
|
+
`Invalid layer "${layer}" for SilkscreenPath. Must be "top" or "bottom".`
|
|
3410
|
+
);
|
|
3411
|
+
}
|
|
3412
|
+
const transform = this._computePcbGlobalTransformBeforeLayout();
|
|
3413
|
+
const fabrication_note_path = db.pcb_fabrication_note_path.insert({
|
|
3414
|
+
pcb_component_id: this.parent?.pcb_component_id,
|
|
3415
|
+
layer,
|
|
3416
|
+
route: props.route.map((p) => {
|
|
3417
|
+
const transformedPosition = applyToPoint5(transform, {
|
|
3418
|
+
x: p.x,
|
|
3419
|
+
y: p.y
|
|
3420
|
+
});
|
|
3421
|
+
return {
|
|
3422
|
+
...p,
|
|
3423
|
+
x: transformedPosition.x,
|
|
3424
|
+
y: transformedPosition.y
|
|
3425
|
+
};
|
|
3426
|
+
}),
|
|
3427
|
+
stroke_width: props.strokeWidth ?? 0.1,
|
|
3428
|
+
fabrication_note_path_id: `fabrication_note_${Math.random().toString()}`
|
|
3429
|
+
});
|
|
3430
|
+
this.fabrication_note_path_id = fabrication_note_path.fabrication_note_path_id;
|
|
3431
|
+
}
|
|
3432
|
+
};
|
|
3433
|
+
|
|
3372
3434
|
// lib/Project.ts
|
|
3373
3435
|
import { su } from "@tscircuit/soup-util";
|
|
3374
3436
|
import { isValidElement as isValidElement2 } from "react";
|
|
@@ -3474,6 +3536,8 @@ export {
|
|
|
3474
3536
|
Circuit,
|
|
3475
3537
|
Constraint2 as Constraint,
|
|
3476
3538
|
Diode,
|
|
3539
|
+
FabricationNotePath,
|
|
3540
|
+
FabricationNoteText,
|
|
3477
3541
|
Footprint,
|
|
3478
3542
|
Group,
|
|
3479
3543
|
Hole,
|
package/lib/components/index.ts
CHANGED
|
@@ -21,3 +21,5 @@ export { Constraint } from "./primitive-components/Constraint"
|
|
|
21
21
|
export { Hole } from "./primitive-components/Hole"
|
|
22
22
|
export { SilkscreenText } from "./primitive-components/SilkscreenText"
|
|
23
23
|
export { Keepout } from "./primitive-components/Keepout"
|
|
24
|
+
export { FabricationNoteText } from "./primitive-components/FabricationNoteText"
|
|
25
|
+
export { FabricationNotePath } from "./primitive-components/FabricationNotePath"
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { fabricationNotePathProps } from "@tscircuit/props"
|
|
2
|
+
import { PrimitiveComponent } from "../base-components/PrimitiveComponent"
|
|
3
|
+
import { applyToPoint } from "transformation-matrix"
|
|
4
|
+
|
|
5
|
+
export class FabricationNotePath extends PrimitiveComponent<
|
|
6
|
+
typeof fabricationNotePathProps
|
|
7
|
+
> {
|
|
8
|
+
fabrication_note_path_id: string | null = null
|
|
9
|
+
|
|
10
|
+
get config() {
|
|
11
|
+
return {
|
|
12
|
+
zodProps: fabricationNotePathProps,
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
doInitialPcbPrimitiveRender(): void {
|
|
17
|
+
const { db } = this.root!
|
|
18
|
+
const { _parsedProps: props } = this
|
|
19
|
+
|
|
20
|
+
const layer = props.layer ?? "top"
|
|
21
|
+
if (layer !== "top" && layer !== "bottom") {
|
|
22
|
+
throw new Error(
|
|
23
|
+
`Invalid layer "${layer}" for SilkscreenPath. Must be "top" or "bottom".`,
|
|
24
|
+
)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const transform = this._computePcbGlobalTransformBeforeLayout()
|
|
28
|
+
|
|
29
|
+
const fabrication_note_path = db.pcb_fabrication_note_path.insert({
|
|
30
|
+
pcb_component_id: this.parent?.pcb_component_id!,
|
|
31
|
+
layer,
|
|
32
|
+
route: props.route.map((p) => {
|
|
33
|
+
const transformedPosition = applyToPoint(transform, {
|
|
34
|
+
x: p.x,
|
|
35
|
+
y: p.y,
|
|
36
|
+
})
|
|
37
|
+
return {
|
|
38
|
+
...p,
|
|
39
|
+
x: transformedPosition.x,
|
|
40
|
+
y: transformedPosition.y,
|
|
41
|
+
}
|
|
42
|
+
}),
|
|
43
|
+
stroke_width: props.strokeWidth ?? 0.1,
|
|
44
|
+
fabrication_note_path_id: `fabrication_note_${Math.random().toString()}`,
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
this.fabrication_note_path_id =
|
|
48
|
+
fabrication_note_path.fabrication_note_path_id
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { PrimitiveComponent } from "../base-components/PrimitiveComponent"
|
|
2
|
+
import { fabricationNoteTextProps } from "@tscircuit/props"
|
|
3
|
+
|
|
4
|
+
export class FabricationNoteText extends PrimitiveComponent<
|
|
5
|
+
typeof fabricationNoteTextProps
|
|
6
|
+
> {
|
|
7
|
+
doInitialPcbPrimitiveRender(): void {
|
|
8
|
+
const { db } = this.root!
|
|
9
|
+
const { _parsedProps: props } = this
|
|
10
|
+
const container = this.getPrimitiveContainer()!
|
|
11
|
+
|
|
12
|
+
db.pcb_fabrication_note_text.insert({
|
|
13
|
+
anchor_alignment: props.anchorAlignment,
|
|
14
|
+
anchor_position: {
|
|
15
|
+
x: props.pcbX ?? 0,
|
|
16
|
+
y: props.pcbY ?? 0,
|
|
17
|
+
},
|
|
18
|
+
font: props.font ?? "tscircuit2024",
|
|
19
|
+
font_size: props.fontSize ?? 1,
|
|
20
|
+
layer: "top",
|
|
21
|
+
text: props.text ?? "",
|
|
22
|
+
pcb_component_id: container.pcb_component_id!,
|
|
23
|
+
})
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -39,6 +39,7 @@ import {
|
|
|
39
39
|
isMatchingSelector,
|
|
40
40
|
} from "lib/utils/selector-matching"
|
|
41
41
|
import { tryNow } from "lib/utils/try-now"
|
|
42
|
+
import { getFullConnectivityMapFromCircuitJson } from "circuit-json-to-connectivity-map"
|
|
42
43
|
|
|
43
44
|
type PcbRouteObjective =
|
|
44
45
|
| RouteHintPoint
|
|
@@ -356,17 +357,21 @@ export class Trace extends PrimitiveComponent<typeof traceProps> {
|
|
|
356
357
|
return
|
|
357
358
|
}
|
|
358
359
|
|
|
360
|
+
const connMap = getFullConnectivityMapFromCircuitJson(
|
|
361
|
+
this.root!.db.toArray(),
|
|
362
|
+
)
|
|
363
|
+
|
|
359
364
|
// Cache the PCB obstacles, they'll be needed for each segment between
|
|
360
365
|
// ports/hints
|
|
361
|
-
const [obstacles,
|
|
366
|
+
const [obstacles, errGettingObstacles] = tryNow(() =>
|
|
362
367
|
getObstaclesFromSoup(this.root!.db.toArray()),
|
|
363
368
|
)
|
|
364
369
|
|
|
365
|
-
if (
|
|
370
|
+
if (errGettingObstacles) {
|
|
366
371
|
this.renderError({
|
|
367
372
|
type: "pcb_error",
|
|
368
373
|
error_type: "pcb_trace_error",
|
|
369
|
-
message: `Error getting obstacles for autorouting: ${
|
|
374
|
+
message: `Error getting obstacles for autorouting: ${errGettingObstacles.message}`,
|
|
370
375
|
source_trace_id: this.source_trace_id!,
|
|
371
376
|
center: { x: 0, y: 0 },
|
|
372
377
|
pcb_port_ids: ports.map((p) => p.pcb_port_id!),
|
|
@@ -376,22 +381,13 @@ export class Trace extends PrimitiveComponent<typeof traceProps> {
|
|
|
376
381
|
return
|
|
377
382
|
}
|
|
378
383
|
|
|
379
|
-
markObstaclesAsConnected(
|
|
380
|
-
obstacles,
|
|
381
|
-
orderedRouteObjectives,
|
|
382
|
-
this.source_trace_id!,
|
|
383
|
-
)
|
|
384
|
-
|
|
385
|
-
const allConnectedTraceIds = this._getAllTracesConnectedToSameNet().map(
|
|
386
|
-
(t) => t.source_trace_id,
|
|
387
|
-
)
|
|
388
384
|
for (const obstacle of obstacles) {
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
)
|
|
393
|
-
|
|
394
|
-
|
|
385
|
+
const connectedTo = obstacle.connectedTo
|
|
386
|
+
if (connectedTo.length > 0) {
|
|
387
|
+
const netId = connMap.getNetConnectedToId(obstacle.connectedTo[0])
|
|
388
|
+
if (netId) {
|
|
389
|
+
obstacle.connectedTo.push(netId)
|
|
390
|
+
}
|
|
395
391
|
}
|
|
396
392
|
}
|
|
397
393
|
|
|
@@ -424,7 +420,7 @@ export class Trace extends PrimitiveComponent<typeof traceProps> {
|
|
|
424
420
|
obstacles,
|
|
425
421
|
connections: [
|
|
426
422
|
{
|
|
427
|
-
name: this.source_trace_id!,
|
|
423
|
+
name: connMap.getNetConnectedToId(this.source_trace_id!)!,
|
|
428
424
|
pointsToConnect: [
|
|
429
425
|
{ ...a, layer: dominantLayer ?? "top" },
|
|
430
426
|
{ ...b, layer: dominantLayer ?? "top" },
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@tscircuit/core",
|
|
3
3
|
"module": "index.ts",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "0.0.
|
|
5
|
+
"version": "0.0.55",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"files": [
|
|
@@ -34,10 +34,11 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@lume/kiwi": "^0.4.3",
|
|
37
|
-
"@tscircuit/infgrid-ijump-astar": "^0.0.
|
|
37
|
+
"@tscircuit/infgrid-ijump-astar": "^0.0.13",
|
|
38
38
|
"@tscircuit/props": "^0.0.62",
|
|
39
39
|
"@tscircuit/soup": "^0.0.67",
|
|
40
40
|
"@tscircuit/soup-util": "^0.0.23",
|
|
41
|
+
"circuit-json-to-connectivity-map": "^0.0.8",
|
|
41
42
|
"footprinter": "^0.0.44",
|
|
42
43
|
"react": "^18.3.1",
|
|
43
44
|
"react-reconciler": "^0.29.2",
|