easyeda 0.0.356 → 0.0.358
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/browser/index.js +406 -53
- package/dist/browser/index.js.map +1 -1
- package/dist/index.js +559 -206
- package/dist/index.js.map +1 -1
- package/dist/main.cjs +560 -207
- package/dist/main.cjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4,6 +4,121 @@ var __export = (target, all) => {
|
|
|
4
4
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
5
5
|
};
|
|
6
6
|
|
|
7
|
+
// node_modules/@tscircuit/math-utils/dist/chunk-EFLPMB4J.js
|
|
8
|
+
function orientation(p, q, r) {
|
|
9
|
+
const val = (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);
|
|
10
|
+
if (val === 0) return 0;
|
|
11
|
+
return val > 0 ? 1 : 2;
|
|
12
|
+
}
|
|
13
|
+
function distance(p1, p2) {
|
|
14
|
+
const dx = p1.x - p2.x;
|
|
15
|
+
const dy = p1.y - p2.y;
|
|
16
|
+
return Math.sqrt(dx * dx + dy * dy);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// node_modules/@tscircuit/math-utils/dist/chunk-GIGMPRPV.js
|
|
20
|
+
var getUnitVectorFromDirection = (direction) => {
|
|
21
|
+
switch (direction) {
|
|
22
|
+
case "up":
|
|
23
|
+
return { x: 0, y: 1 };
|
|
24
|
+
case "down":
|
|
25
|
+
return { x: 0, y: -1 };
|
|
26
|
+
case "left":
|
|
27
|
+
return { x: -1, y: 0 };
|
|
28
|
+
case "right":
|
|
29
|
+
return { x: 1, y: 0 };
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
// node_modules/@tscircuit/math-utils/dist/chunk-3WCUPG5S.js
|
|
34
|
+
var getBoundsCenter = (bounds) => ({
|
|
35
|
+
x: (bounds.minX + bounds.maxX) / 2,
|
|
36
|
+
y: (bounds.minY + bounds.maxY) / 2
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
// node_modules/@tscircuit/math-utils/dist/chunk-5N7UJNVK.js
|
|
40
|
+
var getBoundsFromPoints = (points) => {
|
|
41
|
+
if (points.length === 0) {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
let minX = points[0].x;
|
|
45
|
+
let minY = points[0].y;
|
|
46
|
+
let maxX = points[0].x;
|
|
47
|
+
let maxY = points[0].y;
|
|
48
|
+
for (let i = 1; i < points.length; i++) {
|
|
49
|
+
const point2 = points[i];
|
|
50
|
+
if (point2.x < minX) minX = point2.x;
|
|
51
|
+
if (point2.y < minY) minY = point2.y;
|
|
52
|
+
if (point2.x > maxX) maxX = point2.x;
|
|
53
|
+
if (point2.y > maxY) maxY = point2.y;
|
|
54
|
+
}
|
|
55
|
+
return { minX, minY, maxX, maxY };
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
// lib/utils/get-board-outline-polygons.ts
|
|
59
|
+
var same = (a, b) => distance(a, b) < 1e-4;
|
|
60
|
+
var getBoardOutlinePolygons = (tracks) => {
|
|
61
|
+
const remainingEdges = tracks.flatMap(
|
|
62
|
+
(track) => track.points.slice(1).map((point2, i) => [track.points[i], point2])
|
|
63
|
+
).filter(([a, b]) => !same(a, b));
|
|
64
|
+
const polygons = [];
|
|
65
|
+
while (remainingEdges.length) {
|
|
66
|
+
const edges = [remainingEdges.shift()];
|
|
67
|
+
while (true) {
|
|
68
|
+
const index = remainingEdges.findIndex(
|
|
69
|
+
(edge) => edge.some((p) => edges.flat().some((q) => same(p, q)))
|
|
70
|
+
);
|
|
71
|
+
if (index === -1) break;
|
|
72
|
+
edges.push(remainingEdges.splice(index, 1)[0]);
|
|
73
|
+
}
|
|
74
|
+
const endpoints = edges.flat();
|
|
75
|
+
if (endpoints.some((p) => endpoints.filter((q) => same(p, q)).length > 2))
|
|
76
|
+
continue;
|
|
77
|
+
const route = edges.shift();
|
|
78
|
+
let changed = true;
|
|
79
|
+
while (changed) {
|
|
80
|
+
changed = false;
|
|
81
|
+
for (let i = 0; i < edges.length; i++) {
|
|
82
|
+
const [a, b] = edges[i];
|
|
83
|
+
if (same(route.at(-1), a)) route.push(b);
|
|
84
|
+
else if (same(route.at(-1), b)) route.push(a);
|
|
85
|
+
else if (same(route[0], b)) route.unshift(a);
|
|
86
|
+
else if (same(route[0], a)) route.unshift(b);
|
|
87
|
+
else continue;
|
|
88
|
+
edges.splice(i, 1);
|
|
89
|
+
changed = true;
|
|
90
|
+
break;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
if (same(route[0], route.at(-1))) route.pop();
|
|
94
|
+
else {
|
|
95
|
+
const first = route[0];
|
|
96
|
+
const last = route.at(-1);
|
|
97
|
+
if (Math.abs(first.x - last.x) > 1e-4 && Math.abs(first.y - last.y) > 1e-4)
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
100
|
+
if (route.some((p, i) => route.slice(i + 1).some((q) => same(p, q))))
|
|
101
|
+
continue;
|
|
102
|
+
while (route.length > 2) {
|
|
103
|
+
const index = route.findIndex(
|
|
104
|
+
(p, i) => orientation(
|
|
105
|
+
route[(i + route.length - 1) % route.length],
|
|
106
|
+
p,
|
|
107
|
+
route[(i + 1) % route.length]
|
|
108
|
+
) === 0
|
|
109
|
+
);
|
|
110
|
+
if (index === -1) break;
|
|
111
|
+
route.splice(index, 1);
|
|
112
|
+
}
|
|
113
|
+
const area = route.reduce((sum, p, i) => {
|
|
114
|
+
const q = route[(i + 1) % route.length];
|
|
115
|
+
return sum + p.x * q.y - q.x * p.y;
|
|
116
|
+
}, 0);
|
|
117
|
+
if (route.length >= 3 && Math.abs(area) > 1e-8) polygons.push(route);
|
|
118
|
+
}
|
|
119
|
+
return polygons;
|
|
120
|
+
};
|
|
121
|
+
|
|
7
122
|
// node_modules/circuit-json/dist/index.mjs
|
|
8
123
|
var dist_exports = {};
|
|
9
124
|
__export(dist_exports, {
|
|
@@ -22,7 +137,7 @@ __export(dist_exports, {
|
|
|
22
137
|
capacitance: () => capacitance,
|
|
23
138
|
circuit_json_footprint_load_error: () => circuit_json_footprint_load_error,
|
|
24
139
|
current: () => current,
|
|
25
|
-
distance: () =>
|
|
140
|
+
distance: () => distance2,
|
|
26
141
|
duration_ms: () => duration_ms,
|
|
27
142
|
experiment_type: () => experiment_type,
|
|
28
143
|
external_footprint_load_error: () => external_footprint_load_error,
|
|
@@ -769,7 +884,7 @@ var inductance = z.string().or(z.number()).transform((v) => parseAndConvertSiUni
|
|
|
769
884
|
var voltage = z.string().or(z.number()).transform((v) => parseAndConvertSiUnit(v, "V").value);
|
|
770
885
|
var length = z.string().or(z.number()).transform((v) => parseAndConvertSiUnit(v).value);
|
|
771
886
|
var frequency = z.string().or(z.number()).transform((v) => parseAndConvertSiUnit(v, "Hz").value);
|
|
772
|
-
var
|
|
887
|
+
var distance2 = length;
|
|
773
888
|
var current = z.string().or(z.number()).transform((v) => parseAndConvertSiUnit(v, "A").value);
|
|
774
889
|
var duration_ms = z.string().or(z.number()).transform((v) => parseAndConvertSiUnit(v).value);
|
|
775
890
|
var time = duration_ms;
|
|
@@ -815,16 +930,16 @@ expectStringUnionsMatch(
|
|
|
815
930
|
);
|
|
816
931
|
expectStringUnionsMatch(true);
|
|
817
932
|
var point = z2.object({
|
|
818
|
-
x:
|
|
819
|
-
y:
|
|
933
|
+
x: distance2,
|
|
934
|
+
y: distance2
|
|
820
935
|
});
|
|
821
936
|
var position = point;
|
|
822
937
|
expectTypesMatch(true);
|
|
823
938
|
expectTypesMatch(true);
|
|
824
939
|
var point3 = z3.object({
|
|
825
|
-
x:
|
|
826
|
-
y:
|
|
827
|
-
z:
|
|
940
|
+
x: distance2,
|
|
941
|
+
y: distance2,
|
|
942
|
+
z: distance2
|
|
828
943
|
});
|
|
829
944
|
var position3 = point3;
|
|
830
945
|
expectTypesMatch(true);
|
|
@@ -892,7 +1007,7 @@ var kicadAt = point.extend({
|
|
|
892
1007
|
expectTypesMatch(true);
|
|
893
1008
|
var kicadFont = z9.object({
|
|
894
1009
|
size: point.optional(),
|
|
895
|
-
thickness:
|
|
1010
|
+
thickness: distance2.optional()
|
|
896
1011
|
});
|
|
897
1012
|
expectTypesMatch(true);
|
|
898
1013
|
var kicadEffects = z9.object({
|
|
@@ -932,7 +1047,7 @@ var kicadFootprintPad = z9.object({
|
|
|
932
1047
|
shape: z9.string().optional(),
|
|
933
1048
|
at: kicadAt.optional(),
|
|
934
1049
|
size: point.optional(),
|
|
935
|
-
drill:
|
|
1050
|
+
drill: distance2.optional(),
|
|
936
1051
|
layers: z9.array(z9.string()).optional(),
|
|
937
1052
|
removeUnusedLayers: z9.boolean().optional(),
|
|
938
1053
|
uuid: z9.string().optional()
|
|
@@ -963,7 +1078,7 @@ var kicadSymbolPinNumbers = z10.object({
|
|
|
963
1078
|
});
|
|
964
1079
|
expectTypesMatch(true);
|
|
965
1080
|
var kicadSymbolPinNames = z10.object({
|
|
966
|
-
offset:
|
|
1081
|
+
offset: distance2.optional(),
|
|
967
1082
|
hide: z10.boolean().optional()
|
|
968
1083
|
});
|
|
969
1084
|
expectTypesMatch(true);
|
|
@@ -1037,7 +1152,7 @@ var source_simple_capacitor = source_component_base.extend({
|
|
|
1037
1152
|
capacitance,
|
|
1038
1153
|
max_voltage_rating: voltage.optional(),
|
|
1039
1154
|
display_capacitance: z14.string().optional(),
|
|
1040
|
-
max_decoupling_trace_length:
|
|
1155
|
+
max_decoupling_trace_length: distance2.optional()
|
|
1041
1156
|
});
|
|
1042
1157
|
expectTypesMatch(true);
|
|
1043
1158
|
var source_simple_resistor = source_component_base.extend({
|
|
@@ -1667,11 +1782,11 @@ var schematic_box = z72.object({
|
|
|
1667
1782
|
schematic_sheet_id: z72.string().optional(),
|
|
1668
1783
|
schematic_component_id: z72.string().optional(),
|
|
1669
1784
|
schematic_symbol_id: z72.string().optional(),
|
|
1670
|
-
width:
|
|
1671
|
-
height:
|
|
1785
|
+
width: distance2,
|
|
1786
|
+
height: distance2,
|
|
1672
1787
|
is_dashed: z72.boolean().default(false),
|
|
1673
|
-
x:
|
|
1674
|
-
y:
|
|
1788
|
+
x: distance2,
|
|
1789
|
+
y: distance2,
|
|
1675
1790
|
subcircuit_id: z72.string().optional()
|
|
1676
1791
|
}).describe("Draws a box on the schematic");
|
|
1677
1792
|
expectTypesMatch(true);
|
|
@@ -1684,10 +1799,10 @@ var schematic_path = z73.object({
|
|
|
1684
1799
|
fill_color: z73.string().optional(),
|
|
1685
1800
|
is_filled: z73.boolean().optional(),
|
|
1686
1801
|
is_dashed: z73.boolean().default(false),
|
|
1687
|
-
stroke_width:
|
|
1802
|
+
stroke_width: distance2.nullable().optional(),
|
|
1688
1803
|
stroke_color: z73.string().optional(),
|
|
1689
|
-
dash_length:
|
|
1690
|
-
dash_gap:
|
|
1804
|
+
dash_length: distance2.optional(),
|
|
1805
|
+
dash_gap: distance2.optional(),
|
|
1691
1806
|
points: z73.array(point),
|
|
1692
1807
|
subcircuit_id: z73.string().optional()
|
|
1693
1808
|
});
|
|
@@ -1774,15 +1889,15 @@ var schematic_line = z76.object({
|
|
|
1774
1889
|
schematic_sheet_id: z76.string().optional(),
|
|
1775
1890
|
schematic_component_id: z76.string().optional(),
|
|
1776
1891
|
schematic_symbol_id: z76.string().optional(),
|
|
1777
|
-
x1:
|
|
1778
|
-
y1:
|
|
1779
|
-
x2:
|
|
1780
|
-
y2:
|
|
1781
|
-
stroke_width:
|
|
1892
|
+
x1: distance2,
|
|
1893
|
+
y1: distance2,
|
|
1894
|
+
x2: distance2,
|
|
1895
|
+
y2: distance2,
|
|
1896
|
+
stroke_width: distance2.nullable().optional(),
|
|
1782
1897
|
color: z76.string().default("#000000"),
|
|
1783
1898
|
is_dashed: z76.boolean().default(false),
|
|
1784
|
-
dash_length:
|
|
1785
|
-
dash_gap:
|
|
1899
|
+
dash_length: distance2.optional(),
|
|
1900
|
+
dash_gap: distance2.optional(),
|
|
1786
1901
|
subcircuit_id: z76.string().optional()
|
|
1787
1902
|
}).describe("Draws a styled line on the schematic");
|
|
1788
1903
|
expectTypesMatch(true);
|
|
@@ -1793,10 +1908,10 @@ var schematic_rect = z77.object({
|
|
|
1793
1908
|
schematic_component_id: z77.string().optional(),
|
|
1794
1909
|
schematic_symbol_id: z77.string().optional(),
|
|
1795
1910
|
center: point,
|
|
1796
|
-
width:
|
|
1797
|
-
height:
|
|
1911
|
+
width: distance2,
|
|
1912
|
+
height: distance2,
|
|
1798
1913
|
rotation: rotation.default(0),
|
|
1799
|
-
stroke_width:
|
|
1914
|
+
stroke_width: distance2.nullable().optional(),
|
|
1800
1915
|
color: z77.string().default("#000000"),
|
|
1801
1916
|
is_filled: z77.boolean().default(false),
|
|
1802
1917
|
fill_color: z77.string().optional(),
|
|
@@ -1811,8 +1926,8 @@ var schematic_circle = z78.object({
|
|
|
1811
1926
|
schematic_component_id: z78.string().optional(),
|
|
1812
1927
|
schematic_symbol_id: z78.string().optional(),
|
|
1813
1928
|
center: point,
|
|
1814
|
-
radius:
|
|
1815
|
-
stroke_width:
|
|
1929
|
+
radius: distance2,
|
|
1930
|
+
stroke_width: distance2.nullable().optional(),
|
|
1816
1931
|
color: z78.string().default("#000000"),
|
|
1817
1932
|
is_filled: z78.boolean().default(false),
|
|
1818
1933
|
fill_color: z78.string().optional(),
|
|
@@ -1827,11 +1942,11 @@ var schematic_arc = z79.object({
|
|
|
1827
1942
|
schematic_component_id: z79.string().optional(),
|
|
1828
1943
|
schematic_symbol_id: z79.string().optional(),
|
|
1829
1944
|
center: point,
|
|
1830
|
-
radius:
|
|
1945
|
+
radius: distance2,
|
|
1831
1946
|
start_angle_degrees: rotation,
|
|
1832
1947
|
end_angle_degrees: rotation,
|
|
1833
1948
|
direction: z79.enum(["clockwise", "counterclockwise"]).default("counterclockwise"),
|
|
1834
|
-
stroke_width:
|
|
1949
|
+
stroke_width: distance2.nullable().optional(),
|
|
1835
1950
|
color: z79.string().default("#000000"),
|
|
1836
1951
|
is_dashed: z79.boolean().default(false),
|
|
1837
1952
|
subcircuit_id: z79.string().optional()
|
|
@@ -1886,8 +2001,8 @@ var schematic_text = z82.object({
|
|
|
1886
2001
|
text: z82.string(),
|
|
1887
2002
|
font_size: z82.number().default(0.18),
|
|
1888
2003
|
position: z82.object({
|
|
1889
|
-
x:
|
|
1890
|
-
y:
|
|
2004
|
+
x: distance2,
|
|
2005
|
+
y: distance2
|
|
1891
2006
|
}),
|
|
1892
2007
|
rotation: z82.number().default(0),
|
|
1893
2008
|
anchor: z82.union([fivePointAnchor.describe("legacy"), ninePointAnchor]).default("center"),
|
|
@@ -2076,10 +2191,10 @@ var schematic_table = z94.object({
|
|
|
2076
2191
|
schematic_table_id: getZodPrefixedIdWithDefault("schematic_table"),
|
|
2077
2192
|
schematic_sheet_id: z94.string().optional(),
|
|
2078
2193
|
anchor_position: point,
|
|
2079
|
-
column_widths: z94.array(
|
|
2080
|
-
row_heights: z94.array(
|
|
2081
|
-
cell_padding:
|
|
2082
|
-
border_width:
|
|
2194
|
+
column_widths: z94.array(distance2),
|
|
2195
|
+
row_heights: z94.array(distance2),
|
|
2196
|
+
cell_padding: distance2.optional(),
|
|
2197
|
+
border_width: distance2.optional(),
|
|
2083
2198
|
subcircuit_id: z94.string().optional(),
|
|
2084
2199
|
schematic_component_id: z94.string().optional(),
|
|
2085
2200
|
anchor: ninePointAnchor.optional()
|
|
@@ -2098,11 +2213,11 @@ var schematic_table_cell = z95.object({
|
|
|
2098
2213
|
end_column_index: z95.number(),
|
|
2099
2214
|
text: z95.string().optional(),
|
|
2100
2215
|
center: point,
|
|
2101
|
-
width:
|
|
2102
|
-
height:
|
|
2216
|
+
width: distance2,
|
|
2217
|
+
height: distance2,
|
|
2103
2218
|
horizontal_align: z95.enum(["left", "center", "right"]).optional(),
|
|
2104
2219
|
vertical_align: z95.enum(["top", "middle", "bottom"]).optional(),
|
|
2105
|
-
font_size:
|
|
2220
|
+
font_size: distance2.optional(),
|
|
2106
2221
|
subcircuit_id: z95.string().optional()
|
|
2107
2222
|
}).describe("Defines a cell within a schematic_table");
|
|
2108
2223
|
expectTypesMatch(true);
|
|
@@ -2118,8 +2233,8 @@ var schematic_sheet = z96.object({
|
|
|
2118
2233
|
);
|
|
2119
2234
|
expectTypesMatch(true);
|
|
2120
2235
|
var point_with_bulge = z97.object({
|
|
2121
|
-
x:
|
|
2122
|
-
y:
|
|
2236
|
+
x: distance2,
|
|
2237
|
+
y: distance2,
|
|
2123
2238
|
bulge: z97.number().optional()
|
|
2124
2239
|
});
|
|
2125
2240
|
expectTypesMatch(true);
|
|
@@ -2217,8 +2332,8 @@ var getRotationBetweenPcbPin1Locations = (from, to) => {
|
|
|
2217
2332
|
return null;
|
|
2218
2333
|
};
|
|
2219
2334
|
var pcb_route_hint = z100.object({
|
|
2220
|
-
x:
|
|
2221
|
-
y:
|
|
2335
|
+
x: distance2,
|
|
2336
|
+
y: distance2,
|
|
2222
2337
|
via: z100.boolean().optional(),
|
|
2223
2338
|
via_to_layer: layer_ref.optional()
|
|
2224
2339
|
});
|
|
@@ -2226,11 +2341,11 @@ var pcb_route_hints = z100.array(pcb_route_hint);
|
|
|
2226
2341
|
expectTypesMatch(true);
|
|
2227
2342
|
expectTypesMatch(true);
|
|
2228
2343
|
var route_hint_point = z101.object({
|
|
2229
|
-
x:
|
|
2230
|
-
y:
|
|
2344
|
+
x: distance2,
|
|
2345
|
+
y: distance2,
|
|
2231
2346
|
via: z101.boolean().optional(),
|
|
2232
2347
|
to_layer: layer_ref.optional(),
|
|
2233
|
-
trace_width:
|
|
2348
|
+
trace_width: distance2.optional()
|
|
2234
2349
|
});
|
|
2235
2350
|
expectTypesMatch(true);
|
|
2236
2351
|
var manufacturing_drc_properties = z102.object({
|
|
@@ -2325,8 +2440,8 @@ var pcb_hole_circle = z105.object({
|
|
|
2325
2440
|
pcb_component_id: z105.string().optional(),
|
|
2326
2441
|
hole_shape: z105.literal("circle"),
|
|
2327
2442
|
hole_diameter: z105.number(),
|
|
2328
|
-
x:
|
|
2329
|
-
y:
|
|
2443
|
+
x: distance2,
|
|
2444
|
+
y: distance2,
|
|
2330
2445
|
is_covered_with_solder_mask: z105.boolean().optional(),
|
|
2331
2446
|
soldermask_margin: z105.number().optional()
|
|
2332
2447
|
});
|
|
@@ -2343,8 +2458,8 @@ var pcb_hole_rect = z105.object({
|
|
|
2343
2458
|
hole_shape: z105.literal("rect"),
|
|
2344
2459
|
hole_width: z105.number(),
|
|
2345
2460
|
hole_height: z105.number(),
|
|
2346
|
-
x:
|
|
2347
|
-
y:
|
|
2461
|
+
x: distance2,
|
|
2462
|
+
y: distance2,
|
|
2348
2463
|
is_covered_with_solder_mask: z105.boolean().optional(),
|
|
2349
2464
|
soldermask_margin: z105.number().optional()
|
|
2350
2465
|
});
|
|
@@ -2360,8 +2475,8 @@ var pcb_hole_circle_or_square = z105.object({
|
|
|
2360
2475
|
pcb_component_id: z105.string().optional(),
|
|
2361
2476
|
hole_shape: z105.enum(["circle", "square"]),
|
|
2362
2477
|
hole_diameter: z105.number(),
|
|
2363
|
-
x:
|
|
2364
|
-
y:
|
|
2478
|
+
x: distance2,
|
|
2479
|
+
y: distance2,
|
|
2365
2480
|
is_covered_with_solder_mask: z105.boolean().optional(),
|
|
2366
2481
|
soldermask_margin: z105.number().optional()
|
|
2367
2482
|
});
|
|
@@ -2378,8 +2493,8 @@ var pcb_hole_oval = z105.object({
|
|
|
2378
2493
|
hole_shape: z105.literal("oval"),
|
|
2379
2494
|
hole_width: z105.number(),
|
|
2380
2495
|
hole_height: z105.number(),
|
|
2381
|
-
x:
|
|
2382
|
-
y:
|
|
2496
|
+
x: distance2,
|
|
2497
|
+
y: distance2,
|
|
2383
2498
|
is_covered_with_solder_mask: z105.boolean().optional(),
|
|
2384
2499
|
soldermask_margin: z105.number().optional()
|
|
2385
2500
|
});
|
|
@@ -2396,8 +2511,8 @@ var pcb_hole_pill = z105.object({
|
|
|
2396
2511
|
hole_shape: z105.literal("pill"),
|
|
2397
2512
|
hole_width: z105.number(),
|
|
2398
2513
|
hole_height: z105.number(),
|
|
2399
|
-
x:
|
|
2400
|
-
y:
|
|
2514
|
+
x: distance2,
|
|
2515
|
+
y: distance2,
|
|
2401
2516
|
is_covered_with_solder_mask: z105.boolean().optional(),
|
|
2402
2517
|
soldermask_margin: z105.number().optional()
|
|
2403
2518
|
});
|
|
@@ -2414,8 +2529,8 @@ var pcb_hole_rotated_pill = z105.object({
|
|
|
2414
2529
|
hole_shape: z105.literal("rotated_pill"),
|
|
2415
2530
|
hole_width: z105.number(),
|
|
2416
2531
|
hole_height: z105.number(),
|
|
2417
|
-
x:
|
|
2418
|
-
y:
|
|
2532
|
+
x: distance2,
|
|
2533
|
+
y: distance2,
|
|
2419
2534
|
ccw_rotation: rotation,
|
|
2420
2535
|
is_covered_with_solder_mask: z105.boolean().optional(),
|
|
2421
2536
|
soldermask_margin: z105.number().optional()
|
|
@@ -2433,8 +2548,8 @@ var pcb_plated_hole_circle = z106.object({
|
|
|
2433
2548
|
outer_diameter: z106.number(),
|
|
2434
2549
|
hole_diameter: z106.number(),
|
|
2435
2550
|
is_covered_with_solder_mask: z106.boolean().optional(),
|
|
2436
|
-
x:
|
|
2437
|
-
y:
|
|
2551
|
+
x: distance2,
|
|
2552
|
+
y: distance2,
|
|
2438
2553
|
layers: z106.array(layer_ref),
|
|
2439
2554
|
port_hints: z106.array(z106.string()).optional(),
|
|
2440
2555
|
pcb_component_id: z106.string().optional(),
|
|
@@ -2452,8 +2567,8 @@ var pcb_plated_hole_oval = z106.object({
|
|
|
2452
2567
|
hole_width: z106.number(),
|
|
2453
2568
|
hole_height: z106.number(),
|
|
2454
2569
|
is_covered_with_solder_mask: z106.boolean().optional(),
|
|
2455
|
-
x:
|
|
2456
|
-
y:
|
|
2570
|
+
x: distance2,
|
|
2571
|
+
y: distance2,
|
|
2457
2572
|
ccw_rotation: rotation,
|
|
2458
2573
|
layers: z106.array(layer_ref),
|
|
2459
2574
|
port_hints: z106.array(z106.string()).optional(),
|
|
@@ -2473,11 +2588,11 @@ var pcb_circular_hole_with_rect_pad = z106.object({
|
|
|
2473
2588
|
rect_pad_width: z106.number(),
|
|
2474
2589
|
rect_pad_height: z106.number(),
|
|
2475
2590
|
rect_border_radius: z106.number().optional(),
|
|
2476
|
-
hole_offset_x:
|
|
2477
|
-
hole_offset_y:
|
|
2591
|
+
hole_offset_x: distance2.default(0),
|
|
2592
|
+
hole_offset_y: distance2.default(0),
|
|
2478
2593
|
is_covered_with_solder_mask: z106.boolean().optional(),
|
|
2479
|
-
x:
|
|
2480
|
-
y:
|
|
2594
|
+
x: distance2,
|
|
2595
|
+
y: distance2,
|
|
2481
2596
|
layers: z106.array(layer_ref),
|
|
2482
2597
|
port_hints: z106.array(z106.string()).optional(),
|
|
2483
2598
|
pcb_component_id: z106.string().optional(),
|
|
@@ -2498,11 +2613,11 @@ var pcb_pill_hole_with_rect_pad = z106.object({
|
|
|
2498
2613
|
rect_pad_width: z106.number(),
|
|
2499
2614
|
rect_pad_height: z106.number(),
|
|
2500
2615
|
rect_border_radius: z106.number().optional(),
|
|
2501
|
-
hole_offset_x:
|
|
2502
|
-
hole_offset_y:
|
|
2616
|
+
hole_offset_x: distance2.default(0),
|
|
2617
|
+
hole_offset_y: distance2.default(0),
|
|
2503
2618
|
is_covered_with_solder_mask: z106.boolean().optional(),
|
|
2504
|
-
x:
|
|
2505
|
-
y:
|
|
2619
|
+
x: distance2,
|
|
2620
|
+
y: distance2,
|
|
2506
2621
|
layers: z106.array(layer_ref),
|
|
2507
2622
|
port_hints: z106.array(z106.string()).optional(),
|
|
2508
2623
|
pcb_component_id: z106.string().optional(),
|
|
@@ -2524,11 +2639,11 @@ var pcb_rotated_pill_hole_with_rect_pad = z106.object({
|
|
|
2524
2639
|
rect_pad_height: z106.number(),
|
|
2525
2640
|
rect_border_radius: z106.number().optional(),
|
|
2526
2641
|
rect_ccw_rotation: rotation,
|
|
2527
|
-
hole_offset_x:
|
|
2528
|
-
hole_offset_y:
|
|
2642
|
+
hole_offset_x: distance2.default(0),
|
|
2643
|
+
hole_offset_y: distance2.default(0),
|
|
2529
2644
|
is_covered_with_solder_mask: z106.boolean().optional(),
|
|
2530
|
-
x:
|
|
2531
|
-
y:
|
|
2645
|
+
x: distance2,
|
|
2646
|
+
y: distance2,
|
|
2532
2647
|
layers: z106.array(layer_ref),
|
|
2533
2648
|
port_hints: z106.array(z106.string()).optional(),
|
|
2534
2649
|
pcb_component_id: z106.string().optional(),
|
|
@@ -2547,15 +2662,15 @@ var pcb_hole_with_polygon_pad = z106.object({
|
|
|
2547
2662
|
hole_height: z106.number().optional(),
|
|
2548
2663
|
pad_outline: z106.array(
|
|
2549
2664
|
z106.object({
|
|
2550
|
-
x:
|
|
2551
|
-
y:
|
|
2665
|
+
x: distance2,
|
|
2666
|
+
y: distance2
|
|
2552
2667
|
})
|
|
2553
2668
|
).min(3),
|
|
2554
|
-
hole_offset_x:
|
|
2555
|
-
hole_offset_y:
|
|
2669
|
+
hole_offset_x: distance2.default(0),
|
|
2670
|
+
hole_offset_y: distance2.default(0),
|
|
2556
2671
|
is_covered_with_solder_mask: z106.boolean().optional(),
|
|
2557
|
-
x:
|
|
2558
|
-
y:
|
|
2672
|
+
x: distance2,
|
|
2673
|
+
y: distance2,
|
|
2559
2674
|
layers: z106.array(layer_ref),
|
|
2560
2675
|
port_hints: z106.array(z106.string()).optional(),
|
|
2561
2676
|
pcb_component_id: z106.string().optional(),
|
|
@@ -2587,8 +2702,8 @@ var pcb_port = z107.object({
|
|
|
2587
2702
|
subcircuit_id: z107.string().optional(),
|
|
2588
2703
|
source_port_id: z107.string(),
|
|
2589
2704
|
pcb_component_id: z107.string().optional(),
|
|
2590
|
-
x:
|
|
2591
|
-
y:
|
|
2705
|
+
x: distance2,
|
|
2706
|
+
y: distance2,
|
|
2592
2707
|
layers: z107.array(layer_ref),
|
|
2593
2708
|
is_board_pinout: z107.boolean().optional()
|
|
2594
2709
|
}).describe("Defines a port on the PCB");
|
|
@@ -2599,8 +2714,8 @@ var pcb_smtpad_circle = z108.object({
|
|
|
2599
2714
|
pcb_smtpad_id: getZodPrefixedIdWithDefault("pcb_smtpad"),
|
|
2600
2715
|
pcb_group_id: z108.string().optional(),
|
|
2601
2716
|
subcircuit_id: z108.string().optional(),
|
|
2602
|
-
x:
|
|
2603
|
-
y:
|
|
2717
|
+
x: distance2,
|
|
2718
|
+
y: distance2,
|
|
2604
2719
|
radius: z108.number(),
|
|
2605
2720
|
layer: layer_ref,
|
|
2606
2721
|
port_hints: z108.array(z108.string()).optional(),
|
|
@@ -2616,8 +2731,8 @@ var pcb_smtpad_rect = z108.object({
|
|
|
2616
2731
|
pcb_smtpad_id: getZodPrefixedIdWithDefault("pcb_smtpad"),
|
|
2617
2732
|
pcb_group_id: z108.string().optional(),
|
|
2618
2733
|
subcircuit_id: z108.string().optional(),
|
|
2619
|
-
x:
|
|
2620
|
-
y:
|
|
2734
|
+
x: distance2,
|
|
2735
|
+
y: distance2,
|
|
2621
2736
|
width: z108.number(),
|
|
2622
2737
|
height: z108.number(),
|
|
2623
2738
|
rect_border_radius: z108.number().optional(),
|
|
@@ -2640,8 +2755,8 @@ var pcb_smtpad_rotated_rect = z108.object({
|
|
|
2640
2755
|
pcb_smtpad_id: getZodPrefixedIdWithDefault("pcb_smtpad"),
|
|
2641
2756
|
pcb_group_id: z108.string().optional(),
|
|
2642
2757
|
subcircuit_id: z108.string().optional(),
|
|
2643
|
-
x:
|
|
2644
|
-
y:
|
|
2758
|
+
x: distance2,
|
|
2759
|
+
y: distance2,
|
|
2645
2760
|
width: z108.number(),
|
|
2646
2761
|
height: z108.number(),
|
|
2647
2762
|
rect_border_radius: z108.number().optional(),
|
|
@@ -2665,8 +2780,8 @@ var pcb_smtpad_pill = z108.object({
|
|
|
2665
2780
|
pcb_smtpad_id: getZodPrefixedIdWithDefault("pcb_smtpad"),
|
|
2666
2781
|
pcb_group_id: z108.string().optional(),
|
|
2667
2782
|
subcircuit_id: z108.string().optional(),
|
|
2668
|
-
x:
|
|
2669
|
-
y:
|
|
2783
|
+
x: distance2,
|
|
2784
|
+
y: distance2,
|
|
2670
2785
|
width: z108.number(),
|
|
2671
2786
|
height: z108.number(),
|
|
2672
2787
|
radius: z108.number(),
|
|
@@ -2684,8 +2799,8 @@ var pcb_smtpad_rotated_pill = z108.object({
|
|
|
2684
2799
|
pcb_smtpad_id: getZodPrefixedIdWithDefault("pcb_smtpad"),
|
|
2685
2800
|
pcb_group_id: z108.string().optional(),
|
|
2686
2801
|
subcircuit_id: z108.string().optional(),
|
|
2687
|
-
x:
|
|
2688
|
-
y:
|
|
2802
|
+
x: distance2,
|
|
2803
|
+
y: distance2,
|
|
2689
2804
|
width: z108.number(),
|
|
2690
2805
|
height: z108.number(),
|
|
2691
2806
|
radius: z108.number(),
|
|
@@ -2733,8 +2848,8 @@ var pcb_solder_paste_circle = z109.object({
|
|
|
2733
2848
|
pcb_solder_paste_id: getZodPrefixedIdWithDefault("pcb_solder_paste"),
|
|
2734
2849
|
pcb_group_id: z109.string().optional(),
|
|
2735
2850
|
subcircuit_id: z109.string().optional(),
|
|
2736
|
-
x:
|
|
2737
|
-
y:
|
|
2851
|
+
x: distance2,
|
|
2852
|
+
y: distance2,
|
|
2738
2853
|
radius: z109.number(),
|
|
2739
2854
|
layer: layer_ref,
|
|
2740
2855
|
pcb_component_id: z109.string().optional(),
|
|
@@ -2746,8 +2861,8 @@ var pcb_solder_paste_rect = z109.object({
|
|
|
2746
2861
|
pcb_solder_paste_id: getZodPrefixedIdWithDefault("pcb_solder_paste"),
|
|
2747
2862
|
pcb_group_id: z109.string().optional(),
|
|
2748
2863
|
subcircuit_id: z109.string().optional(),
|
|
2749
|
-
x:
|
|
2750
|
-
y:
|
|
2864
|
+
x: distance2,
|
|
2865
|
+
y: distance2,
|
|
2751
2866
|
width: z109.number(),
|
|
2752
2867
|
height: z109.number(),
|
|
2753
2868
|
layer: layer_ref,
|
|
@@ -2760,8 +2875,8 @@ var pcb_solder_paste_pill = z109.object({
|
|
|
2760
2875
|
pcb_solder_paste_id: getZodPrefixedIdWithDefault("pcb_solder_paste"),
|
|
2761
2876
|
pcb_group_id: z109.string().optional(),
|
|
2762
2877
|
subcircuit_id: z109.string().optional(),
|
|
2763
|
-
x:
|
|
2764
|
-
y:
|
|
2878
|
+
x: distance2,
|
|
2879
|
+
y: distance2,
|
|
2765
2880
|
width: z109.number(),
|
|
2766
2881
|
height: z109.number(),
|
|
2767
2882
|
radius: z109.number(),
|
|
@@ -2775,11 +2890,11 @@ var pcb_solder_paste_rotated_rect = z109.object({
|
|
|
2775
2890
|
pcb_solder_paste_id: getZodPrefixedIdWithDefault("pcb_solder_paste"),
|
|
2776
2891
|
pcb_group_id: z109.string().optional(),
|
|
2777
2892
|
subcircuit_id: z109.string().optional(),
|
|
2778
|
-
x:
|
|
2779
|
-
y:
|
|
2893
|
+
x: distance2,
|
|
2894
|
+
y: distance2,
|
|
2780
2895
|
width: z109.number(),
|
|
2781
2896
|
height: z109.number(),
|
|
2782
|
-
ccw_rotation:
|
|
2897
|
+
ccw_rotation: distance2,
|
|
2783
2898
|
layer: layer_ref,
|
|
2784
2899
|
pcb_component_id: z109.string().optional(),
|
|
2785
2900
|
pcb_smtpad_id: z109.string().optional()
|
|
@@ -2790,8 +2905,8 @@ var pcb_solder_paste_rotated_pill = z109.object({
|
|
|
2790
2905
|
pcb_solder_paste_id: getZodPrefixedIdWithDefault("pcb_solder_paste"),
|
|
2791
2906
|
pcb_group_id: z109.string().optional(),
|
|
2792
2907
|
subcircuit_id: z109.string().optional(),
|
|
2793
|
-
x:
|
|
2794
|
-
y:
|
|
2908
|
+
x: distance2,
|
|
2909
|
+
y: distance2,
|
|
2795
2910
|
width: z109.number(),
|
|
2796
2911
|
height: z109.number(),
|
|
2797
2912
|
radius: z109.number(),
|
|
@@ -2806,8 +2921,8 @@ var pcb_solder_paste_oval = z109.object({
|
|
|
2806
2921
|
pcb_solder_paste_id: getZodPrefixedIdWithDefault("pcb_solder_paste"),
|
|
2807
2922
|
pcb_group_id: z109.string().optional(),
|
|
2808
2923
|
subcircuit_id: z109.string().optional(),
|
|
2809
|
-
x:
|
|
2810
|
-
y:
|
|
2924
|
+
x: distance2,
|
|
2925
|
+
y: distance2,
|
|
2811
2926
|
width: z109.number(),
|
|
2812
2927
|
height: z109.number(),
|
|
2813
2928
|
layer: layer_ref,
|
|
@@ -2849,9 +2964,9 @@ var pcb_text = z110.object({
|
|
|
2849
2964
|
expectTypesMatch(true);
|
|
2850
2965
|
var pcb_trace_route_point_wire = z111.object({
|
|
2851
2966
|
route_type: z111.literal("wire"),
|
|
2852
|
-
x:
|
|
2853
|
-
y:
|
|
2854
|
-
width:
|
|
2967
|
+
x: distance2,
|
|
2968
|
+
y: distance2,
|
|
2969
|
+
width: distance2,
|
|
2855
2970
|
copper_pour_id: z111.string().optional(),
|
|
2856
2971
|
is_inside_copper_pour: z111.boolean().optional(),
|
|
2857
2972
|
start_pcb_port_id: z111.string().optional(),
|
|
@@ -2860,12 +2975,12 @@ var pcb_trace_route_point_wire = z111.object({
|
|
|
2860
2975
|
});
|
|
2861
2976
|
var pcb_trace_route_point_via = z111.object({
|
|
2862
2977
|
route_type: z111.literal("via"),
|
|
2863
|
-
x:
|
|
2864
|
-
y:
|
|
2978
|
+
x: distance2,
|
|
2979
|
+
y: distance2,
|
|
2865
2980
|
copper_pour_id: z111.string().optional(),
|
|
2866
2981
|
is_inside_copper_pour: z111.boolean().optional(),
|
|
2867
|
-
hole_diameter:
|
|
2868
|
-
outer_diameter:
|
|
2982
|
+
hole_diameter: distance2.optional(),
|
|
2983
|
+
outer_diameter: distance2.optional(),
|
|
2869
2984
|
from_layer: layer_ref,
|
|
2870
2985
|
to_layer: layer_ref
|
|
2871
2986
|
});
|
|
@@ -2873,7 +2988,7 @@ var pcb_trace_route_point_through_pad = z111.object({
|
|
|
2873
2988
|
route_type: z111.literal("through_pad"),
|
|
2874
2989
|
start: point,
|
|
2875
2990
|
end: point,
|
|
2876
|
-
width:
|
|
2991
|
+
width: distance2,
|
|
2877
2992
|
start_layer: layer_ref,
|
|
2878
2993
|
end_layer: layer_ref,
|
|
2879
2994
|
pcb_smtpad_id: z111.string().optional(),
|
|
@@ -2923,8 +3038,8 @@ var pcb_trace_too_long_warning = z113.object({
|
|
|
2923
3038
|
pcb_trace_id: z113.string(),
|
|
2924
3039
|
source_net_id: z113.string().optional(),
|
|
2925
3040
|
source_trace_id: z113.string().optional(),
|
|
2926
|
-
actual_trace_length:
|
|
2927
|
-
maximum_trace_length:
|
|
3041
|
+
actual_trace_length: distance2,
|
|
3042
|
+
maximum_trace_length: distance2,
|
|
2928
3043
|
subcircuit_id: z113.string().optional()
|
|
2929
3044
|
}).describe(
|
|
2930
3045
|
"Warning emitted when a PCB trace is longer than its maximum allowed length"
|
|
@@ -3008,10 +3123,10 @@ var pcb_via = z120.object({
|
|
|
3008
3123
|
pcb_group_id: z120.string().optional(),
|
|
3009
3124
|
subcircuit_id: z120.string().optional(),
|
|
3010
3125
|
subcircuit_connectivity_map_key: z120.string().optional(),
|
|
3011
|
-
x:
|
|
3012
|
-
y:
|
|
3013
|
-
outer_diameter:
|
|
3014
|
-
hole_diameter:
|
|
3126
|
+
x: distance2,
|
|
3127
|
+
y: distance2,
|
|
3128
|
+
outer_diameter: distance2.default("0.6mm"),
|
|
3129
|
+
hole_diameter: distance2.default("0.25mm"),
|
|
3015
3130
|
/** @deprecated */
|
|
3016
3131
|
from_layer: layer_ref.optional(),
|
|
3017
3132
|
/** @deprecated */
|
|
@@ -3109,11 +3224,11 @@ var pcb_silkscreen_line = z127.object({
|
|
|
3109
3224
|
pcb_component_id: z127.string(),
|
|
3110
3225
|
pcb_group_id: z127.string().optional(),
|
|
3111
3226
|
subcircuit_id: z127.string().optional(),
|
|
3112
|
-
stroke_width:
|
|
3113
|
-
x1:
|
|
3114
|
-
y1:
|
|
3115
|
-
x2:
|
|
3116
|
-
y2:
|
|
3227
|
+
stroke_width: distance2.default("0.1mm"),
|
|
3228
|
+
x1: distance2,
|
|
3229
|
+
y1: distance2,
|
|
3230
|
+
x2: distance2,
|
|
3231
|
+
y2: distance2,
|
|
3117
3232
|
layer: visible_layer
|
|
3118
3233
|
}).describe("Defines a silkscreen line on the PCB");
|
|
3119
3234
|
expectTypesMatch(true);
|
|
@@ -3134,7 +3249,7 @@ var pcb_silkscreen_text = z129.object({
|
|
|
3134
3249
|
pcb_group_id: z129.string().optional(),
|
|
3135
3250
|
subcircuit_id: z129.string().optional(),
|
|
3136
3251
|
font: z129.literal("tscircuit2024").default("tscircuit2024"),
|
|
3137
|
-
font_size:
|
|
3252
|
+
font_size: distance2.default("0.2mm"),
|
|
3138
3253
|
pcb_component_id: z129.string(),
|
|
3139
3254
|
text: z129.string(),
|
|
3140
3255
|
is_knockout: z129.boolean().default(false).optional(),
|
|
@@ -3162,7 +3277,7 @@ var pcb_copper_text = z130.object({
|
|
|
3162
3277
|
pcb_group_id: z130.string().optional(),
|
|
3163
3278
|
subcircuit_id: z130.string().optional(),
|
|
3164
3279
|
font: z130.literal("tscircuit2024").default("tscircuit2024"),
|
|
3165
|
-
font_size:
|
|
3280
|
+
font_size: distance2.default("0.2mm"),
|
|
3166
3281
|
pcb_component_id: z130.string(),
|
|
3167
3282
|
text: z130.string(),
|
|
3168
3283
|
is_knockout: z130.boolean().default(false).optional(),
|
|
@@ -3224,8 +3339,8 @@ var pcb_silkscreen_oval = z133.object({
|
|
|
3224
3339
|
pcb_group_id: z133.string().optional(),
|
|
3225
3340
|
subcircuit_id: z133.string().optional(),
|
|
3226
3341
|
center: point,
|
|
3227
|
-
radius_x:
|
|
3228
|
-
radius_y:
|
|
3342
|
+
radius_x: distance2,
|
|
3343
|
+
radius_y: distance2,
|
|
3229
3344
|
layer: visible_layer,
|
|
3230
3345
|
ccw_rotation: rotation.optional()
|
|
3231
3346
|
}).describe("Defines a silkscreen oval on the PCB");
|
|
@@ -3271,7 +3386,7 @@ var pcb_fabrication_note_text = z136.object({
|
|
|
3271
3386
|
subcircuit_id: z136.string().optional(),
|
|
3272
3387
|
pcb_group_id: z136.string().optional(),
|
|
3273
3388
|
font: z136.literal("tscircuit2024").default("tscircuit2024"),
|
|
3274
|
-
font_size:
|
|
3389
|
+
font_size: distance2.default("1mm"),
|
|
3275
3390
|
pcb_component_id: z136.string(),
|
|
3276
3391
|
text: z136.string(),
|
|
3277
3392
|
ccw_rotation: z136.number().optional(),
|
|
@@ -3351,7 +3466,7 @@ var pcb_note_text = z140.object({
|
|
|
3351
3466
|
subcircuit_id: z140.string().optional(),
|
|
3352
3467
|
name: z140.string().optional(),
|
|
3353
3468
|
font: z140.literal("tscircuit2024").default("tscircuit2024"),
|
|
3354
|
-
font_size:
|
|
3469
|
+
font_size: distance2.default("1mm"),
|
|
3355
3470
|
text: z140.string().optional(),
|
|
3356
3471
|
anchor_position: point.default({ x: 0, y: 0 }),
|
|
3357
3472
|
anchor_alignment: z140.enum(["center", "top_left", "top_right", "bottom_left", "bottom_right"]).default("center"),
|
|
@@ -3402,12 +3517,12 @@ var pcb_note_line = z143.object({
|
|
|
3402
3517
|
subcircuit_id: z143.string().optional(),
|
|
3403
3518
|
name: z143.string().optional(),
|
|
3404
3519
|
text: z143.string().optional(),
|
|
3405
|
-
x1:
|
|
3406
|
-
y1:
|
|
3407
|
-
x2:
|
|
3408
|
-
y2:
|
|
3520
|
+
x1: distance2,
|
|
3521
|
+
y1: distance2,
|
|
3522
|
+
x2: distance2,
|
|
3523
|
+
y2: distance2,
|
|
3409
3524
|
layer: visible_layer.default("top"),
|
|
3410
|
-
stroke_width:
|
|
3525
|
+
stroke_width: distance2.default("0.1mm"),
|
|
3411
3526
|
color: z143.string().optional(),
|
|
3412
3527
|
is_dashed: z143.boolean().optional()
|
|
3413
3528
|
}).describe("Defines a straight documentation note line on the PCB");
|
|
@@ -3464,8 +3579,8 @@ var pcb_keepout = z147.object({
|
|
|
3464
3579
|
pcb_group_id: z147.string().optional(),
|
|
3465
3580
|
subcircuit_id: z147.string().optional(),
|
|
3466
3581
|
center: point,
|
|
3467
|
-
width:
|
|
3468
|
-
height:
|
|
3582
|
+
width: distance2,
|
|
3583
|
+
height: distance2,
|
|
3469
3584
|
pcb_keepout_id: z147.string(),
|
|
3470
3585
|
layers: z147.array(z147.string()),
|
|
3471
3586
|
// Specify layers where the keepout applies
|
|
@@ -3479,7 +3594,7 @@ var pcb_keepout = z147.object({
|
|
|
3479
3594
|
pcb_group_id: z147.string().optional(),
|
|
3480
3595
|
subcircuit_id: z147.string().optional(),
|
|
3481
3596
|
center: point,
|
|
3482
|
-
radius:
|
|
3597
|
+
radius: distance2,
|
|
3483
3598
|
pcb_keepout_id: z147.string(),
|
|
3484
3599
|
layers: z147.array(z147.string()),
|
|
3485
3600
|
// Specify layers where the keepout applies
|
|
@@ -3684,8 +3799,8 @@ var pcb_breakout_point = z158.object({
|
|
|
3684
3799
|
source_port_id: z158.string().optional(),
|
|
3685
3800
|
source_net_id: z158.string().optional(),
|
|
3686
3801
|
layer: layer_ref.optional(),
|
|
3687
|
-
x:
|
|
3688
|
-
y:
|
|
3802
|
+
x: distance2,
|
|
3803
|
+
y: distance2
|
|
3689
3804
|
}).describe(
|
|
3690
3805
|
"Defines a routing target within a pcb_group for a source_trace or source_net"
|
|
3691
3806
|
);
|
|
@@ -3717,9 +3832,9 @@ var pcb_thermal_spoke = z161.object({
|
|
|
3717
3832
|
pcb_ground_plane_id: z161.string(),
|
|
3718
3833
|
shape: z161.string(),
|
|
3719
3834
|
spoke_count: z161.number(),
|
|
3720
|
-
spoke_thickness:
|
|
3721
|
-
spoke_inner_diameter:
|
|
3722
|
-
spoke_outer_diameter:
|
|
3835
|
+
spoke_thickness: distance2,
|
|
3836
|
+
spoke_inner_diameter: distance2,
|
|
3837
|
+
spoke_outer_diameter: distance2,
|
|
3723
3838
|
pcb_plated_hole_id: z161.string().optional(),
|
|
3724
3839
|
subcircuit_id: z161.string().optional()
|
|
3725
3840
|
}).describe("Pattern for connecting a ground plane to a plated hole");
|
|
@@ -3813,8 +3928,8 @@ var pcb_via_clearance_error = base_circuit_json_error.extend({
|
|
|
3813
3928
|
pcb_error_id: getZodPrefixedIdWithDefault("pcb_error"),
|
|
3814
3929
|
error_type: z166.literal("pcb_via_clearance_error").default("pcb_via_clearance_error"),
|
|
3815
3930
|
pcb_via_ids: z166.array(z166.string()).min(2),
|
|
3816
|
-
minimum_clearance:
|
|
3817
|
-
actual_clearance:
|
|
3931
|
+
minimum_clearance: distance2.optional(),
|
|
3932
|
+
actual_clearance: distance2.optional(),
|
|
3818
3933
|
pcb_center: z166.object({
|
|
3819
3934
|
x: z166.number().optional(),
|
|
3820
3935
|
y: z166.number().optional()
|
|
@@ -3830,8 +3945,8 @@ var pcb_via_trace_clearance_error = base_circuit_json_error.extend({
|
|
|
3830
3945
|
error_type: z167.literal("pcb_via_trace_clearance_error").default("pcb_via_trace_clearance_error"),
|
|
3831
3946
|
pcb_via_id: z167.string(),
|
|
3832
3947
|
pcb_trace_id: z167.string(),
|
|
3833
|
-
minimum_clearance:
|
|
3834
|
-
actual_clearance:
|
|
3948
|
+
minimum_clearance: distance2.optional(),
|
|
3949
|
+
actual_clearance: distance2.optional(),
|
|
3835
3950
|
center: z167.object({
|
|
3836
3951
|
x: z167.number().optional(),
|
|
3837
3952
|
y: z167.number().optional()
|
|
@@ -3850,8 +3965,8 @@ var pcb_pad_pad_clearance_error = base_circuit_json_error.extend({
|
|
|
3850
3965
|
),
|
|
3851
3966
|
error_type: z168.literal("pcb_pad_pad_clearance_error").default("pcb_pad_pad_clearance_error"),
|
|
3852
3967
|
pcb_pad_ids: z168.array(z168.string()).min(2),
|
|
3853
|
-
minimum_clearance:
|
|
3854
|
-
actual_clearance:
|
|
3968
|
+
minimum_clearance: distance2.optional(),
|
|
3969
|
+
actual_clearance: distance2.optional(),
|
|
3855
3970
|
center: z168.object({
|
|
3856
3971
|
x: z168.number().optional(),
|
|
3857
3972
|
y: z168.number().optional()
|
|
@@ -3867,8 +3982,8 @@ var pcb_pad_trace_clearance_error = base_circuit_json_error.extend({
|
|
|
3867
3982
|
error_type: z169.literal("pcb_pad_trace_clearance_error").default("pcb_pad_trace_clearance_error"),
|
|
3868
3983
|
pcb_pad_id: z169.string(),
|
|
3869
3984
|
pcb_trace_id: z169.string(),
|
|
3870
|
-
minimum_clearance:
|
|
3871
|
-
actual_clearance:
|
|
3985
|
+
minimum_clearance: distance2.optional(),
|
|
3986
|
+
actual_clearance: distance2.optional(),
|
|
3872
3987
|
center: z169.object({
|
|
3873
3988
|
x: z169.number().optional(),
|
|
3874
3989
|
y: z169.number().optional()
|
|
@@ -6004,6 +6119,225 @@ var transformPCBElements = (elms, matrix) => {
|
|
|
6004
6119
|
}
|
|
6005
6120
|
return transformedElms;
|
|
6006
6121
|
};
|
|
6122
|
+
var mergeBounds = (currentBounds, nextBounds) => ({
|
|
6123
|
+
minX: Math.min(currentBounds.minX, nextBounds.minX),
|
|
6124
|
+
minY: Math.min(currentBounds.minY, nextBounds.minY),
|
|
6125
|
+
maxX: Math.max(currentBounds.maxX, nextBounds.maxX),
|
|
6126
|
+
maxY: Math.max(currentBounds.maxY, nextBounds.maxY)
|
|
6127
|
+
});
|
|
6128
|
+
var getCircleBounds = (x, y, diameter) => {
|
|
6129
|
+
const radius = diameter / 2;
|
|
6130
|
+
return {
|
|
6131
|
+
minX: x - radius,
|
|
6132
|
+
minY: y - radius,
|
|
6133
|
+
maxX: x + radius,
|
|
6134
|
+
maxY: y + radius
|
|
6135
|
+
};
|
|
6136
|
+
};
|
|
6137
|
+
var getRotatedRectBounds = (x, y, width, height, rotationDegrees) => {
|
|
6138
|
+
const halfWidth = width / 2;
|
|
6139
|
+
const halfHeight = height / 2;
|
|
6140
|
+
const theta = rotationDegrees * Math.PI / 180;
|
|
6141
|
+
const cosTheta = Math.cos(theta);
|
|
6142
|
+
const sinTheta = Math.sin(theta);
|
|
6143
|
+
const corners = [
|
|
6144
|
+
{ x: -halfWidth, y: -halfHeight },
|
|
6145
|
+
{ x: halfWidth, y: -halfHeight },
|
|
6146
|
+
{ x: halfWidth, y: halfHeight },
|
|
6147
|
+
{ x: -halfWidth, y: halfHeight }
|
|
6148
|
+
].map((corner) => ({
|
|
6149
|
+
x: x + corner.x * cosTheta - corner.y * sinTheta,
|
|
6150
|
+
y: y + corner.x * sinTheta + corner.y * cosTheta
|
|
6151
|
+
}));
|
|
6152
|
+
return {
|
|
6153
|
+
minX: Math.min(...corners.map((corner) => corner.x)),
|
|
6154
|
+
minY: Math.min(...corners.map((corner) => corner.y)),
|
|
6155
|
+
maxX: Math.max(...corners.map((corner) => corner.x)),
|
|
6156
|
+
maxY: Math.max(...corners.map((corner) => corner.y))
|
|
6157
|
+
};
|
|
6158
|
+
};
|
|
6159
|
+
var getRotatedOvalBounds = (x, y, width, height, rotationDegrees) => {
|
|
6160
|
+
const radiusX = width / 2;
|
|
6161
|
+
const radiusY = height / 2;
|
|
6162
|
+
const theta = rotationDegrees * Math.PI / 180;
|
|
6163
|
+
const cosTheta = Math.cos(theta);
|
|
6164
|
+
const sinTheta = Math.sin(theta);
|
|
6165
|
+
const halfWidth = Math.hypot(radiusX * cosTheta, radiusY * sinTheta);
|
|
6166
|
+
const halfHeight = Math.hypot(radiusX * sinTheta, radiusY * cosTheta);
|
|
6167
|
+
return {
|
|
6168
|
+
minX: x - halfWidth,
|
|
6169
|
+
minY: y - halfHeight,
|
|
6170
|
+
maxX: x + halfWidth,
|
|
6171
|
+
maxY: y + halfHeight
|
|
6172
|
+
};
|
|
6173
|
+
};
|
|
6174
|
+
var getRotatedPillBounds = (x, y, width, height, rotationDegrees) => {
|
|
6175
|
+
const radius = Math.min(width, height) / 2;
|
|
6176
|
+
const halfLineLength = Math.max(width, height) / 2 - radius;
|
|
6177
|
+
const theta = rotationDegrees * Math.PI / 180;
|
|
6178
|
+
const axis = width >= height ? { x: halfLineLength, y: 0 } : { x: 0, y: halfLineLength };
|
|
6179
|
+
const rotatedAxis = {
|
|
6180
|
+
x: axis.x * Math.cos(theta) - axis.y * Math.sin(theta),
|
|
6181
|
+
y: axis.x * Math.sin(theta) + axis.y * Math.cos(theta)
|
|
6182
|
+
};
|
|
6183
|
+
const halfWidth = Math.abs(rotatedAxis.x) + radius;
|
|
6184
|
+
const halfHeight = Math.abs(rotatedAxis.y) + radius;
|
|
6185
|
+
return {
|
|
6186
|
+
minX: x - halfWidth,
|
|
6187
|
+
minY: y - halfHeight,
|
|
6188
|
+
maxX: x + halfWidth,
|
|
6189
|
+
maxY: y + halfHeight
|
|
6190
|
+
};
|
|
6191
|
+
};
|
|
6192
|
+
var getBoundsFromPoints2 = (points) => {
|
|
6193
|
+
if (points.length === 0) return null;
|
|
6194
|
+
return {
|
|
6195
|
+
minX: Math.min(...points.map((point2) => point2.x)),
|
|
6196
|
+
minY: Math.min(...points.map((point2) => point2.y)),
|
|
6197
|
+
maxX: Math.max(...points.map((point2) => point2.x)),
|
|
6198
|
+
maxY: Math.max(...points.map((point2) => point2.y))
|
|
6199
|
+
};
|
|
6200
|
+
};
|
|
6201
|
+
var getRoutePoints = (route) => {
|
|
6202
|
+
if (!Array.isArray(route)) return [];
|
|
6203
|
+
return route.flatMap((point2) => {
|
|
6204
|
+
if (!point2 || typeof point2 !== "object") return [];
|
|
6205
|
+
if ("x" in point2 && "y" in point2 && typeof point2.x === "number" && typeof point2.y === "number") {
|
|
6206
|
+
return [{ x: point2.x, y: point2.y }];
|
|
6207
|
+
}
|
|
6208
|
+
if ("start" in point2 && "end" in point2) {
|
|
6209
|
+
const positions = [point2.start, point2.end];
|
|
6210
|
+
return positions.filter(
|
|
6211
|
+
(position2) => Boolean(
|
|
6212
|
+
position2 && typeof position2 === "object" && "x" in position2 && "y" in position2 && typeof position2.x === "number" && typeof position2.y === "number"
|
|
6213
|
+
)
|
|
6214
|
+
);
|
|
6215
|
+
}
|
|
6216
|
+
return [];
|
|
6217
|
+
});
|
|
6218
|
+
};
|
|
6219
|
+
var getPcbElementBounds = (elm) => {
|
|
6220
|
+
if (!elm.type.startsWith("pcb_")) return null;
|
|
6221
|
+
if (elm.type === "pcb_smtpad" && elm.shape === "polygon" && Array.isArray(elm.points)) {
|
|
6222
|
+
return getBoundsFromPoints2(elm.points);
|
|
6223
|
+
}
|
|
6224
|
+
if (elm.type === "pcb_hole" && elm.hole_shape === "circle") {
|
|
6225
|
+
return getCircleBounds(elm.x, elm.y, elm.hole_diameter);
|
|
6226
|
+
}
|
|
6227
|
+
if (elm.type === "pcb_plated_hole") {
|
|
6228
|
+
let platedHoleBounds;
|
|
6229
|
+
if ("outer_diameter" in elm && typeof elm.outer_diameter === "number") {
|
|
6230
|
+
platedHoleBounds = getCircleBounds(elm.x, elm.y, elm.outer_diameter);
|
|
6231
|
+
} else if ("hole_diameter" in elm && typeof elm.hole_diameter === "number") {
|
|
6232
|
+
platedHoleBounds = getCircleBounds(elm.x, elm.y, elm.hole_diameter);
|
|
6233
|
+
}
|
|
6234
|
+
if ((elm.shape === "oval" || elm.shape === "pill") && typeof elm.outer_width === "number" && typeof elm.outer_height === "number") {
|
|
6235
|
+
const getOuterBounds = elm.shape === "pill" ? getRotatedPillBounds : getRotatedOvalBounds;
|
|
6236
|
+
platedHoleBounds = getOuterBounds(
|
|
6237
|
+
elm.x,
|
|
6238
|
+
elm.y,
|
|
6239
|
+
elm.outer_width,
|
|
6240
|
+
elm.outer_height,
|
|
6241
|
+
elm.ccw_rotation ?? 0
|
|
6242
|
+
);
|
|
6243
|
+
}
|
|
6244
|
+
if ("rect_pad_width" in elm && typeof elm.rect_pad_width === "number" && "rect_pad_height" in elm && typeof elm.rect_pad_height === "number") {
|
|
6245
|
+
const rectBounds = getRotatedRectBounds(
|
|
6246
|
+
elm.x,
|
|
6247
|
+
elm.y,
|
|
6248
|
+
elm.rect_pad_width,
|
|
6249
|
+
elm.rect_pad_height,
|
|
6250
|
+
"rect_ccw_rotation" in elm ? elm.rect_ccw_rotation ?? 0 : 0
|
|
6251
|
+
);
|
|
6252
|
+
platedHoleBounds = platedHoleBounds ? mergeBounds(platedHoleBounds, rectBounds) : rectBounds;
|
|
6253
|
+
}
|
|
6254
|
+
if ("hole_diameter" in elm && typeof elm.hole_diameter === "number") {
|
|
6255
|
+
const drillBounds = getCircleBounds(
|
|
6256
|
+
elm.x + ("hole_offset_x" in elm ? elm.hole_offset_x ?? 0 : 0),
|
|
6257
|
+
elm.y + ("hole_offset_y" in elm ? elm.hole_offset_y ?? 0 : 0),
|
|
6258
|
+
elm.hole_diameter
|
|
6259
|
+
);
|
|
6260
|
+
platedHoleBounds = platedHoleBounds ? mergeBounds(platedHoleBounds, drillBounds) : drillBounds;
|
|
6261
|
+
}
|
|
6262
|
+
if (platedHoleBounds) return platedHoleBounds;
|
|
6263
|
+
}
|
|
6264
|
+
const elementRecord = elm;
|
|
6265
|
+
const routeBounds = getBoundsFromPoints2(getRoutePoints(elementRecord.route));
|
|
6266
|
+
if (routeBounds) return routeBounds;
|
|
6267
|
+
const outlineBounds = getBoundsFromPoints2(
|
|
6268
|
+
getRoutePoints(elementRecord.outline)
|
|
6269
|
+
);
|
|
6270
|
+
if (outlineBounds) return outlineBounds;
|
|
6271
|
+
const pointsBounds = getBoundsFromPoints2(getRoutePoints(elementRecord.points));
|
|
6272
|
+
if (pointsBounds) return pointsBounds;
|
|
6273
|
+
let centerX;
|
|
6274
|
+
let centerY;
|
|
6275
|
+
let width;
|
|
6276
|
+
let height;
|
|
6277
|
+
if ("x" in elm && "y" in elm) {
|
|
6278
|
+
centerX = Number(elm.x);
|
|
6279
|
+
centerY = Number(elm.y);
|
|
6280
|
+
}
|
|
6281
|
+
if ("outer_diameter" in elm) {
|
|
6282
|
+
width = Number(elm.outer_diameter);
|
|
6283
|
+
height = Number(elm.outer_diameter);
|
|
6284
|
+
}
|
|
6285
|
+
if ("width" in elm) {
|
|
6286
|
+
width = Number(elm.width);
|
|
6287
|
+
}
|
|
6288
|
+
if ("height" in elm) {
|
|
6289
|
+
height = Number(elm.height);
|
|
6290
|
+
}
|
|
6291
|
+
if ("center" in elm && elm.center && typeof elm.center === "object" && "x" in elm.center && "y" in elm.center) {
|
|
6292
|
+
centerX = Number(elm.center.x);
|
|
6293
|
+
centerY = Number(elm.center.y);
|
|
6294
|
+
}
|
|
6295
|
+
let rotation2 = 0;
|
|
6296
|
+
if ("rotation" in elm && typeof elm.rotation === "number") {
|
|
6297
|
+
rotation2 = elm.rotation;
|
|
6298
|
+
}
|
|
6299
|
+
if ("ccw_rotation" in elm && typeof elm.ccw_rotation === "number") {
|
|
6300
|
+
rotation2 = elm.ccw_rotation;
|
|
6301
|
+
}
|
|
6302
|
+
if (centerX !== void 0 && centerY !== void 0) {
|
|
6303
|
+
if (width !== void 0 && height !== void 0) {
|
|
6304
|
+
return rotation2 ? getRotatedRectBounds(centerX, centerY, width, height, rotation2) : {
|
|
6305
|
+
minX: centerX - width / 2,
|
|
6306
|
+
minY: centerY - height / 2,
|
|
6307
|
+
maxX: centerX + width / 2,
|
|
6308
|
+
maxY: centerY + height / 2
|
|
6309
|
+
};
|
|
6310
|
+
}
|
|
6311
|
+
if ("radius" in elm && typeof elm.radius === "number") {
|
|
6312
|
+
return getCircleBounds(centerX, centerY, elm.radius * 2);
|
|
6313
|
+
}
|
|
6314
|
+
return { minX: centerX, minY: centerY, maxX: centerX, maxY: centerY };
|
|
6315
|
+
}
|
|
6316
|
+
const anchoredPoint = [elementRecord.anchor_position, elementRecord.position].filter(
|
|
6317
|
+
(position2) => Boolean(
|
|
6318
|
+
position2 && typeof position2 === "object" && "x" in position2 && "y" in position2 && typeof position2.x === "number" && typeof position2.y === "number"
|
|
6319
|
+
)
|
|
6320
|
+
).at(0);
|
|
6321
|
+
return anchoredPoint ? {
|
|
6322
|
+
minX: anchoredPoint.x,
|
|
6323
|
+
minY: anchoredPoint.y,
|
|
6324
|
+
maxX: anchoredPoint.x,
|
|
6325
|
+
maxY: anchoredPoint.y
|
|
6326
|
+
} : null;
|
|
6327
|
+
};
|
|
6328
|
+
var getBoundsOfPcbElements = (elements) => {
|
|
6329
|
+
let bounds = {
|
|
6330
|
+
minX: Number.POSITIVE_INFINITY,
|
|
6331
|
+
minY: Number.POSITIVE_INFINITY,
|
|
6332
|
+
maxX: Number.NEGATIVE_INFINITY,
|
|
6333
|
+
maxY: Number.NEGATIVE_INFINITY
|
|
6334
|
+
};
|
|
6335
|
+
for (const element of elements) {
|
|
6336
|
+
const elementBounds = getPcbElementBounds(element);
|
|
6337
|
+
if (elementBounds) bounds = mergeBounds(bounds, elementBounds);
|
|
6338
|
+
}
|
|
6339
|
+
return bounds;
|
|
6340
|
+
};
|
|
6007
6341
|
function stringHash(str) {
|
|
6008
6342
|
let hash = 0;
|
|
6009
6343
|
if (str.length == 0) return hash;
|
|
@@ -6553,52 +6887,6 @@ var isLedCategoryComponent = (betterEasy) => {
|
|
|
6553
6887
|
].some(categoryValueContainsLed);
|
|
6554
6888
|
};
|
|
6555
6889
|
|
|
6556
|
-
// node_modules/@tscircuit/math-utils/dist/chunk-EFLPMB4J.js
|
|
6557
|
-
function distance2(p1, p2) {
|
|
6558
|
-
const dx = p1.x - p2.x;
|
|
6559
|
-
const dy = p1.y - p2.y;
|
|
6560
|
-
return Math.sqrt(dx * dx + dy * dy);
|
|
6561
|
-
}
|
|
6562
|
-
|
|
6563
|
-
// node_modules/@tscircuit/math-utils/dist/chunk-GIGMPRPV.js
|
|
6564
|
-
var getUnitVectorFromDirection = (direction) => {
|
|
6565
|
-
switch (direction) {
|
|
6566
|
-
case "up":
|
|
6567
|
-
return { x: 0, y: 1 };
|
|
6568
|
-
case "down":
|
|
6569
|
-
return { x: 0, y: -1 };
|
|
6570
|
-
case "left":
|
|
6571
|
-
return { x: -1, y: 0 };
|
|
6572
|
-
case "right":
|
|
6573
|
-
return { x: 1, y: 0 };
|
|
6574
|
-
}
|
|
6575
|
-
};
|
|
6576
|
-
|
|
6577
|
-
// node_modules/@tscircuit/math-utils/dist/chunk-3WCUPG5S.js
|
|
6578
|
-
var getBoundsCenter = (bounds) => ({
|
|
6579
|
-
x: (bounds.minX + bounds.maxX) / 2,
|
|
6580
|
-
y: (bounds.minY + bounds.maxY) / 2
|
|
6581
|
-
});
|
|
6582
|
-
|
|
6583
|
-
// node_modules/@tscircuit/math-utils/dist/chunk-5N7UJNVK.js
|
|
6584
|
-
var getBoundsFromPoints = (points) => {
|
|
6585
|
-
if (points.length === 0) {
|
|
6586
|
-
return null;
|
|
6587
|
-
}
|
|
6588
|
-
let minX = points[0].x;
|
|
6589
|
-
let minY = points[0].y;
|
|
6590
|
-
let maxX = points[0].x;
|
|
6591
|
-
let maxY = points[0].y;
|
|
6592
|
-
for (let i = 1; i < points.length; i++) {
|
|
6593
|
-
const point2 = points[i];
|
|
6594
|
-
if (point2.x < minX) minX = point2.x;
|
|
6595
|
-
if (point2.y < minY) minY = point2.y;
|
|
6596
|
-
if (point2.x > maxX) maxX = point2.x;
|
|
6597
|
-
if (point2.y > maxY) maxY = point2.y;
|
|
6598
|
-
}
|
|
6599
|
-
return { minX, minY, maxX, maxY };
|
|
6600
|
-
};
|
|
6601
|
-
|
|
6602
6890
|
// lib/websafe/get-easyeda-cad-placement-helpers.ts
|
|
6603
6891
|
var getCadSvgNode = (easyEdaJson) => {
|
|
6604
6892
|
const svgNode = easyEdaJson.packageDetail.dataStr.shape.find(
|
|
@@ -6736,6 +7024,39 @@ var parseCadOffsetsFromSvgNode = (svgNode) => {
|
|
|
6736
7024
|
})()
|
|
6737
7025
|
};
|
|
6738
7026
|
};
|
|
7027
|
+
var getCadModelOutlineBounds = (svgNode) => {
|
|
7028
|
+
const points = [];
|
|
7029
|
+
for (const childNode of svgNode?.svgData.childNodes ?? []) {
|
|
7030
|
+
if (typeof childNode !== "object" || childNode === null) continue;
|
|
7031
|
+
const attrs = childNode.attrs;
|
|
7032
|
+
if (typeof attrs !== "object" || attrs === null) continue;
|
|
7033
|
+
const rawPoints = attrs.points;
|
|
7034
|
+
if (typeof rawPoints !== "string") continue;
|
|
7035
|
+
const coordinates = rawPoints.trim().split(/\s+/).map(Number);
|
|
7036
|
+
for (let index = 0; index + 1 < coordinates.length; index += 2) {
|
|
7037
|
+
const x = coordinates[index];
|
|
7038
|
+
const y = coordinates[index + 1];
|
|
7039
|
+
if (!Number.isFinite(x) || !Number.isFinite(y)) continue;
|
|
7040
|
+
points.push({ x: milx10(x), y: milx10(y) });
|
|
7041
|
+
}
|
|
7042
|
+
}
|
|
7043
|
+
if (points.length === 0) return void 0;
|
|
7044
|
+
return {
|
|
7045
|
+
minX: Math.min(...points.map((point2) => point2.x)),
|
|
7046
|
+
minY: Math.min(...points.map((point2) => point2.y)),
|
|
7047
|
+
maxX: Math.max(...points.map((point2) => point2.x)),
|
|
7048
|
+
maxY: Math.max(...points.map((point2) => point2.y))
|
|
7049
|
+
};
|
|
7050
|
+
};
|
|
7051
|
+
var unionBounds = (first, second) => {
|
|
7052
|
+
if (!second) return first;
|
|
7053
|
+
return {
|
|
7054
|
+
minX: Math.min(first.minX, second.minX),
|
|
7055
|
+
minY: Math.min(first.minY, second.minY),
|
|
7056
|
+
maxX: Math.max(first.maxX, second.maxX),
|
|
7057
|
+
maxY: Math.max(first.maxY, second.maxY)
|
|
7058
|
+
};
|
|
7059
|
+
};
|
|
6739
7060
|
var readModelHeightMm = (raw) => {
|
|
6740
7061
|
const fallback = 3.5;
|
|
6741
7062
|
if (raw == null) return fallback;
|
|
@@ -7191,6 +7512,19 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, {
|
|
|
7191
7512
|
).forEach((sr, index) => {
|
|
7192
7513
|
circuitElements.push(handleCutout(sr, index));
|
|
7193
7514
|
});
|
|
7515
|
+
const boardOutlineTracks = easyEdaJson.packageDetail.dataStr.shape.filter(
|
|
7516
|
+
(shape) => shape.type === "TRACK" && shape.layer === 10
|
|
7517
|
+
);
|
|
7518
|
+
getBoardOutlinePolygons(boardOutlineTracks).forEach((points, index) => {
|
|
7519
|
+
circuitElements.push(
|
|
7520
|
+
pcb_cutout.parse({
|
|
7521
|
+
type: "pcb_cutout",
|
|
7522
|
+
pcb_cutout_id: `pcb_cutout_outline_${index + 1}`,
|
|
7523
|
+
shape: "polygon",
|
|
7524
|
+
points: points.map((p) => ({ x: milx10(p.x), y: milx10(p.y) }))
|
|
7525
|
+
})
|
|
7526
|
+
);
|
|
7527
|
+
});
|
|
7194
7528
|
let hasFoundDesignator = false;
|
|
7195
7529
|
const silkscreenTracks = easyEdaJson.packageDetail.dataStr.shape.filter(
|
|
7196
7530
|
(shape) => shape.type === "TRACK" && isSilkscreenLayer(shape.layer)
|
|
@@ -7314,17 +7648,29 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, {
|
|
|
7314
7648
|
);
|
|
7315
7649
|
}
|
|
7316
7650
|
const hasExplicitCourtyard = circuitElements.some(
|
|
7317
|
-
(e) => e.type === "pcb_courtyard_outline"
|
|
7651
|
+
(e) => e.type === "pcb_courtyard_outline" || e.type === "pcb_courtyard_rect"
|
|
7318
7652
|
);
|
|
7319
7653
|
if (!hasExplicitCourtyard) {
|
|
7320
7654
|
const bbox = easyEdaJson.packageDetail.dataStr.BBox;
|
|
7321
|
-
|
|
7655
|
+
const modelOutlineBounds = getCadModelOutlineBounds(svgNode);
|
|
7656
|
+
const packageElements = circuitElements.filter(
|
|
7657
|
+
(element) => element.type === "pcb_smtpad" || element.type === "pcb_plated_hole" || element.type === "pcb_hole" || element.type === "pcb_via"
|
|
7658
|
+
);
|
|
7659
|
+
const packageElementBounds = packageElements.length > 0 ? getBoundsOfPcbElements(packageElements) : void 0;
|
|
7660
|
+
const fallbackBounds = bbox ? {
|
|
7661
|
+
minX: milx10(bbox.x),
|
|
7662
|
+
minY: milx10(bbox.y),
|
|
7663
|
+
maxX: milx10(bbox.x + bbox.width),
|
|
7664
|
+
maxY: milx10(bbox.y + bbox.height)
|
|
7665
|
+
} : void 0;
|
|
7666
|
+
const courtyardBounds = modelOutlineBounds ? unionBounds(modelOutlineBounds, packageElementBounds) : fallbackBounds;
|
|
7667
|
+
if (courtyardBounds) {
|
|
7322
7668
|
const strokeWidth = 0.05;
|
|
7323
7669
|
const margin = 0.25;
|
|
7324
|
-
const x1 =
|
|
7325
|
-
const y1 =
|
|
7326
|
-
const x2 =
|
|
7327
|
-
const y2 =
|
|
7670
|
+
const x1 = courtyardBounds.minX - margin;
|
|
7671
|
+
const y1 = courtyardBounds.minY - margin;
|
|
7672
|
+
const x2 = courtyardBounds.maxX + margin;
|
|
7673
|
+
const y2 = courtyardBounds.maxY + margin;
|
|
7328
7674
|
circuitElements.push(
|
|
7329
7675
|
pcb_courtyard_outline.parse({
|
|
7330
7676
|
type: "pcb_courtyard_outline",
|
|
@@ -8763,7 +9109,7 @@ var alignPortToDrawing = ({
|
|
|
8763
9109
|
const alignmentTolerance = Math.max(0.02, stemLength * 0.25);
|
|
8764
9110
|
const nearestEndpoint = drawingEndpoints.map((endpoint) => ({
|
|
8765
9111
|
endpoint,
|
|
8766
|
-
distance:
|
|
9112
|
+
distance: distance(endpoint, expectedBodyConnection)
|
|
8767
9113
|
})).filter((candidate) => candidate.distance <= alignmentTolerance).sort((a, b) => a.distance - b.distance)[0]?.endpoint;
|
|
8768
9114
|
if (!nearestEndpoint) return position2;
|
|
8769
9115
|
return {
|
|
@@ -8987,6 +9333,13 @@ var generateFootprintTsx = (circuitJson, options = {}) => {
|
|
|
8987
9333
|
const pcbNoteDimensions = su(circuitJson).pcb_note_dimension.list();
|
|
8988
9334
|
const courtyardOutlines = su(circuitJson).pcb_courtyard_outline.list();
|
|
8989
9335
|
const elementStrings = [];
|
|
9336
|
+
for (const cutout of su(circuitJson).pcb_cutout.list()) {
|
|
9337
|
+
if (cutout.shape === "polygon") {
|
|
9338
|
+
elementStrings.push(
|
|
9339
|
+
`<cutout shape="polygon" points={${JSON.stringify(cutout.points)}} />`
|
|
9340
|
+
);
|
|
9341
|
+
}
|
|
9342
|
+
}
|
|
8990
9343
|
for (const hole of holes) {
|
|
8991
9344
|
if (hole.hole_shape === "circle") {
|
|
8992
9345
|
elementStrings.push(
|