@tscircuit/core 0.0.385 → 0.0.387
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.js +150 -2
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1663,6 +1663,21 @@ var SmtPad = class extends PrimitiveComponent2 {
|
|
|
1663
1663
|
subcircuit_id: subcircuit?.subcircuit_id ?? void 0,
|
|
1664
1664
|
pcb_group_id: this.getGroup()?.pcb_group_id ?? void 0
|
|
1665
1665
|
});
|
|
1666
|
+
if (pcb_smtpad.shape === "rotated_rect")
|
|
1667
|
+
db.pcb_solder_paste.insert({
|
|
1668
|
+
layer: pcb_smtpad.layer,
|
|
1669
|
+
shape: "rotated_rect",
|
|
1670
|
+
// @ts-ignore: no idea why this is triggering
|
|
1671
|
+
width: pcb_smtpad.width * 0.7,
|
|
1672
|
+
height: pcb_smtpad.height * 0.7,
|
|
1673
|
+
x: pcb_smtpad.x,
|
|
1674
|
+
y: pcb_smtpad.y,
|
|
1675
|
+
ccw_rotation: parentRotation,
|
|
1676
|
+
pcb_component_id: pcb_smtpad.pcb_component_id,
|
|
1677
|
+
pcb_smtpad_id: pcb_smtpad.pcb_smtpad_id,
|
|
1678
|
+
subcircuit_id: subcircuit?.subcircuit_id ?? void 0,
|
|
1679
|
+
pcb_group_id: this.getGroup()?.pcb_group_id ?? void 0
|
|
1680
|
+
});
|
|
1666
1681
|
}
|
|
1667
1682
|
if (pcb_smtpad) {
|
|
1668
1683
|
this.pcb_smtpad_id = pcb_smtpad.pcb_smtpad_id;
|
|
@@ -1896,6 +1911,26 @@ var PlatedHole = class extends PrimitiveComponent2 {
|
|
|
1896
1911
|
pcb_group_id: this.getGroup()?.pcb_group_id ?? void 0
|
|
1897
1912
|
});
|
|
1898
1913
|
this.pcb_plated_hole_id = pcb_plated_hole.pcb_plated_hole_id;
|
|
1914
|
+
db.pcb_solder_paste.insert({
|
|
1915
|
+
layer: "top",
|
|
1916
|
+
shape: "circle",
|
|
1917
|
+
// @ts-ignore: no idea why this is triggering
|
|
1918
|
+
radius: props.outerDiameter / 2,
|
|
1919
|
+
x: position.x,
|
|
1920
|
+
y: position.y,
|
|
1921
|
+
subcircuit_id: subcircuit?.subcircuit_id ?? void 0,
|
|
1922
|
+
pcb_group_id: this.getGroup()?.pcb_group_id ?? void 0
|
|
1923
|
+
});
|
|
1924
|
+
db.pcb_solder_paste.insert({
|
|
1925
|
+
layer: "bottom",
|
|
1926
|
+
shape: "circle",
|
|
1927
|
+
// @ts-ignore: no idea why this is triggering
|
|
1928
|
+
radius: props.outerDiameter / 2,
|
|
1929
|
+
x: position.x,
|
|
1930
|
+
y: position.y,
|
|
1931
|
+
subcircuit_id: subcircuit?.subcircuit_id ?? void 0,
|
|
1932
|
+
pcb_group_id: this.getGroup()?.pcb_group_id ?? void 0
|
|
1933
|
+
});
|
|
1899
1934
|
} else if (props.shape === "pill" || props.shape === "oval") {
|
|
1900
1935
|
const pcb_plated_hole = db.pcb_plated_hole.insert({
|
|
1901
1936
|
pcb_component_id,
|
|
@@ -1914,6 +1949,28 @@ var PlatedHole = class extends PrimitiveComponent2 {
|
|
|
1914
1949
|
// NOTE: currently PcbPlatedHoleOval erroneously includes both the shape "pill" and "oval"
|
|
1915
1950
|
});
|
|
1916
1951
|
this.pcb_plated_hole_id = pcb_plated_hole.pcb_plated_hole_id;
|
|
1952
|
+
db.pcb_solder_paste.insert({
|
|
1953
|
+
layer: "top",
|
|
1954
|
+
shape: props.shape,
|
|
1955
|
+
// @ts-ignore: no idea why this is triggering
|
|
1956
|
+
width: props.outerWidth,
|
|
1957
|
+
height: props.outerHeight,
|
|
1958
|
+
x: position.x,
|
|
1959
|
+
y: position.y,
|
|
1960
|
+
subcircuit_id: subcircuit?.subcircuit_id ?? void 0,
|
|
1961
|
+
pcb_group_id: this.getGroup()?.pcb_group_id ?? void 0
|
|
1962
|
+
});
|
|
1963
|
+
db.pcb_solder_paste.insert({
|
|
1964
|
+
layer: "bottom",
|
|
1965
|
+
shape: props.shape,
|
|
1966
|
+
// @ts-ignore: no idea why this is triggering
|
|
1967
|
+
width: props.outerWidth,
|
|
1968
|
+
height: props.outerHeight,
|
|
1969
|
+
x: position.x,
|
|
1970
|
+
y: position.y,
|
|
1971
|
+
subcircuit_id: subcircuit?.subcircuit_id ?? void 0,
|
|
1972
|
+
pcb_group_id: this.getGroup()?.pcb_group_id ?? void 0
|
|
1973
|
+
});
|
|
1917
1974
|
}
|
|
1918
1975
|
}
|
|
1919
1976
|
doInitialPcbPortAttachment() {
|
|
@@ -3731,6 +3788,95 @@ var getMaxLengthFromConnectedCapacitors = (ports, { db }) => {
|
|
|
3731
3788
|
|
|
3732
3789
|
// lib/components/primitive-components/Trace/get-obstacles-for-trace.ts
|
|
3733
3790
|
import { getUnitVectorFromDirection } from "@tscircuit/math-utils";
|
|
3791
|
+
|
|
3792
|
+
// lib/utils/autorouting/getBoundsForSchematic.ts
|
|
3793
|
+
function getBoundsForSchematic(db) {
|
|
3794
|
+
let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
|
|
3795
|
+
for (const elm of db) {
|
|
3796
|
+
let cx, cy, w, h;
|
|
3797
|
+
if (elm.type === "schematic_component") {
|
|
3798
|
+
cx = elm.center?.x;
|
|
3799
|
+
cy = elm.center?.y;
|
|
3800
|
+
w = elm.size?.width;
|
|
3801
|
+
h = elm.size?.height;
|
|
3802
|
+
} else if (elm.type === "schematic_box") {
|
|
3803
|
+
cx = elm.x;
|
|
3804
|
+
cy = elm.y;
|
|
3805
|
+
w = elm.width;
|
|
3806
|
+
h = elm.height;
|
|
3807
|
+
} else if (elm.type === "schematic_port") {
|
|
3808
|
+
cx = elm.center?.x;
|
|
3809
|
+
cy = elm.center?.y;
|
|
3810
|
+
w = 0.2;
|
|
3811
|
+
h = 0.2;
|
|
3812
|
+
} else if (elm.type === "schematic_text") {
|
|
3813
|
+
cx = elm.position?.x;
|
|
3814
|
+
cy = elm.position?.y;
|
|
3815
|
+
w = (elm.text?.length ?? 0) * 0.1;
|
|
3816
|
+
h = 0.2;
|
|
3817
|
+
}
|
|
3818
|
+
if (typeof cx === "number" && typeof cy === "number" && typeof w === "number" && typeof h === "number") {
|
|
3819
|
+
minX = Math.min(minX, cx - w / 2);
|
|
3820
|
+
maxX = Math.max(maxX, cx + w / 2);
|
|
3821
|
+
minY = Math.min(minY, cy - h / 2);
|
|
3822
|
+
maxY = Math.max(maxY, cy + h / 2);
|
|
3823
|
+
}
|
|
3824
|
+
}
|
|
3825
|
+
return { minX, maxX, minY, maxY };
|
|
3826
|
+
}
|
|
3827
|
+
|
|
3828
|
+
// lib/utils/autorouting/getObstaclesFromBounds.ts
|
|
3829
|
+
function getObstaclesFromBounds(bounds, opts = {}) {
|
|
3830
|
+
const { minX, maxX, minY, maxY } = bounds;
|
|
3831
|
+
const PADDING = opts.padding ?? 1;
|
|
3832
|
+
if (!isFinite(minX) || !isFinite(maxX) || !isFinite(minY) || !isFinite(maxY))
|
|
3833
|
+
return [];
|
|
3834
|
+
const left = minX - PADDING;
|
|
3835
|
+
const right = maxX + PADDING;
|
|
3836
|
+
const top = maxY + PADDING;
|
|
3837
|
+
const bottom = minY - PADDING;
|
|
3838
|
+
const thickness = 0.01;
|
|
3839
|
+
return [
|
|
3840
|
+
// Top border (horizontal)
|
|
3841
|
+
{
|
|
3842
|
+
type: "rect",
|
|
3843
|
+
layers: ["top"],
|
|
3844
|
+
center: { x: (left + right) / 2, y: top },
|
|
3845
|
+
width: right - left,
|
|
3846
|
+
height: thickness,
|
|
3847
|
+
connectedTo: []
|
|
3848
|
+
},
|
|
3849
|
+
// Bottom border (horizontal)
|
|
3850
|
+
{
|
|
3851
|
+
type: "rect",
|
|
3852
|
+
layers: ["top"],
|
|
3853
|
+
center: { x: (left + right) / 2, y: bottom },
|
|
3854
|
+
width: right - left,
|
|
3855
|
+
height: thickness,
|
|
3856
|
+
connectedTo: []
|
|
3857
|
+
},
|
|
3858
|
+
// Left border (vertical)
|
|
3859
|
+
{
|
|
3860
|
+
type: "rect",
|
|
3861
|
+
layers: ["top"],
|
|
3862
|
+
center: { x: left, y: (top + bottom) / 2 },
|
|
3863
|
+
width: thickness,
|
|
3864
|
+
height: top - bottom,
|
|
3865
|
+
connectedTo: []
|
|
3866
|
+
},
|
|
3867
|
+
// Right border (vertical)
|
|
3868
|
+
{
|
|
3869
|
+
type: "rect",
|
|
3870
|
+
layers: ["top"],
|
|
3871
|
+
center: { x: right, y: (top + bottom) / 2 },
|
|
3872
|
+
width: thickness,
|
|
3873
|
+
height: top - bottom,
|
|
3874
|
+
connectedTo: []
|
|
3875
|
+
}
|
|
3876
|
+
];
|
|
3877
|
+
}
|
|
3878
|
+
|
|
3879
|
+
// lib/components/primitive-components/Trace/get-obstacles-for-trace.ts
|
|
3734
3880
|
var getSchematicObstaclesForTrace = (trace) => {
|
|
3735
3881
|
const db = trace.root.db;
|
|
3736
3882
|
const connectedPorts = trace._findConnectedPorts().ports ?? [];
|
|
@@ -3792,6 +3938,8 @@ var getSchematicObstaclesForTrace = (trace) => {
|
|
|
3792
3938
|
});
|
|
3793
3939
|
}
|
|
3794
3940
|
}
|
|
3941
|
+
const bounds = getBoundsForSchematic(db.toArray());
|
|
3942
|
+
obstacles.push(...getObstaclesFromBounds(bounds, { padding: 1 }));
|
|
3795
3943
|
return obstacles;
|
|
3796
3944
|
};
|
|
3797
3945
|
|
|
@@ -7743,7 +7891,7 @@ import { identity as identity4 } from "transformation-matrix";
|
|
|
7743
7891
|
var package_default = {
|
|
7744
7892
|
name: "@tscircuit/core",
|
|
7745
7893
|
type: "module",
|
|
7746
|
-
version: "0.0.
|
|
7894
|
+
version: "0.0.386",
|
|
7747
7895
|
types: "dist/index.d.ts",
|
|
7748
7896
|
main: "dist/index.js",
|
|
7749
7897
|
module: "dist/index.js",
|
|
@@ -7803,7 +7951,7 @@ var package_default = {
|
|
|
7803
7951
|
"@tscircuit/math-utils": "^0.0.14",
|
|
7804
7952
|
"@tscircuit/props": "^0.0.172",
|
|
7805
7953
|
"@tscircuit/schematic-autolayout": "^0.0.6",
|
|
7806
|
-
"circuit-json": "0.0.
|
|
7954
|
+
"circuit-json": "0.0.160",
|
|
7807
7955
|
"circuit-json-to-connectivity-map": "^0.0.20",
|
|
7808
7956
|
"css-select": "^5.1.0",
|
|
7809
7957
|
"format-si-unit": "^0.0.3",
|
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.387",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"@tscircuit/math-utils": "^0.0.14",
|
|
62
62
|
"@tscircuit/props": "^0.0.172",
|
|
63
63
|
"@tscircuit/schematic-autolayout": "^0.0.6",
|
|
64
|
-
"circuit-json": "0.0.
|
|
64
|
+
"circuit-json": "0.0.160",
|
|
65
65
|
"circuit-json-to-connectivity-map": "^0.0.20",
|
|
66
66
|
"css-select": "^5.1.0",
|
|
67
67
|
"format-si-unit": "^0.0.3",
|