@tscircuit/core 0.0.799 → 0.0.800
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 +48 -6
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -7398,6 +7398,7 @@ function NormalComponent_doInitialPcbComponentAnchorAlignment(component) {
|
|
|
7398
7398
|
}
|
|
7399
7399
|
|
|
7400
7400
|
// lib/components/base-components/NormalComponent/NormalComponent.ts
|
|
7401
|
+
import { normalizeDegrees } from "@tscircuit/math-utils";
|
|
7401
7402
|
var debug3 = Debug4("tscircuit:core");
|
|
7402
7403
|
var rotation32 = z9.object({
|
|
7403
7404
|
x: rotation2,
|
|
@@ -8326,6 +8327,9 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
|
|
|
8326
8327
|
const globalTransform = this._computePcbGlobalTransformBeforeLayout();
|
|
8327
8328
|
const decomposedTransform = decomposeTSR5(globalTransform);
|
|
8328
8329
|
const accumulatedRotation = decomposedTransform.rotation.angle * 180 / Math.PI;
|
|
8330
|
+
const pcbRotation = pcb_component?.rotation ?? 0;
|
|
8331
|
+
const rotationWithOffset = pcbRotation + accumulatedRotation + (rotationOffset.z ?? 0);
|
|
8332
|
+
const cadRotationZ = computedLayer === "bottom" ? normalizeDegrees(-rotationWithOffset + 180) : normalizeDegrees(rotationWithOffset);
|
|
8329
8333
|
const cad_model = db.cad_component.insert({
|
|
8330
8334
|
// TODO z maybe depends on layer
|
|
8331
8335
|
position: {
|
|
@@ -8336,7 +8340,7 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
|
|
|
8336
8340
|
rotation: {
|
|
8337
8341
|
x: rotationOffset.x,
|
|
8338
8342
|
y: (computedLayer === "top" ? 0 : 180) + rotationOffset.y,
|
|
8339
|
-
z:
|
|
8343
|
+
z: cadRotationZ
|
|
8340
8344
|
},
|
|
8341
8345
|
pcb_component_id: this.pcb_component_id,
|
|
8342
8346
|
source_component_id: this.source_component_id,
|
|
@@ -10999,7 +11003,33 @@ var applyComponentConstraintClusters = (group, packInput) => {
|
|
|
10999
11003
|
|
|
11000
11004
|
// lib/components/primitive-components/Group/Group_doInitialPcbLayoutPack/applyPackOutput.ts
|
|
11001
11005
|
import { translate as translate5, rotate as rotate2, compose as compose4 } from "transformation-matrix";
|
|
11002
|
-
import {
|
|
11006
|
+
import {
|
|
11007
|
+
transformPCBElements
|
|
11008
|
+
} from "@tscircuit/circuit-json-util";
|
|
11009
|
+
import { normalizeDegrees as normalizeDegrees2 } from "@tscircuit/math-utils";
|
|
11010
|
+
var updateCadRotation = ({
|
|
11011
|
+
db,
|
|
11012
|
+
pcbComponentId,
|
|
11013
|
+
rotationDegrees,
|
|
11014
|
+
layer
|
|
11015
|
+
}) => {
|
|
11016
|
+
if (rotationDegrees == null) return;
|
|
11017
|
+
if (!db?.cad_component?.list) return;
|
|
11018
|
+
const cadComponent = db.cad_component.getWhere({
|
|
11019
|
+
pcb_component_id: pcbComponentId
|
|
11020
|
+
});
|
|
11021
|
+
if (!cadComponent) return;
|
|
11022
|
+
const delta = layer?.toLowerCase?.() === "bottom" ? -rotationDegrees : rotationDegrees;
|
|
11023
|
+
const currentRotationZ = cadComponent.rotation?.z ?? 0;
|
|
11024
|
+
const nextRotation = {
|
|
11025
|
+
...cadComponent.rotation ?? { x: 0, y: 0, z: 0 },
|
|
11026
|
+
z: normalizeDegrees2(currentRotationZ + delta)
|
|
11027
|
+
};
|
|
11028
|
+
db.cad_component.update(cadComponent.cad_component_id, {
|
|
11029
|
+
rotation: nextRotation
|
|
11030
|
+
});
|
|
11031
|
+
cadComponent.rotation = nextRotation;
|
|
11032
|
+
};
|
|
11003
11033
|
var isDescendantGroup = (db, groupId, ancestorId) => {
|
|
11004
11034
|
if (groupId === ancestorId) return true;
|
|
11005
11035
|
const group = db.source_group.get(groupId);
|
|
@@ -11034,6 +11064,12 @@ var applyPackOutput = (group, packOutput, clusterMap) => {
|
|
|
11034
11064
|
(elm) => "pcb_component_id" in elm && elm.pcb_component_id === memberId
|
|
11035
11065
|
);
|
|
11036
11066
|
transformPCBElements(related, transformMatrix2);
|
|
11067
|
+
updateCadRotation({
|
|
11068
|
+
db,
|
|
11069
|
+
pcbComponentId: memberId,
|
|
11070
|
+
rotationDegrees: rotationDegrees2,
|
|
11071
|
+
layer: member.layer
|
|
11072
|
+
});
|
|
11037
11073
|
}
|
|
11038
11074
|
continue;
|
|
11039
11075
|
}
|
|
@@ -11059,6 +11095,12 @@ var applyPackOutput = (group, packOutput, clusterMap) => {
|
|
|
11059
11095
|
(elm) => "pcb_component_id" in elm && elm.pcb_component_id === componentId
|
|
11060
11096
|
);
|
|
11061
11097
|
transformPCBElements(related, transformMatrix2);
|
|
11098
|
+
updateCadRotation({
|
|
11099
|
+
db,
|
|
11100
|
+
pcbComponentId: componentId,
|
|
11101
|
+
rotationDegrees: rotationDegrees2,
|
|
11102
|
+
layer: pcbComponent.layer
|
|
11103
|
+
});
|
|
11062
11104
|
continue;
|
|
11063
11105
|
}
|
|
11064
11106
|
const pcbGroup = db.pcb_group.list().find((g) => g.source_group_id === componentId);
|
|
@@ -17024,7 +17066,7 @@ import { identity as identity6 } from "transformation-matrix";
|
|
|
17024
17066
|
var package_default = {
|
|
17025
17067
|
name: "@tscircuit/core",
|
|
17026
17068
|
type: "module",
|
|
17027
|
-
version: "0.0.
|
|
17069
|
+
version: "0.0.799",
|
|
17028
17070
|
types: "dist/index.d.ts",
|
|
17029
17071
|
main: "dist/index.js",
|
|
17030
17072
|
module: "dist/index.js",
|
|
@@ -17056,13 +17098,13 @@ var package_default = {
|
|
|
17056
17098
|
"@tscircuit/capacity-autorouter": "^0.0.132",
|
|
17057
17099
|
"@tscircuit/checks": "^0.0.85",
|
|
17058
17100
|
"@tscircuit/circuit-json-util": "^0.0.72",
|
|
17059
|
-
"@tscircuit/common": "^0.0.
|
|
17101
|
+
"@tscircuit/common": "^0.0.14",
|
|
17060
17102
|
"@tscircuit/footprinter": "^0.0.236",
|
|
17061
17103
|
"@tscircuit/import-snippet": "^0.0.4",
|
|
17062
17104
|
"@tscircuit/infgrid-ijump-astar": "^0.0.33",
|
|
17063
17105
|
"@tscircuit/log-soup": "^1.0.2",
|
|
17064
17106
|
"@tscircuit/matchpack": "^0.0.16",
|
|
17065
|
-
"@tscircuit/math-utils": "^0.0.
|
|
17107
|
+
"@tscircuit/math-utils": "^0.0.28",
|
|
17066
17108
|
"@tscircuit/miniflex": "^0.0.4",
|
|
17067
17109
|
"@tscircuit/props": "0.0.369",
|
|
17068
17110
|
"@tscircuit/schematic-autolayout": "^0.0.6",
|
|
@@ -17080,7 +17122,7 @@ var package_default = {
|
|
|
17080
17122
|
"circuit-json": "^0.0.283",
|
|
17081
17123
|
"circuit-json-to-bpc": "^0.0.13",
|
|
17082
17124
|
"circuit-json-to-connectivity-map": "^0.0.22",
|
|
17083
|
-
"circuit-json-to-gltf": "^0.0.
|
|
17125
|
+
"circuit-json-to-gltf": "^0.0.26",
|
|
17084
17126
|
"circuit-json-to-simple-3d": "^0.0.9",
|
|
17085
17127
|
"circuit-to-svg": "^0.0.245",
|
|
17086
17128
|
"circuit-json-to-spice": "^0.0.14",
|
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.800",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -33,13 +33,13 @@
|
|
|
33
33
|
"@tscircuit/capacity-autorouter": "^0.0.132",
|
|
34
34
|
"@tscircuit/checks": "^0.0.85",
|
|
35
35
|
"@tscircuit/circuit-json-util": "^0.0.72",
|
|
36
|
-
"@tscircuit/common": "^0.0.
|
|
36
|
+
"@tscircuit/common": "^0.0.14",
|
|
37
37
|
"@tscircuit/footprinter": "^0.0.236",
|
|
38
38
|
"@tscircuit/import-snippet": "^0.0.4",
|
|
39
39
|
"@tscircuit/infgrid-ijump-astar": "^0.0.33",
|
|
40
40
|
"@tscircuit/log-soup": "^1.0.2",
|
|
41
41
|
"@tscircuit/matchpack": "^0.0.16",
|
|
42
|
-
"@tscircuit/math-utils": "^0.0.
|
|
42
|
+
"@tscircuit/math-utils": "^0.0.28",
|
|
43
43
|
"@tscircuit/miniflex": "^0.0.4",
|
|
44
44
|
"@tscircuit/props": "0.0.369",
|
|
45
45
|
"@tscircuit/schematic-autolayout": "^0.0.6",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"circuit-json": "^0.0.283",
|
|
58
58
|
"circuit-json-to-bpc": "^0.0.13",
|
|
59
59
|
"circuit-json-to-connectivity-map": "^0.0.22",
|
|
60
|
-
"circuit-json-to-gltf": "^0.0.
|
|
60
|
+
"circuit-json-to-gltf": "^0.0.26",
|
|
61
61
|
"circuit-json-to-simple-3d": "^0.0.9",
|
|
62
62
|
"circuit-to-svg": "^0.0.245",
|
|
63
63
|
"circuit-json-to-spice": "^0.0.14",
|