@tscircuit/cli 0.1.1322 → 0.1.1323
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/cli/main.js +639 -440
- package/dist/lib/index.js +306 -107
- package/package.json +2 -2
package/dist/cli/main.js
CHANGED
|
@@ -34389,7 +34389,7 @@ function parseAndConvertSiUnit(v3) {
|
|
|
34389
34389
|
value: conversionFactor * Number.parseFloat(numberPart)
|
|
34390
34390
|
};
|
|
34391
34391
|
}
|
|
34392
|
-
function
|
|
34392
|
+
function applyToPoint22(matrix, point2) {
|
|
34393
34393
|
return Array.isArray(point2) ? [
|
|
34394
34394
|
matrix.a * point2[0] + matrix.c * point2[1] + matrix.e,
|
|
34395
34395
|
matrix.b * point2[0] + matrix.d * point2[1] + matrix.f
|
|
@@ -34440,7 +34440,7 @@ function compose6(...matrices) {
|
|
|
34440
34440
|
function isUndefined2(val) {
|
|
34441
34441
|
return typeof val === "undefined";
|
|
34442
34442
|
}
|
|
34443
|
-
function
|
|
34443
|
+
function rotate8(angle, cx2, cy2) {
|
|
34444
34444
|
const cosAngle = cos(angle);
|
|
34445
34445
|
const sinAngle = sin(angle);
|
|
34446
34446
|
const rotationMatrix = {
|
|
@@ -34461,7 +34461,7 @@ function rotate7(angle, cx2, cy2) {
|
|
|
34461
34461
|
]);
|
|
34462
34462
|
}
|
|
34463
34463
|
function rotateDEG(angle, cx2 = undefined, cy2 = undefined) {
|
|
34464
|
-
return
|
|
34464
|
+
return rotate8(angle * PI / 180, cx2, cy2);
|
|
34465
34465
|
}
|
|
34466
34466
|
function scale5(sx2, sy2 = undefined, cx2 = undefined, cy2 = undefined) {
|
|
34467
34467
|
if (isUndefined2(sy2))
|
|
@@ -34544,7 +34544,7 @@ function fromTriangles(t12, t22) {
|
|
|
34544
34544
|
const affineMatrix = transform([r22, inverseR1]);
|
|
34545
34545
|
return smoothMatrix(affineMatrix);
|
|
34546
34546
|
}
|
|
34547
|
-
function
|
|
34547
|
+
function identity6() {
|
|
34548
34548
|
return {
|
|
34549
34549
|
a: 1,
|
|
34550
34550
|
c: 0,
|
|
@@ -37005,25 +37005,25 @@ var __create3, __defProp3, __getOwnPropDesc2, __getOwnPropNames3, __getProtoOf3,
|
|
|
37005
37005
|
throw new Error(`Invalid sideOrDir: ${sideOrDir}`);
|
|
37006
37006
|
}, transformSchematicElement = (elm, matrix) => {
|
|
37007
37007
|
if (elm.type === "schematic_component") {
|
|
37008
|
-
elm.center =
|
|
37008
|
+
elm.center = applyToPoint22(matrix, elm.center);
|
|
37009
37009
|
} else if (elm.type === "schematic_port") {
|
|
37010
|
-
elm.center =
|
|
37010
|
+
elm.center = applyToPoint22(matrix, elm.center);
|
|
37011
37011
|
if (elm.facing_direction) {
|
|
37012
37012
|
elm.facing_direction = rotateDirection(elm.facing_direction, -(Math.atan2(matrix.b, matrix.a) / Math.PI) * 2);
|
|
37013
37013
|
}
|
|
37014
37014
|
} else if (elm.type === "schematic_text") {
|
|
37015
|
-
elm.position =
|
|
37015
|
+
elm.position = applyToPoint22(matrix, elm.position);
|
|
37016
37016
|
} else if (elm.type === "schematic_trace") {
|
|
37017
37017
|
const anyElm = elm;
|
|
37018
37018
|
anyElm.route = (anyElm.route ?? []).map((rp2) => {
|
|
37019
|
-
const tp2 =
|
|
37019
|
+
const tp2 = applyToPoint22(matrix, rp2);
|
|
37020
37020
|
rp2.x = tp2.x;
|
|
37021
37021
|
rp2.y = tp2.y;
|
|
37022
37022
|
return rp2;
|
|
37023
37023
|
});
|
|
37024
37024
|
if (Array.isArray(anyElm.junctions)) {
|
|
37025
37025
|
anyElm.junctions = anyElm.junctions.map((j2) => {
|
|
37026
|
-
const tp2 =
|
|
37026
|
+
const tp2 = applyToPoint22(matrix, j2);
|
|
37027
37027
|
j2.x = tp2.x;
|
|
37028
37028
|
j2.y = tp2.y;
|
|
37029
37029
|
return j2;
|
|
@@ -37031,18 +37031,18 @@ var __create3, __defProp3, __getOwnPropDesc2, __getOwnPropNames3, __getProtoOf3,
|
|
|
37031
37031
|
}
|
|
37032
37032
|
if (Array.isArray(anyElm.edges)) {
|
|
37033
37033
|
anyElm.edges = anyElm.edges.map((e2) => {
|
|
37034
|
-
e2.from =
|
|
37035
|
-
e2.to =
|
|
37034
|
+
e2.from = applyToPoint22(matrix, e2.from);
|
|
37035
|
+
e2.to = applyToPoint22(matrix, e2.to);
|
|
37036
37036
|
return e2;
|
|
37037
37037
|
});
|
|
37038
37038
|
}
|
|
37039
37039
|
} else if (elm.type === "schematic_box") {
|
|
37040
|
-
const { x: x3, y } =
|
|
37040
|
+
const { x: x3, y } = applyToPoint22(matrix, { x: elm.x, y: elm.y });
|
|
37041
37041
|
elm.x = x3;
|
|
37042
37042
|
elm.y = y;
|
|
37043
37043
|
} else if (elm.type === "schematic_line") {
|
|
37044
|
-
const { x: x12, y: y12 } =
|
|
37045
|
-
const { x: x22, y: y22 } =
|
|
37044
|
+
const { x: x12, y: y12 } = applyToPoint22(matrix, { x: elm.x1, y: elm.y1 });
|
|
37045
|
+
const { x: x22, y: y22 } = applyToPoint22(matrix, { x: elm.x2, y: elm.y2 });
|
|
37046
37046
|
elm.x1 = x12;
|
|
37047
37047
|
elm.y1 = y12;
|
|
37048
37048
|
elm.x2 = x22;
|
|
@@ -37055,7 +37055,7 @@ var __create3, __defProp3, __getOwnPropDesc2, __getOwnPropNames3, __getProtoOf3,
|
|
|
37055
37055
|
const tsr = decomposeTSR(matrix);
|
|
37056
37056
|
const flipPadWidthHeight = Math.round(tsr.rotation.angle / (Math.PI / 2)) % 2 === 1;
|
|
37057
37057
|
if (elm.type === "pcb_plated_hole" || elm.type === "pcb_hole" || elm.type === "pcb_via" || elm.type === "pcb_smtpad" || elm.type === "pcb_port") {
|
|
37058
|
-
const { x: x3, y } =
|
|
37058
|
+
const { x: x3, y } = applyToPoint22(matrix, {
|
|
37059
37059
|
x: Number(elm.x),
|
|
37060
37060
|
y: Number(elm.y)
|
|
37061
37061
|
});
|
|
@@ -37063,7 +37063,7 @@ var __create3, __defProp3, __getOwnPropDesc2, __getOwnPropNames3, __getProtoOf3,
|
|
|
37063
37063
|
elm.y = y;
|
|
37064
37064
|
if (elm.type === "pcb_smtpad" && elm.shape === "polygon" && Array.isArray(elm.points)) {
|
|
37065
37065
|
elm.points = elm.points.map((point2) => {
|
|
37066
|
-
const tp2 =
|
|
37066
|
+
const tp2 = applyToPoint22(matrix, { x: point2.x, y: point2.y });
|
|
37067
37067
|
return {
|
|
37068
37068
|
x: tp2.x,
|
|
37069
37069
|
y: tp2.y
|
|
@@ -37071,13 +37071,13 @@ var __create3, __defProp3, __getOwnPropDesc2, __getOwnPropNames3, __getProtoOf3,
|
|
|
37071
37071
|
});
|
|
37072
37072
|
}
|
|
37073
37073
|
} else if (elm.type === "pcb_keepout" || elm.type === "pcb_board") {
|
|
37074
|
-
elm.center =
|
|
37074
|
+
elm.center = applyToPoint22(matrix, elm.center);
|
|
37075
37075
|
} else if (elm.type === "pcb_silkscreen_text" || elm.type === "pcb_fabrication_note_text" || elm.type === "pcb_note_text") {
|
|
37076
|
-
elm.anchor_position =
|
|
37076
|
+
elm.anchor_position = applyToPoint22(matrix, elm.anchor_position);
|
|
37077
37077
|
} else if (elm.type === "pcb_silkscreen_circle" || elm.type === "pcb_silkscreen_rect" || elm.type === "pcb_note_rect" || elm.type === "pcb_courtyard_rect" || elm.type === "pcb_courtyard_circle") {
|
|
37078
|
-
elm.center =
|
|
37078
|
+
elm.center = applyToPoint22(matrix, elm.center);
|
|
37079
37079
|
} else if (elm.type === "pcb_component") {
|
|
37080
|
-
elm.center =
|
|
37080
|
+
elm.center = applyToPoint22(matrix, elm.center);
|
|
37081
37081
|
elm.rotation = elm.rotation + tsr.rotation.angle / Math.PI * 180;
|
|
37082
37082
|
elm.rotation = elm.rotation % 360;
|
|
37083
37083
|
if (flipPadWidthHeight) {
|
|
@@ -37085,21 +37085,21 @@ var __create3, __defProp3, __getOwnPropDesc2, __getOwnPropNames3, __getProtoOf3,
|
|
|
37085
37085
|
}
|
|
37086
37086
|
} else if (elm.type === "pcb_courtyard_outline") {
|
|
37087
37087
|
elm.outline = elm.outline.map((p) => {
|
|
37088
|
-
const tp2 =
|
|
37088
|
+
const tp2 = applyToPoint22(matrix, p);
|
|
37089
37089
|
p.x = tp2.x;
|
|
37090
37090
|
p.y = tp2.y;
|
|
37091
37091
|
return p;
|
|
37092
37092
|
});
|
|
37093
37093
|
} else if (elm.type === "pcb_courtyard_polygon") {
|
|
37094
37094
|
elm.points = elm.points.map((p) => {
|
|
37095
|
-
const tp2 =
|
|
37095
|
+
const tp2 = applyToPoint22(matrix, p);
|
|
37096
37096
|
p.x = tp2.x;
|
|
37097
37097
|
p.y = tp2.y;
|
|
37098
37098
|
return p;
|
|
37099
37099
|
});
|
|
37100
37100
|
} else if (elm.type === "pcb_silkscreen_path" || elm.type === "pcb_trace" || elm.type === "pcb_fabrication_note_path" || elm.type === "pcb_note_path") {
|
|
37101
37101
|
elm.route = elm.route.map((rp2) => {
|
|
37102
|
-
const tp2 =
|
|
37102
|
+
const tp2 = applyToPoint22(matrix, rp2);
|
|
37103
37103
|
rp2.x = tp2.x;
|
|
37104
37104
|
rp2.y = tp2.y;
|
|
37105
37105
|
return rp2;
|
|
@@ -37107,14 +37107,14 @@ var __create3, __defProp3, __getOwnPropDesc2, __getOwnPropNames3, __getProtoOf3,
|
|
|
37107
37107
|
} else if (elm.type === "pcb_silkscreen_line" || elm.type === "pcb_note_line") {
|
|
37108
37108
|
const p12 = { x: elm.x1, y: elm.y1 };
|
|
37109
37109
|
const p22 = { x: elm.x2, y: elm.y2 };
|
|
37110
|
-
const p1t =
|
|
37111
|
-
const p2t =
|
|
37110
|
+
const p1t = applyToPoint22(matrix, p12);
|
|
37111
|
+
const p2t = applyToPoint22(matrix, p22);
|
|
37112
37112
|
elm.x1 = p1t.x;
|
|
37113
37113
|
elm.y1 = p1t.y;
|
|
37114
37114
|
elm.x2 = p2t.x;
|
|
37115
37115
|
elm.y2 = p2t.y;
|
|
37116
37116
|
} else if (elm.type === "cad_component") {
|
|
37117
|
-
const newPos =
|
|
37117
|
+
const newPos = applyToPoint22(matrix, {
|
|
37118
37118
|
x: elm.position.x,
|
|
37119
37119
|
y: elm.position.y
|
|
37120
37120
|
});
|
|
@@ -46896,7 +46896,7 @@ function createSvgObjectsFromPcbTraceError(pcbTraceError, circuitJson, ctx) {
|
|
|
46896
46896
|
return createSvgObjectsForViaTraceError(pcbTraceError, via, ctx);
|
|
46897
46897
|
}
|
|
46898
46898
|
if (pcbTraceError.center) {
|
|
46899
|
-
const screenCenter =
|
|
46899
|
+
const screenCenter = applyToPoint22(transform2, {
|
|
46900
46900
|
x: pcbTraceError.center.x,
|
|
46901
46901
|
y: pcbTraceError.center.y
|
|
46902
46902
|
});
|
|
@@ -46941,11 +46941,11 @@ function createSvgObjectsFromPcbTraceError(pcbTraceError, circuitJson, ctx) {
|
|
|
46941
46941
|
} else
|
|
46942
46942
|
return [];
|
|
46943
46943
|
}
|
|
46944
|
-
const screenPort1 =
|
|
46944
|
+
const screenPort1 = applyToPoint22(transform2, {
|
|
46945
46945
|
x: port1.x,
|
|
46946
46946
|
y: port1.y
|
|
46947
46947
|
});
|
|
46948
|
-
const screenPort2 =
|
|
46948
|
+
const screenPort2 = applyToPoint22(transform2, {
|
|
46949
46949
|
x: port2.x,
|
|
46950
46950
|
y: port2.y
|
|
46951
46951
|
});
|
|
@@ -47029,11 +47029,11 @@ function createSvgObjectsFromPcbTraceError(pcbTraceError, circuitJson, ctx) {
|
|
|
47029
47029
|
function createSvgObjectsForViaTraceError(pcbTraceError, via, ctx) {
|
|
47030
47030
|
const { transform: transform2 } = ctx;
|
|
47031
47031
|
if (pcbTraceError.center && via) {
|
|
47032
|
-
const screenCenter =
|
|
47032
|
+
const screenCenter = applyToPoint22(transform2, {
|
|
47033
47033
|
x: pcbTraceError.center.x,
|
|
47034
47034
|
y: pcbTraceError.center.y
|
|
47035
47035
|
});
|
|
47036
|
-
const screenVia =
|
|
47036
|
+
const screenVia = applyToPoint22(transform2, {
|
|
47037
47037
|
x: via.x,
|
|
47038
47038
|
y: via.y
|
|
47039
47039
|
});
|
|
@@ -47207,7 +47207,7 @@ function createSvgObjectsFromPcbFootprintOverlapError(error, circuitJson, ctx) {
|
|
|
47207
47207
|
if (filteredReferencedElements.length > 0) {
|
|
47208
47208
|
const centerX = filteredReferencedElements.reduce((sum, el2) => sum + el2.x, 0) / filteredReferencedElements.length;
|
|
47209
47209
|
const centerY = filteredReferencedElements.reduce((sum, el2) => sum + el2.y, 0) / filteredReferencedElements.length;
|
|
47210
|
-
const screenCenter =
|
|
47210
|
+
const screenCenter = applyToPoint22(transform2, { x: centerX, y: centerY });
|
|
47211
47211
|
svgObjects.push({
|
|
47212
47212
|
name: "rect",
|
|
47213
47213
|
type: "element",
|
|
@@ -47245,7 +47245,7 @@ function createSvgObjectsFromPcbFootprintOverlapError(error, circuitJson, ctx) {
|
|
|
47245
47245
|
value: ""
|
|
47246
47246
|
});
|
|
47247
47247
|
for (const element of filteredReferencedElements) {
|
|
47248
|
-
const screenPos =
|
|
47248
|
+
const screenPos = applyToPoint22(transform2, { x: element.x, y: element.y });
|
|
47249
47249
|
svgObjects.push({
|
|
47250
47250
|
name: "rect",
|
|
47251
47251
|
type: "element",
|
|
@@ -47297,7 +47297,7 @@ function createSvgObjectsFromPcbCourtyardOverlapError(error, circuitJson, ctx) {
|
|
|
47297
47297
|
return [];
|
|
47298
47298
|
const midX = componentCenters.reduce((s, c) => s + c.x, 0) / componentCenters.length;
|
|
47299
47299
|
const midY = componentCenters.reduce((s, c) => s + c.y, 0) / componentCenters.length;
|
|
47300
|
-
const screenMid =
|
|
47300
|
+
const screenMid = applyToPoint22(transform2, { x: midX, y: midY });
|
|
47301
47301
|
svgObjects.push({
|
|
47302
47302
|
name: "rect",
|
|
47303
47303
|
type: "element",
|
|
@@ -47339,7 +47339,7 @@ function createSvgObjectsFromPcbCourtyardOverlapError(error, circuitJson, ctx) {
|
|
|
47339
47339
|
value: ""
|
|
47340
47340
|
});
|
|
47341
47341
|
for (const center of componentCenters) {
|
|
47342
|
-
const screenPos =
|
|
47342
|
+
const screenPos = applyToPoint22(transform2, center);
|
|
47343
47343
|
svgObjects.push({
|
|
47344
47344
|
name: "rect",
|
|
47345
47345
|
type: "element",
|
|
@@ -47358,7 +47358,7 @@ function createSvgObjectsFromPcbCourtyardOverlapError(error, circuitJson, ctx) {
|
|
|
47358
47358
|
});
|
|
47359
47359
|
}
|
|
47360
47360
|
if (componentCenters.length === 2) {
|
|
47361
|
-
const mapped = componentCenters.map((c) =>
|
|
47361
|
+
const mapped = componentCenters.map((c) => applyToPoint22(transform2, c));
|
|
47362
47362
|
const s12 = mapped[0];
|
|
47363
47363
|
const s2 = mapped[1];
|
|
47364
47364
|
svgObjects.push({
|
|
@@ -47413,8 +47413,8 @@ function createSvgObjectsFromPcbComponentOutsideBoardError(error, circuitJson, c
|
|
|
47413
47413
|
const bounds = getComponentBounds(error, circuitJson);
|
|
47414
47414
|
if (!bounds)
|
|
47415
47415
|
return [];
|
|
47416
|
-
const topLeft =
|
|
47417
|
-
const bottomRight =
|
|
47416
|
+
const topLeft = applyToPoint22(transform2, { x: bounds.min_x, y: bounds.min_y });
|
|
47417
|
+
const bottomRight = applyToPoint22(transform2, {
|
|
47418
47418
|
x: bounds.max_x,
|
|
47419
47419
|
y: bounds.max_y
|
|
47420
47420
|
});
|
|
@@ -47488,7 +47488,7 @@ function createSvgObjectsFromPcbFabricationNotePath(fabNotePath, ctx) {
|
|
|
47488
47488
|
const lastPoint = fabNotePath.route[fabNotePath.route.length - 1];
|
|
47489
47489
|
const isClosed = firstPoint.x === lastPoint.x && firstPoint.y === lastPoint.y;
|
|
47490
47490
|
const path42 = fabNotePath.route.slice(0, isClosed ? -1 : undefined).map((point2, index) => {
|
|
47491
|
-
const [x3, y] =
|
|
47491
|
+
const [x3, y] = applyToPoint22(transform2, [point2.x, point2.y]);
|
|
47492
47492
|
return index === 0 ? `M ${x3} ${y}` : `L ${x3} ${y}`;
|
|
47493
47493
|
}).join(" ") + (isClosed ? " Z" : "");
|
|
47494
47494
|
return [
|
|
@@ -47527,7 +47527,7 @@ function createSvgObjectsFromPcbFabricationNoteText(pcbFabNoteText, ctx) {
|
|
|
47527
47527
|
debugPcb(`[pcb_fabrication_note_text] Invalid anchor_position for "${pcbFabNoteText.pcb_fabrication_note_text_id}": expected {x: number, y: number}, got ${JSON.stringify(anchor_position)}`);
|
|
47528
47528
|
return [];
|
|
47529
47529
|
}
|
|
47530
|
-
const [transformedX, transformedY] =
|
|
47530
|
+
const [transformedX, transformedY] = applyToPoint22(transform2, [
|
|
47531
47531
|
anchor_position.x,
|
|
47532
47532
|
anchor_position.y
|
|
47533
47533
|
]);
|
|
@@ -47552,7 +47552,7 @@ function createSvgObjectsFromPcbFabricationNoteText(pcbFabNoteText, ctx) {
|
|
|
47552
47552
|
dominantBaseline = "text-after-edge";
|
|
47553
47553
|
break;
|
|
47554
47554
|
}
|
|
47555
|
-
const textTransform = compose6(translate6(transformedX, transformedY),
|
|
47555
|
+
const textTransform = compose6(translate6(transformedX, transformedY), rotate8(Math.PI / 180));
|
|
47556
47556
|
const svgObject = {
|
|
47557
47557
|
name: "text",
|
|
47558
47558
|
type: "element",
|
|
@@ -47606,11 +47606,11 @@ function createSvgObjectsFromPcbFabricationNoteRect(fabricationNoteRect, ctx) {
|
|
|
47606
47606
|
}
|
|
47607
47607
|
const halfWidth = width / 2;
|
|
47608
47608
|
const halfHeight = height / 2;
|
|
47609
|
-
const [topLeftX, topLeftY] =
|
|
47609
|
+
const [topLeftX, topLeftY] = applyToPoint22(transform2, [
|
|
47610
47610
|
center.x - halfWidth,
|
|
47611
47611
|
center.y + halfHeight
|
|
47612
47612
|
]);
|
|
47613
|
-
const [bottomRightX, bottomRightY] =
|
|
47613
|
+
const [bottomRightX, bottomRightY] = applyToPoint22(transform2, [
|
|
47614
47614
|
center.x + halfWidth,
|
|
47615
47615
|
center.y - halfHeight
|
|
47616
47616
|
]);
|
|
@@ -47757,11 +47757,11 @@ function createSvgObjectsFromPcbFabricationNoteDimension(dimension, ctx) {
|
|
|
47757
47757
|
y: toBase.y - perpendicular.y * arrowHalfWidth
|
|
47758
47758
|
})
|
|
47759
47759
|
];
|
|
47760
|
-
const [lineStartX, lineStartY] =
|
|
47760
|
+
const [lineStartX, lineStartY] = applyToPoint22(transform2, [
|
|
47761
47761
|
fromBase.x,
|
|
47762
47762
|
fromBase.y
|
|
47763
47763
|
]);
|
|
47764
|
-
const [lineEndX, lineEndY] =
|
|
47764
|
+
const [lineEndX, lineEndY] = applyToPoint22(transform2, [toBase.x, toBase.y]);
|
|
47765
47765
|
const strokeWidth = arrowSize / 5 * Math.abs(transform2.a);
|
|
47766
47766
|
const lineColor = color || "rgba(255,255,255,0.5)";
|
|
47767
47767
|
const extensionDirection = hasOffsetDirection && (Math.abs(normalizedOffsetDirection.x) > Number.EPSILON || Math.abs(normalizedOffsetDirection.y) > Number.EPSILON) ? normalizedOffsetDirection : perpendicular;
|
|
@@ -47771,8 +47771,8 @@ function createSvgObjectsFromPcbFabricationNoteDimension(dimension, ctx) {
|
|
|
47771
47771
|
x: anchor.x + extensionDirection.x * extensionLength,
|
|
47772
47772
|
y: anchor.y + extensionDirection.y * extensionLength
|
|
47773
47773
|
};
|
|
47774
|
-
const [startX, startY] =
|
|
47775
|
-
const [endX, endY] =
|
|
47774
|
+
const [startX, startY] = applyToPoint22(transform2, [anchor.x, anchor.y]);
|
|
47775
|
+
const [endX, endY] = applyToPoint22(transform2, [endPoint.x, endPoint.y]);
|
|
47776
47776
|
return {
|
|
47777
47777
|
name: "path",
|
|
47778
47778
|
type: "element",
|
|
@@ -47793,11 +47793,11 @@ function createSvgObjectsFromPcbFabricationNoteDimension(dimension, ctx) {
|
|
|
47793
47793
|
x: (from.x + to2.x) / 2 + offsetVector.x,
|
|
47794
47794
|
y: (from.y + to2.y) / 2 + offsetVector.y
|
|
47795
47795
|
};
|
|
47796
|
-
const [screenFromX, screenFromY] =
|
|
47796
|
+
const [screenFromX, screenFromY] = applyToPoint22(transform2, [
|
|
47797
47797
|
fromOffset.x,
|
|
47798
47798
|
fromOffset.y
|
|
47799
47799
|
]);
|
|
47800
|
-
const [screenToX, screenToY] =
|
|
47800
|
+
const [screenToX, screenToY] = applyToPoint22(transform2, [
|
|
47801
47801
|
toOffset.x,
|
|
47802
47802
|
toOffset.y
|
|
47803
47803
|
]);
|
|
@@ -47827,7 +47827,7 @@ function createSvgObjectsFromPcbFabricationNoteDimension(dimension, ctx) {
|
|
|
47827
47827
|
x: midPoint.x + perpendicular.x * textOffset,
|
|
47828
47828
|
y: midPoint.y + perpendicular.y * textOffset
|
|
47829
47829
|
};
|
|
47830
|
-
const [textX, textY] =
|
|
47830
|
+
const [textX, textY] = applyToPoint22(transform2, [textPoint.x, textPoint.y]);
|
|
47831
47831
|
const transformedFontSize = font_size * Math.abs(transform2.a);
|
|
47832
47832
|
const children = [
|
|
47833
47833
|
...extensionSegments,
|
|
@@ -47914,7 +47914,7 @@ function createSvgObjectsFromPcbFabricationNoteDimension(dimension, ctx) {
|
|
|
47914
47914
|
}
|
|
47915
47915
|
];
|
|
47916
47916
|
function toScreen(point2) {
|
|
47917
|
-
const [x3, y] =
|
|
47917
|
+
const [x3, y] = applyToPoint22(transform2, [point2.x, point2.y]);
|
|
47918
47918
|
return { x: x3, y };
|
|
47919
47919
|
}
|
|
47920
47920
|
}
|
|
@@ -47995,11 +47995,11 @@ function createSvgObjectsFromPcbNoteDimension(dimension, ctx) {
|
|
|
47995
47995
|
y: toBase.y - perpendicular.y * arrowHalfWidth
|
|
47996
47996
|
})
|
|
47997
47997
|
];
|
|
47998
|
-
const [lineStartX, lineStartY] =
|
|
47998
|
+
const [lineStartX, lineStartY] = applyToPoint22(transform2, [
|
|
47999
47999
|
fromBase.x,
|
|
48000
48000
|
fromBase.y
|
|
48001
48001
|
]);
|
|
48002
|
-
const [lineEndX, lineEndY] =
|
|
48002
|
+
const [lineEndX, lineEndY] = applyToPoint22(transform2, [toBase.x, toBase.y]);
|
|
48003
48003
|
const strokeWidth = arrow_size / 5 * Math.abs(transform2.a);
|
|
48004
48004
|
const lineColor = color || colorMap.board.user_2;
|
|
48005
48005
|
const extensionDirection = hasOffsetDirection && (Math.abs(normalizedOffsetDirection.x) > Number.EPSILON || Math.abs(normalizedOffsetDirection.y) > Number.EPSILON) ? normalizedOffsetDirection : perpendicular;
|
|
@@ -48009,8 +48009,8 @@ function createSvgObjectsFromPcbNoteDimension(dimension, ctx) {
|
|
|
48009
48009
|
x: anchor.x + extensionDirection.x * extensionLength,
|
|
48010
48010
|
y: anchor.y + extensionDirection.y * extensionLength
|
|
48011
48011
|
};
|
|
48012
|
-
const [startX, startY] =
|
|
48013
|
-
const [endX, endY] =
|
|
48012
|
+
const [startX, startY] = applyToPoint22(transform2, [anchor.x, anchor.y]);
|
|
48013
|
+
const [endX, endY] = applyToPoint22(transform2, [endPoint.x, endPoint.y]);
|
|
48014
48014
|
return {
|
|
48015
48015
|
name: "path",
|
|
48016
48016
|
type: "element",
|
|
@@ -48031,11 +48031,11 @@ function createSvgObjectsFromPcbNoteDimension(dimension, ctx) {
|
|
|
48031
48031
|
x: (from.x + to2.x) / 2 + offsetVector.x,
|
|
48032
48032
|
y: (from.y + to2.y) / 2 + offsetVector.y
|
|
48033
48033
|
};
|
|
48034
|
-
const [screenFromX, screenFromY] =
|
|
48034
|
+
const [screenFromX, screenFromY] = applyToPoint22(transform2, [
|
|
48035
48035
|
fromOffset.x,
|
|
48036
48036
|
fromOffset.y
|
|
48037
48037
|
]);
|
|
48038
|
-
const [screenToX, screenToY] =
|
|
48038
|
+
const [screenToX, screenToY] = applyToPoint22(transform2, [
|
|
48039
48039
|
toOffset.x,
|
|
48040
48040
|
toOffset.y
|
|
48041
48041
|
]);
|
|
@@ -48065,7 +48065,7 @@ function createSvgObjectsFromPcbNoteDimension(dimension, ctx) {
|
|
|
48065
48065
|
x: midPoint.x + perpendicular.x * textOffset,
|
|
48066
48066
|
y: midPoint.y + perpendicular.y * textOffset
|
|
48067
48067
|
};
|
|
48068
|
-
const [textX, textY] =
|
|
48068
|
+
const [textX, textY] = applyToPoint22(transform2, [textPoint.x, textPoint.y]);
|
|
48069
48069
|
const transformedFontSize = font_size * Math.abs(transform2.a);
|
|
48070
48070
|
const children = [
|
|
48071
48071
|
...extensionSegments,
|
|
@@ -48148,7 +48148,7 @@ function createSvgObjectsFromPcbNoteDimension(dimension, ctx) {
|
|
|
48148
48148
|
}
|
|
48149
48149
|
];
|
|
48150
48150
|
function toScreen(point2) {
|
|
48151
|
-
const [x3, y] =
|
|
48151
|
+
const [x3, y] = applyToPoint22(transform2, [point2.x, point2.y]);
|
|
48152
48152
|
return { x: x3, y };
|
|
48153
48153
|
}
|
|
48154
48154
|
}
|
|
@@ -48169,7 +48169,7 @@ function createSvgObjectsFromPcbNoteText(note, ctx) {
|
|
|
48169
48169
|
debugPcb(`[pcb_note_text] Invalid text for "${note.pcb_note_text_id}": expected non-empty string, got ${JSON.stringify(text)}`);
|
|
48170
48170
|
return [];
|
|
48171
48171
|
}
|
|
48172
|
-
const [x3, y] =
|
|
48172
|
+
const [x3, y] = applyToPoint22(transform2, [anchor_position.x, anchor_position.y]);
|
|
48173
48173
|
const transformedFontSize = font_size * Math.abs(transform2.a);
|
|
48174
48174
|
let textAnchor = "middle";
|
|
48175
48175
|
let dominantBaseline = "central";
|
|
@@ -48264,11 +48264,11 @@ function createSvgObjectsFromPcbNoteRect(noteRect, ctx) {
|
|
|
48264
48264
|
}
|
|
48265
48265
|
const halfWidth = width / 2;
|
|
48266
48266
|
const halfHeight = height / 2;
|
|
48267
|
-
const [topLeftX, topLeftY] =
|
|
48267
|
+
const [topLeftX, topLeftY] = applyToPoint22(transform2, [
|
|
48268
48268
|
center.x - halfWidth,
|
|
48269
48269
|
center.y + halfHeight
|
|
48270
48270
|
]);
|
|
48271
|
-
const [bottomRightX, bottomRightY] =
|
|
48271
|
+
const [bottomRightX, bottomRightY] = applyToPoint22(transform2, [
|
|
48272
48272
|
center.x + halfWidth,
|
|
48273
48273
|
center.y - halfHeight
|
|
48274
48274
|
]);
|
|
@@ -48337,7 +48337,7 @@ function createSvgObjectsFromPcbNotePath(notePath, ctx) {
|
|
|
48337
48337
|
}
|
|
48338
48338
|
}
|
|
48339
48339
|
const pathD = notePath.route.map((point2, index) => {
|
|
48340
|
-
const [x3, y] =
|
|
48340
|
+
const [x3, y] = applyToPoint22(transform2, [point2.x, point2.y]);
|
|
48341
48341
|
return index === 0 ? `M ${x3} ${y}` : `L ${x3} ${y}`;
|
|
48342
48342
|
}).join(" ");
|
|
48343
48343
|
const strokeWidth = notePath.stroke_width * Math.abs(transform2.a);
|
|
@@ -48366,8 +48366,8 @@ function createSvgObjectsFromPcbNoteLine(noteLine, ctx) {
|
|
|
48366
48366
|
debugPcb(`[pcb_note_line] Invalid coordinates for "${noteLine.pcb_note_line_id}": expected x1, y1, x2, y2 as numbers, got x1=${JSON.stringify(x12)}, y1=${JSON.stringify(y12)}, x2=${JSON.stringify(x22)}, y2=${JSON.stringify(y22)}`);
|
|
48367
48367
|
return [];
|
|
48368
48368
|
}
|
|
48369
|
-
const [startX, startY] =
|
|
48370
|
-
const [endX, endY] =
|
|
48369
|
+
const [startX, startY] = applyToPoint22(transform2, [x12, y12]);
|
|
48370
|
+
const [endX, endY] = applyToPoint22(transform2, [x22, y22]);
|
|
48371
48371
|
const baseStrokeWidth = typeof stroke_width === "number" ? stroke_width : 0;
|
|
48372
48372
|
const transformedStrokeWidth = baseStrokeWidth * Math.abs(transform2.a);
|
|
48373
48373
|
const attributes = {
|
|
@@ -48399,7 +48399,7 @@ function createSvgObjectsFromPcbNoteLine(noteLine, ctx) {
|
|
|
48399
48399
|
}
|
|
48400
48400
|
function createSvgObjectsFromPcbPlatedHole(hole, ctx) {
|
|
48401
48401
|
const { transform: transform2, colorMap: colorMap2, showSolderMask } = ctx;
|
|
48402
|
-
const [x3, y] =
|
|
48402
|
+
const [x3, y] = applyToPoint22(transform2, [hole.x, hole.y]);
|
|
48403
48403
|
const layer = Array.isArray(hole.layers) && hole.layers[0] || hole.layer || "top";
|
|
48404
48404
|
const maskLayer = layer;
|
|
48405
48405
|
const isCoveredWithSolderMask = Boolean(hole.is_covered_with_solder_mask);
|
|
@@ -48697,7 +48697,7 @@ function createSvgObjectsFromPcbPlatedHole(hole, ctx) {
|
|
|
48697
48697
|
const xStr = rotation2 ? (-scaledRectPadWidth / 2).toString() : (x3 - scaledRectPadWidth / 2).toString();
|
|
48698
48698
|
const yStr = rotation2 ? (-scaledRectPadHeight / 2).toString() : (y - scaledRectPadHeight / 2).toString();
|
|
48699
48699
|
const holeRadius = scaledHoleDiameter / 2;
|
|
48700
|
-
const [holeCx, holeCy] =
|
|
48700
|
+
const [holeCx, holeCy] = applyToPoint22(transform2, [
|
|
48701
48701
|
h.x + (h.hole_offset_x ?? 0),
|
|
48702
48702
|
h.y + (h.hole_offset_y ?? 0)
|
|
48703
48703
|
]);
|
|
@@ -48860,7 +48860,7 @@ function createSvgObjectsFromPcbPlatedHole(hole, ctx) {
|
|
|
48860
48860
|
const pillHoleWithOffsets = pillHole;
|
|
48861
48861
|
const holeOffsetX = pillHoleWithOffsets.hole_offset_x ?? 0;
|
|
48862
48862
|
const holeOffsetY = pillHoleWithOffsets.hole_offset_y ?? 0;
|
|
48863
|
-
const [holeCenterX, holeCenterY] =
|
|
48863
|
+
const [holeCenterX, holeCenterY] = applyToPoint22(transform2, [
|
|
48864
48864
|
pillHole.x + holeOffsetX,
|
|
48865
48865
|
pillHole.y + holeOffsetY
|
|
48866
48866
|
]);
|
|
@@ -48999,7 +48999,7 @@ function createSvgObjectsFromPcbPlatedHole(hole, ctx) {
|
|
|
48999
48999
|
const rotatedHoleWithOffsets = rotatedHole;
|
|
49000
49000
|
const holeOffsetX = rotatedHoleWithOffsets.hole_offset_x ?? 0;
|
|
49001
49001
|
const holeOffsetY = rotatedHoleWithOffsets.hole_offset_y ?? 0;
|
|
49002
|
-
const [holeCenterX, holeCenterY] =
|
|
49002
|
+
const [holeCenterX, holeCenterY] = applyToPoint22(transform2, [
|
|
49003
49003
|
rotatedHole.x + holeOffsetX,
|
|
49004
49004
|
rotatedHole.y + holeOffsetY
|
|
49005
49005
|
]);
|
|
@@ -49138,9 +49138,9 @@ function createSvgObjectsFromPcbPlatedHole(hole, ctx) {
|
|
|
49138
49138
|
const padOutline = polygonHole.pad_outline || [];
|
|
49139
49139
|
const holeX = polygonHole.x ?? 0;
|
|
49140
49140
|
const holeY = polygonHole.y ?? 0;
|
|
49141
|
-
const padPoints = padOutline.map((point2) =>
|
|
49141
|
+
const padPoints = padOutline.map((point2) => applyToPoint22(transform2, [holeX + point2.x, holeY + point2.y]));
|
|
49142
49142
|
const padPointsString = padPoints.map((p) => p.join(",")).join(" ");
|
|
49143
|
-
const [holeCenterX, holeCenterY] =
|
|
49143
|
+
const [holeCenterX, holeCenterY] = applyToPoint22(transform2, [
|
|
49144
49144
|
holeX + polygonHole.hole_offset_x,
|
|
49145
49145
|
holeY + polygonHole.hole_offset_y
|
|
49146
49146
|
]);
|
|
@@ -49251,7 +49251,7 @@ function createSvgObjectsFromPcbSilkscreenPath(silkscreenPath, ctx) {
|
|
|
49251
49251
|
if (!silkscreenPath.route || !Array.isArray(silkscreenPath.route))
|
|
49252
49252
|
return [];
|
|
49253
49253
|
let path42 = silkscreenPath.route.map((point2, index) => {
|
|
49254
|
-
const [x3, y] =
|
|
49254
|
+
const [x3, y] = applyToPoint22(transform2, [point2.x, point2.y]);
|
|
49255
49255
|
return index === 0 ? `M ${x3} ${y}` : `L ${x3} ${y}`;
|
|
49256
49256
|
}).join(" ");
|
|
49257
49257
|
const firstPoint = silkscreenPath.route[0];
|
|
@@ -49361,7 +49361,7 @@ function createSvgObjectsFromPcbSilkscreenText(pcbSilkscreenText, ctx) {
|
|
|
49361
49361
|
debugPcb(`[pcb_silkscreen_text] Invalid anchor_position for "${pcbSilkscreenText.pcb_silkscreen_text_id}": expected {x: number, y: number}, got ${JSON.stringify(anchor_position)}`);
|
|
49362
49362
|
return [];
|
|
49363
49363
|
}
|
|
49364
|
-
const [transformedX, transformedY] =
|
|
49364
|
+
const [transformedX, transformedY] = applyToPoint22(transform2, [
|
|
49365
49365
|
anchor_position.x,
|
|
49366
49366
|
anchor_position.y
|
|
49367
49367
|
]);
|
|
@@ -49381,7 +49381,7 @@ function createSvgObjectsFromPcbSilkscreenText(pcbSilkscreenText, ctx) {
|
|
|
49381
49381
|
const rectW = width + padLeft + padRight;
|
|
49382
49382
|
const rectH = height + padTop + padBottom;
|
|
49383
49383
|
const strokeWidth = scaledFontSize * 0.15;
|
|
49384
|
-
const knockoutTransform = toString(compose6(translate6(transformedX, transformedY),
|
|
49384
|
+
const knockoutTransform = toString(compose6(translate6(transformedX, transformedY), rotate8(-ccw_rotation * Math.PI / 180), ...applyMirror ? [scale5(-1, 1)] : [], scale5(scaleFactor, scaleFactor)));
|
|
49385
49385
|
const maskId = `silkscreen-knockout-mask-${pcbSilkscreenText.pcb_silkscreen_text_id}-${silkscreenMaskIdCounter++}`;
|
|
49386
49386
|
return [
|
|
49387
49387
|
{
|
|
@@ -49494,7 +49494,7 @@ function createSvgObjectsFromPcbSilkscreenText(pcbSilkscreenText, ctx) {
|
|
|
49494
49494
|
dominantBaseline = "central";
|
|
49495
49495
|
break;
|
|
49496
49496
|
}
|
|
49497
|
-
const textTransform = compose6(translate6(transformedX, transformedY),
|
|
49497
|
+
const textTransform = compose6(translate6(transformedX, transformedY), rotate8(-ccw_rotation * Math.PI / 180), ...layer === "bottom" ? [scale5(-1, 1)] : []);
|
|
49498
49498
|
const lines = text.split(`
|
|
49499
49499
|
`);
|
|
49500
49500
|
const children = lines.length === 1 ? [
|
|
@@ -49569,7 +49569,7 @@ function createSvgObjectsFromPcbSilkscreenRect(pcbSilkscreenRect, ctx) {
|
|
|
49569
49569
|
debugPcb(`[pcb_silkscreen_rect] Invalid data for "${pcb_silkscreen_rect_id}": expected center {x: number, y: number}, width: number, height: number, got center=${JSON.stringify(center)}, width=${JSON.stringify(width)}, height=${JSON.stringify(height)}`);
|
|
49570
49570
|
return [];
|
|
49571
49571
|
}
|
|
49572
|
-
const [transformedX, transformedY] =
|
|
49572
|
+
const [transformedX, transformedY] = applyToPoint22(transform2, [
|
|
49573
49573
|
center.x,
|
|
49574
49574
|
center.y
|
|
49575
49575
|
]);
|
|
@@ -49719,7 +49719,7 @@ function createSvgObjectsFromPcbCopperText(pcbCopperText, ctx) {
|
|
|
49719
49719
|
return [];
|
|
49720
49720
|
if (!anchor_position)
|
|
49721
49721
|
return [];
|
|
49722
|
-
const [ax2, ay2] =
|
|
49722
|
+
const [ax2, ay2] = applyToPoint22(transform2, [
|
|
49723
49723
|
anchor_position.x,
|
|
49724
49724
|
anchor_position.y
|
|
49725
49725
|
]);
|
|
@@ -49736,7 +49736,7 @@ function createSvgObjectsFromPcbCopperText(pcbCopperText, ctx) {
|
|
|
49736
49736
|
const rectW = width2 + padX * 2;
|
|
49737
49737
|
const rectH = height2 + padY * 2;
|
|
49738
49738
|
const strokeWidth2 = scaledFontSize2 * 0.15;
|
|
49739
|
-
const knockoutTransform = toString(compose6(translate6(ax2, ay2),
|
|
49739
|
+
const knockoutTransform = toString(compose6(translate6(ax2, ay2), rotate8(-ccw_rotation * Math.PI / 180), ...applyMirror ? [scale5(-1, 1)] : [], scale5(scaleFactor, scaleFactor)));
|
|
49740
49740
|
const maskId = `knockout-mask-${pcbCopperText.pcb_copper_text_id}-${maskIdCounter++}`;
|
|
49741
49741
|
return [
|
|
49742
49742
|
{
|
|
@@ -49838,7 +49838,7 @@ function createSvgObjectsFromPcbCopperText(pcbCopperText, ctx) {
|
|
|
49838
49838
|
offsetY = -height / 2;
|
|
49839
49839
|
break;
|
|
49840
49840
|
}
|
|
49841
|
-
const textTransform = toString(compose6(translate6(ax2, ay2),
|
|
49841
|
+
const textTransform = toString(compose6(translate6(ax2, ay2), rotate8(-ccw_rotation * Math.PI / 180), ...applyMirror ? [scale5(-1, 1)] : [], translate6(offsetX, offsetY), scale5(scaleFactor, scaleFactor)));
|
|
49842
49842
|
const strokeWidth = scaledFontSize * 0.15;
|
|
49843
49843
|
return [
|
|
49844
49844
|
{
|
|
@@ -49876,7 +49876,7 @@ function createSvgObjectsFromPcbSilkscreenCircle(pcbSilkscreenCircle, ctx) {
|
|
|
49876
49876
|
console.error("Invalid PCB Silkscreen Circle data:", { center, radius });
|
|
49877
49877
|
return [];
|
|
49878
49878
|
}
|
|
49879
|
-
const [transformedX, transformedY] =
|
|
49879
|
+
const [transformedX, transformedY] = applyToPoint22(transform2, [
|
|
49880
49880
|
center.x,
|
|
49881
49881
|
center.y
|
|
49882
49882
|
]);
|
|
@@ -49919,8 +49919,8 @@ function createSvgObjectsFromPcbSilkscreenLine(pcbSilkscreenLine, ctx) {
|
|
|
49919
49919
|
debugPcb(`[pcb_silkscreen_line] Invalid coordinates for "${pcb_silkscreen_line_id}": expected x1, y1, x2, y2 as numbers, got x1=${JSON.stringify(x12)}, y1=${JSON.stringify(y12)}, x2=${JSON.stringify(x22)}, y2=${JSON.stringify(y22)}`);
|
|
49920
49920
|
return [];
|
|
49921
49921
|
}
|
|
49922
|
-
const [transformedX1, transformedY1] =
|
|
49923
|
-
const [transformedX2, transformedY2] =
|
|
49922
|
+
const [transformedX1, transformedY1] = applyToPoint22(transform2, [x12, y12]);
|
|
49923
|
+
const [transformedX2, transformedY2] = applyToPoint22(transform2, [x22, y22]);
|
|
49924
49924
|
const transformedStrokeWidth = stroke_width * Math.abs(transform2.a);
|
|
49925
49925
|
const color = layer === "bottom" ? colorMap2.silkscreen.bottom : colorMap2.silkscreen.top;
|
|
49926
49926
|
return [
|
|
@@ -49955,7 +49955,7 @@ function createSvgObjectsFromPcbSilkscreenPill(pcbSilkscreenPill, ctx) {
|
|
|
49955
49955
|
} = pcbSilkscreenPill;
|
|
49956
49956
|
if (layerFilter && layer !== layerFilter)
|
|
49957
49957
|
return [];
|
|
49958
|
-
const [transformedX, transformedY] =
|
|
49958
|
+
const [transformedX, transformedY] = applyToPoint22(transform2, [
|
|
49959
49959
|
center.x,
|
|
49960
49960
|
center.y
|
|
49961
49961
|
]);
|
|
@@ -50005,7 +50005,7 @@ function createSvgObjectsFromPcbSilkscreenOval(pcbSilkscreenOval, ctx) {
|
|
|
50005
50005
|
debugPcb(`[pcb_silkscreen_oval] Invalid data for "${pcb_silkscreen_oval_id}": expected center {x: number, y: number}, radius_x: number, radius_y: number, got center=${JSON.stringify(center)}, radius_x=${JSON.stringify(radius_x)}, radius_y=${JSON.stringify(radius_y)}`);
|
|
50006
50006
|
return [];
|
|
50007
50007
|
}
|
|
50008
|
-
const [transformedX, transformedY] =
|
|
50008
|
+
const [transformedX, transformedY] = applyToPoint22(transform2, [
|
|
50009
50009
|
center.x,
|
|
50010
50010
|
center.y
|
|
50011
50011
|
]);
|
|
@@ -50052,7 +50052,7 @@ function createSvgObjectsFromPcbCourtyardRect(pcbCourtyardRect, ctx) {
|
|
|
50052
50052
|
debugPcb(`[pcb_courtyard_rect] Invalid data for "${pcb_courtyard_rect_id}": expected center {x: number, y: number}, width: number, height: number, got center=${JSON.stringify(center)}, width=${JSON.stringify(width)}, height=${JSON.stringify(height)}`);
|
|
50053
50053
|
return [];
|
|
50054
50054
|
}
|
|
50055
|
-
const [transformedX, transformedY] =
|
|
50055
|
+
const [transformedX, transformedY] = applyToPoint22(transform2, [
|
|
50056
50056
|
center.x,
|
|
50057
50057
|
center.y
|
|
50058
50058
|
]);
|
|
@@ -50102,7 +50102,7 @@ function createSvgObjectsFromPcbCourtyardPolygon(pcbCourtyardPolygon, ctx) {
|
|
|
50102
50102
|
debugPcb(`[pcb_courtyard_polygon] Invalid data for "${pcb_courtyard_polygon_id}": expected non-empty array of points, got ${JSON.stringify(points)}`);
|
|
50103
50103
|
return [];
|
|
50104
50104
|
}
|
|
50105
|
-
const transformedPoints = points.map((p) =>
|
|
50105
|
+
const transformedPoints = points.map((p) => applyToPoint22(transform2, [p.x, p.y]));
|
|
50106
50106
|
const pointsString = transformedPoints.map((p) => `${p[0]},${p[1]}`).join(" ");
|
|
50107
50107
|
const transformedStrokeWidth = 0.05 * Math.abs(transform2.a);
|
|
50108
50108
|
const strokeColor = color ?? (layer === "bottom" ? colorMap2.courtyard.bottom : colorMap2.courtyard.top);
|
|
@@ -50134,7 +50134,7 @@ function createSvgObjectsFromPcbCourtyardOutline(pcbCourtyardOutline, ctx) {
|
|
|
50134
50134
|
debugPcb(`[pcb_courtyard_outline] Invalid data for "${pcb_courtyard_outline_id}": expected non-empty array of points, got ${JSON.stringify(outline)}`);
|
|
50135
50135
|
return [];
|
|
50136
50136
|
}
|
|
50137
|
-
const transformedPoints = outline.map((p) =>
|
|
50137
|
+
const transformedPoints = outline.map((p) => applyToPoint22(transform2, [p.x, p.y]));
|
|
50138
50138
|
const pointsString = transformedPoints.map((p) => `${p[0]},${p[1]}`).join(" ");
|
|
50139
50139
|
const transformedStrokeWidth = 0.05 * Math.abs(transform2.a);
|
|
50140
50140
|
const strokeColor = layer === "bottom" ? colorMap2.courtyard.bottom : colorMap2.courtyard.top;
|
|
@@ -50171,7 +50171,7 @@ function createSvgObjectsFromPcbCourtyardCircle(pcbCourtyardCircle, ctx) {
|
|
|
50171
50171
|
console.error(`[pcb_courtyard_circle] Invalid data for "${pcb_courtyard_circle_id}": expected center {x: number, y: number}, radius: number, got center=${JSON.stringify(center)}, radius=${JSON.stringify(radius)}`);
|
|
50172
50172
|
return [];
|
|
50173
50173
|
}
|
|
50174
|
-
const [transformedX, transformedY] =
|
|
50174
|
+
const [transformedX, transformedY] = applyToPoint22(transform2, [
|
|
50175
50175
|
center.x,
|
|
50176
50176
|
center.y
|
|
50177
50177
|
]);
|
|
@@ -50216,8 +50216,8 @@ function createSvgObjectsFromPcbTrace(trace, ctx) {
|
|
|
50216
50216
|
if (start.is_inside_copper_pour === true && end.is_inside_copper_pour === true) {
|
|
50217
50217
|
continue;
|
|
50218
50218
|
}
|
|
50219
|
-
const startPoint =
|
|
50220
|
-
const endPoint =
|
|
50219
|
+
const startPoint = applyToPoint22(transform2, [start.x, start.y]);
|
|
50220
|
+
const endPoint = applyToPoint22(transform2, [end.x, end.y]);
|
|
50221
50221
|
const layer = "layer" in start ? start.layer : ("layer" in end) ? end.layer : null;
|
|
50222
50222
|
if (!layer)
|
|
50223
50223
|
continue;
|
|
@@ -50283,7 +50283,7 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
|
|
|
50283
50283
|
if (pad.shape === "rect" || pad.shape === "rotated_rect") {
|
|
50284
50284
|
const width = pad.width * Math.abs(transform2.a);
|
|
50285
50285
|
const height = pad.height * Math.abs(transform2.d);
|
|
50286
|
-
const [x3, y] =
|
|
50286
|
+
const [x3, y] = applyToPoint22(transform2, [pad.x, pad.y]);
|
|
50287
50287
|
const cornerRadiusValue = pad.corner_radius ?? pad.rect_border_radius ?? 0;
|
|
50288
50288
|
const scaledBorderRadius = cornerRadiusValue * Math.abs(transform2.a);
|
|
50289
50289
|
const m = {
|
|
@@ -50533,7 +50533,7 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
|
|
|
50533
50533
|
const width = pad.width * Math.abs(transform2.a);
|
|
50534
50534
|
const height = pad.height * Math.abs(transform2.d);
|
|
50535
50535
|
const radius = pad.radius * Math.abs(transform2.a);
|
|
50536
|
-
const [x3, y] =
|
|
50536
|
+
const [x3, y] = applyToPoint22(transform2, [pad.x, pad.y]);
|
|
50537
50537
|
const rotationTransformAttributes = isRotated ? {
|
|
50538
50538
|
transform: `translate(${x3} ${y}) rotate(${-(pad.ccw_rotation ?? 0)})`
|
|
50539
50539
|
} : undefined;
|
|
@@ -50651,7 +50651,7 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
|
|
|
50651
50651
|
}
|
|
50652
50652
|
if (pad.shape === "circle") {
|
|
50653
50653
|
const radius = pad.radius * Math.abs(transform2.a);
|
|
50654
|
-
const [x3, y] =
|
|
50654
|
+
const [x3, y] = applyToPoint22(transform2, [pad.x, pad.y]);
|
|
50655
50655
|
const padElement = {
|
|
50656
50656
|
name: "circle",
|
|
50657
50657
|
type: "element",
|
|
@@ -50740,7 +50740,7 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
|
|
|
50740
50740
|
return [substrateElement, padElement];
|
|
50741
50741
|
}
|
|
50742
50742
|
if (pad.shape === "polygon") {
|
|
50743
|
-
const points = (pad.points ?? []).map((point2) =>
|
|
50743
|
+
const points = (pad.points ?? []).map((point2) => applyToPoint22(transform2, [point2.x, point2.y]));
|
|
50744
50744
|
const padElement = {
|
|
50745
50745
|
name: "polygon",
|
|
50746
50746
|
type: "element",
|
|
@@ -50848,11 +50848,11 @@ function createAnchorOffsetIndicators(params2) {
|
|
|
50848
50848
|
displayYOffset
|
|
50849
50849
|
} = params2;
|
|
50850
50850
|
const objects = [];
|
|
50851
|
-
const [screenGroupAnchorX, screenGroupAnchorY] =
|
|
50851
|
+
const [screenGroupAnchorX, screenGroupAnchorY] = applyToPoint22(transform2, [
|
|
50852
50852
|
groupAnchorPosition.x,
|
|
50853
50853
|
groupAnchorPosition.y
|
|
50854
50854
|
]);
|
|
50855
|
-
const [screenComponentX, screenComponentY] =
|
|
50855
|
+
const [screenComponentX, screenComponentY] = applyToPoint22(transform2, [
|
|
50856
50856
|
componentPosition.x,
|
|
50857
50857
|
componentPosition.y
|
|
50858
50858
|
]);
|
|
@@ -51188,25 +51188,25 @@ function createSvgObjectsFromPcbBoard(pcbBoard, ctx) {
|
|
|
51188
51188
|
let path42;
|
|
51189
51189
|
if (outline && Array.isArray(outline) && outline.length >= 3) {
|
|
51190
51190
|
path42 = outline.map((point2, index) => {
|
|
51191
|
-
const [x3, y] =
|
|
51191
|
+
const [x3, y] = applyToPoint22(transform2, [point2.x, point2.y]);
|
|
51192
51192
|
return index === 0 ? `M ${x3} ${y}` : `L ${x3} ${y}`;
|
|
51193
51193
|
}).join(" ");
|
|
51194
51194
|
} else {
|
|
51195
51195
|
const halfWidth = width / 2;
|
|
51196
51196
|
const halfHeight = height / 2;
|
|
51197
|
-
const topLeft =
|
|
51197
|
+
const topLeft = applyToPoint22(transform2, [
|
|
51198
51198
|
center.x - halfWidth,
|
|
51199
51199
|
center.y - halfHeight
|
|
51200
51200
|
]);
|
|
51201
|
-
const topRight =
|
|
51201
|
+
const topRight = applyToPoint22(transform2, [
|
|
51202
51202
|
center.x + halfWidth,
|
|
51203
51203
|
center.y - halfHeight
|
|
51204
51204
|
]);
|
|
51205
|
-
const bottomRight =
|
|
51205
|
+
const bottomRight = applyToPoint22(transform2, [
|
|
51206
51206
|
center.x + halfWidth,
|
|
51207
51207
|
center.y + halfHeight
|
|
51208
51208
|
]);
|
|
51209
|
-
const bottomLeft =
|
|
51209
|
+
const bottomLeft = applyToPoint22(transform2, [
|
|
51210
51210
|
center.x - halfWidth,
|
|
51211
51211
|
center.y + halfHeight
|
|
51212
51212
|
]);
|
|
@@ -51274,19 +51274,19 @@ function createSvgObjectsFromPcbPanel(pcbPanel, ctx) {
|
|
|
51274
51274
|
const center = pcbPanel.center ?? { x: width / 2, y: height / 2 };
|
|
51275
51275
|
const halfWidth = width / 2;
|
|
51276
51276
|
const halfHeight = height / 2;
|
|
51277
|
-
const topLeft =
|
|
51277
|
+
const topLeft = applyToPoint22(transform2, [
|
|
51278
51278
|
center.x - halfWidth,
|
|
51279
51279
|
center.y - halfHeight
|
|
51280
51280
|
]);
|
|
51281
|
-
const topRight =
|
|
51281
|
+
const topRight = applyToPoint22(transform2, [
|
|
51282
51282
|
center.x + halfWidth,
|
|
51283
51283
|
center.y - halfHeight
|
|
51284
51284
|
]);
|
|
51285
|
-
const bottomRight =
|
|
51285
|
+
const bottomRight = applyToPoint22(transform2, [
|
|
51286
51286
|
center.x + halfWidth,
|
|
51287
51287
|
center.y + halfHeight
|
|
51288
51288
|
]);
|
|
51289
|
-
const bottomLeft =
|
|
51289
|
+
const bottomLeft = applyToPoint22(transform2, [
|
|
51290
51290
|
center.x - halfWidth,
|
|
51291
51291
|
center.y + halfHeight
|
|
51292
51292
|
]);
|
|
@@ -51313,7 +51313,7 @@ function createSvgObjectsFromPcbPanel(pcbPanel, ctx) {
|
|
|
51313
51313
|
}
|
|
51314
51314
|
function createSvgObjectsFromPcbVia(hole, ctx) {
|
|
51315
51315
|
const { transform: transform2, colorMap: colorMap2 } = ctx;
|
|
51316
|
-
const [x3, y] =
|
|
51316
|
+
const [x3, y] = applyToPoint22(transform2, [hole.x, hole.y]);
|
|
51317
51317
|
const scaledOuterWidth = hole.outer_diameter * Math.abs(transform2.a);
|
|
51318
51318
|
const scaledOuterHeight = hole.outer_diameter * Math.abs(transform2.a);
|
|
51319
51319
|
const scaledHoleWidth = hole.hole_diameter * Math.abs(transform2.a);
|
|
@@ -51360,7 +51360,7 @@ function createSvgObjectsFromPcbVia(hole, ctx) {
|
|
|
51360
51360
|
function createSvgObjectsFromPcbHole(hole, ctx) {
|
|
51361
51361
|
const { transform: transform2, colorMap: colorMap2, showSolderMask } = ctx;
|
|
51362
51362
|
const layer = ctx.layer ?? "top";
|
|
51363
|
-
const [x3, y] =
|
|
51363
|
+
const [x3, y] = applyToPoint22(transform2, [hole.x, hole.y]);
|
|
51364
51364
|
const isCoveredWithSolderMask = Boolean(hole.is_covered_with_solder_mask);
|
|
51365
51365
|
const soldermaskMargin = (hole.soldermask_margin ?? 0) * Math.abs(transform2.a);
|
|
51366
51366
|
const shouldShowSolderMask = showSolderMask && isCoveredWithSolderMask && soldermaskMargin !== 0;
|
|
@@ -51858,11 +51858,11 @@ function createSvgObjectsForRatsNest(circuitJson, ctx) {
|
|
|
51858
51858
|
});
|
|
51859
51859
|
const svgObjects = [];
|
|
51860
51860
|
for (const line of ratsNestLines) {
|
|
51861
|
-
const transformedStart =
|
|
51861
|
+
const transformedStart = applyToPoint22(transform2, [
|
|
51862
51862
|
line.startPoint.x,
|
|
51863
51863
|
line.startPoint.y
|
|
51864
51864
|
]);
|
|
51865
|
-
const transformedEnd =
|
|
51865
|
+
const transformedEnd = applyToPoint22(transform2, [
|
|
51866
51866
|
line.endPoint.x,
|
|
51867
51867
|
line.endPoint.y
|
|
51868
51868
|
]);
|
|
@@ -51891,7 +51891,7 @@ function createSvgObjectsFromPcbCutout(cutout, ctx) {
|
|
|
51891
51891
|
const { transform: transform2, colorMap: colorMap2 } = ctx;
|
|
51892
51892
|
if (cutout.shape === "rect") {
|
|
51893
51893
|
const rectCutout = cutout;
|
|
51894
|
-
const [cx2, cy2] =
|
|
51894
|
+
const [cx2, cy2] = applyToPoint22(transform2, [
|
|
51895
51895
|
rectCutout.center.x,
|
|
51896
51896
|
rectCutout.center.y
|
|
51897
51897
|
]);
|
|
@@ -51909,7 +51909,7 @@ function createSvgObjectsFromPcbCutout(cutout, ctx) {
|
|
|
51909
51909
|
width: scaledWidth.toString(),
|
|
51910
51910
|
height: scaledHeight.toString(),
|
|
51911
51911
|
fill: colorMap2.drill,
|
|
51912
|
-
transform: toString(compose6(translate6(cx2, cy2),
|
|
51912
|
+
transform: toString(compose6(translate6(cx2, cy2), rotate8(svgRotation * Math.PI / 180))),
|
|
51913
51913
|
"data-type": "pcb_cutout",
|
|
51914
51914
|
"data-pcb-layer": "drill"
|
|
51915
51915
|
};
|
|
@@ -51931,7 +51931,7 @@ function createSvgObjectsFromPcbCutout(cutout, ctx) {
|
|
|
51931
51931
|
}
|
|
51932
51932
|
if (cutout.shape === "circle") {
|
|
51933
51933
|
const circleCutout = cutout;
|
|
51934
|
-
const [cx2, cy2] =
|
|
51934
|
+
const [cx2, cy2] = applyToPoint22(transform2, [
|
|
51935
51935
|
circleCutout.center.x,
|
|
51936
51936
|
circleCutout.center.y
|
|
51937
51937
|
]);
|
|
@@ -51958,7 +51958,7 @@ function createSvgObjectsFromPcbCutout(cutout, ctx) {
|
|
|
51958
51958
|
const polygonCutout = cutout;
|
|
51959
51959
|
if (!polygonCutout.points || polygonCutout.points.length === 0)
|
|
51960
51960
|
return [];
|
|
51961
|
-
const transformedPoints = polygonCutout.points.map((p) =>
|
|
51961
|
+
const transformedPoints = polygonCutout.points.map((p) => applyToPoint22(transform2, [p.x, p.y]));
|
|
51962
51962
|
const pointsString = transformedPoints.map((p) => `${p[0]},${p[1]}`).join(" ");
|
|
51963
51963
|
return [
|
|
51964
51964
|
{
|
|
@@ -51986,7 +51986,7 @@ function createSvgObjectsFromPcbCutoutPath(cutoutPath, ctx) {
|
|
|
51986
51986
|
const lastPoint = cutoutPath.route[cutoutPath.route.length - 1];
|
|
51987
51987
|
const isClosed = firstPoint && lastPoint && firstPoint.x === lastPoint.x && firstPoint.y === lastPoint.y;
|
|
51988
51988
|
const path42 = cutoutPath.route.slice(0, isClosed ? -1 : undefined).map((point2, index) => {
|
|
51989
|
-
const [x3, y] =
|
|
51989
|
+
const [x3, y] = applyToPoint22(transform2, [point2.x, point2.y]);
|
|
51990
51990
|
return index === 0 ? `M ${x3} ${y}` : `L ${x3} ${y}`;
|
|
51991
51991
|
}).join(" ") + (isClosed ? " Z" : "");
|
|
51992
51992
|
return [
|
|
@@ -52088,7 +52088,7 @@ function createSvgObjectsFromPcbKeepout(keepout, ctx) {
|
|
|
52088
52088
|
}
|
|
52089
52089
|
if (keepout.shape === "rect") {
|
|
52090
52090
|
const rectKeepout = keepout;
|
|
52091
|
-
const [cx2, cy2] =
|
|
52091
|
+
const [cx2, cy2] = applyToPoint22(transform2, [
|
|
52092
52092
|
rectKeepout.center.x,
|
|
52093
52093
|
rectKeepout.center.y
|
|
52094
52094
|
]);
|
|
@@ -52127,7 +52127,7 @@ function createSvgObjectsFromPcbKeepout(keepout, ctx) {
|
|
|
52127
52127
|
});
|
|
52128
52128
|
} else if (keepout.shape === "circle") {
|
|
52129
52129
|
const circleKeepout = keepout;
|
|
52130
|
-
const [cx2, cy2] =
|
|
52130
|
+
const [cx2, cy2] = applyToPoint22(transform2, [
|
|
52131
52131
|
circleKeepout.center.x,
|
|
52132
52132
|
circleKeepout.center.y
|
|
52133
52133
|
]);
|
|
@@ -52166,7 +52166,7 @@ function ringToPathD(vertices, transform2) {
|
|
|
52166
52166
|
if (vertices.length === 0)
|
|
52167
52167
|
return "";
|
|
52168
52168
|
const transformedVertices = vertices.map((v3) => {
|
|
52169
|
-
const [x3, y] =
|
|
52169
|
+
const [x3, y] = applyToPoint22(transform2, [v3.x, v3.y]);
|
|
52170
52170
|
return { ...v3, x: x3, y };
|
|
52171
52171
|
});
|
|
52172
52172
|
let d = `M ${transformedVertices[0].x} ${transformedVertices[0].y}`;
|
|
@@ -52251,7 +52251,7 @@ function createSvgObjectsFromPcbCopperPour(pour, ctx) {
|
|
|
52251
52251
|
const maskOverlayColor = layer === "bottom" ? colorMap2.soldermaskOverCopper.bottom : colorMap2.soldermaskOverCopper.top;
|
|
52252
52252
|
const maskOverlayOpacity = "0.9";
|
|
52253
52253
|
if (pour.shape === "rect") {
|
|
52254
|
-
const [cx2, cy2] =
|
|
52254
|
+
const [cx2, cy2] = applyToPoint22(transform2, [pour.center.x, pour.center.y]);
|
|
52255
52255
|
const scaledWidth = pour.width * Math.abs(transform2.a);
|
|
52256
52256
|
const scaledHeight = pour.height * Math.abs(transform2.d);
|
|
52257
52257
|
const svgRotation = -(pour.rotation ?? 0);
|
|
@@ -52260,7 +52260,7 @@ function createSvgObjectsFromPcbCopperPour(pour, ctx) {
|
|
|
52260
52260
|
y: (-scaledHeight / 2).toString(),
|
|
52261
52261
|
width: scaledWidth.toString(),
|
|
52262
52262
|
height: scaledHeight.toString(),
|
|
52263
|
-
transform: toString(compose6(translate6(cx2, cy2),
|
|
52263
|
+
transform: toString(compose6(translate6(cx2, cy2), rotate8(svgRotation * Math.PI / 180)))
|
|
52264
52264
|
};
|
|
52265
52265
|
const copperRect = {
|
|
52266
52266
|
name: "rect",
|
|
@@ -52301,7 +52301,7 @@ function createSvgObjectsFromPcbCopperPour(pour, ctx) {
|
|
|
52301
52301
|
if (pour.shape === "polygon") {
|
|
52302
52302
|
if (!pour.points || pour.points.length === 0)
|
|
52303
52303
|
return [];
|
|
52304
|
-
const transformedPoints = pour.points.map((p) =>
|
|
52304
|
+
const transformedPoints = pour.points.map((p) => applyToPoint22(transform2, [p.x, p.y]));
|
|
52305
52305
|
const pointsString = transformedPoints.map((p) => `${p[0]},${p[1]}`).join(" ");
|
|
52306
52306
|
const copperPolygon = {
|
|
52307
52307
|
name: "polygon",
|
|
@@ -52510,7 +52510,7 @@ function createMajorGridPatternChildren(cellSize, majorCellSize, lineColor, majo
|
|
|
52510
52510
|
function createSvgObjectsFromPcbComponent(component, ctx) {
|
|
52511
52511
|
const { transform: transform2, circuitJson } = ctx;
|
|
52512
52512
|
const { center, width, height, rotation: rotation2 = 0 } = component;
|
|
52513
|
-
const [x3, y] =
|
|
52513
|
+
const [x3, y] = applyToPoint22(transform2, [center.x, center.y]);
|
|
52514
52514
|
const scaledWidth = width * Math.abs(transform2.a);
|
|
52515
52515
|
const scaledHeight = height * Math.abs(transform2.d);
|
|
52516
52516
|
const transformStr = `translate(${x3}, ${y}) rotate(${-rotation2}) scale(1, -1)`;
|
|
@@ -52613,7 +52613,7 @@ function createSvgObjectsFromPcbGroup(pcbGroup, ctx) {
|
|
|
52613
52613
|
}
|
|
52614
52614
|
if (outline && outline.length >= 3 && outline.every((point2) => point2 && typeof point2.x === "number" && typeof point2.y === "number")) {
|
|
52615
52615
|
const path42 = outline.map((point2, index) => {
|
|
52616
|
-
const [x3, y] =
|
|
52616
|
+
const [x3, y] = applyToPoint22(transform2, [point2.x, point2.y]);
|
|
52617
52617
|
return index === 0 ? `M ${x3} ${y}` : `L ${x3} ${y}`;
|
|
52618
52618
|
}).join(" ");
|
|
52619
52619
|
svgObjects.push({
|
|
@@ -52634,11 +52634,11 @@ function createSvgObjectsFromPcbGroup(pcbGroup, ctx) {
|
|
|
52634
52634
|
}
|
|
52635
52635
|
const halfWidth = width / 2;
|
|
52636
52636
|
const halfHeight = height / 2;
|
|
52637
|
-
const [topLeftX, topLeftY] =
|
|
52637
|
+
const [topLeftX, topLeftY] = applyToPoint22(transform2, [
|
|
52638
52638
|
center.x - halfWidth,
|
|
52639
52639
|
center.y + halfHeight
|
|
52640
52640
|
]);
|
|
52641
|
-
const [bottomRightX, bottomRightY] =
|
|
52641
|
+
const [bottomRightX, bottomRightY] = applyToPoint22(transform2, [
|
|
52642
52642
|
center.x + halfWidth,
|
|
52643
52643
|
center.y - halfHeight
|
|
52644
52644
|
]);
|
|
@@ -53540,8 +53540,8 @@ function createSvgObjects({
|
|
|
53540
53540
|
}
|
|
53541
53541
|
}
|
|
53542
53542
|
function createSvgObjectFromPcbBoundary(transform2, minX, minY, maxX, maxY) {
|
|
53543
|
-
const [x12, y12] =
|
|
53544
|
-
const [x22, y22] =
|
|
53543
|
+
const [x12, y12] = applyToPoint22(transform2, [minX, minY]);
|
|
53544
|
+
const [x22, y22] = applyToPoint22(transform2, [maxX, maxY]);
|
|
53545
53545
|
const width = Math.abs(x22 - x12);
|
|
53546
53546
|
const height = Math.abs(y22 - y12);
|
|
53547
53547
|
const x3 = Math.min(x12, x22);
|
|
@@ -53570,25 +53570,25 @@ function createSvgObjectsFromAssemblyBoard(pcbBoard, transform2, style = {}) {
|
|
|
53570
53570
|
let path42;
|
|
53571
53571
|
if (outline && Array.isArray(outline) && outline.length >= 3) {
|
|
53572
53572
|
path42 = outline.map((point2, index) => {
|
|
53573
|
-
const [x3, y] =
|
|
53573
|
+
const [x3, y] = applyToPoint22(transform2, [point2.x, point2.y]);
|
|
53574
53574
|
return index === 0 ? `M ${x3} ${y}` : `L ${x3} ${y}`;
|
|
53575
53575
|
}).join(" ");
|
|
53576
53576
|
} else {
|
|
53577
53577
|
const halfWidth = width / 2;
|
|
53578
53578
|
const halfHeight = height / 2;
|
|
53579
|
-
const topLeft =
|
|
53579
|
+
const topLeft = applyToPoint22(transform2, [
|
|
53580
53580
|
center.x - halfWidth,
|
|
53581
53581
|
center.y - halfHeight
|
|
53582
53582
|
]);
|
|
53583
|
-
const topRight =
|
|
53583
|
+
const topRight = applyToPoint22(transform2, [
|
|
53584
53584
|
center.x + halfWidth,
|
|
53585
53585
|
center.y - halfHeight
|
|
53586
53586
|
]);
|
|
53587
|
-
const bottomRight =
|
|
53587
|
+
const bottomRight = applyToPoint22(transform2, [
|
|
53588
53588
|
center.x + halfWidth,
|
|
53589
53589
|
center.y + halfHeight
|
|
53590
53590
|
]);
|
|
53591
|
-
const bottomLeft =
|
|
53591
|
+
const bottomLeft = applyToPoint22(transform2, [
|
|
53592
53592
|
center.x - halfWidth,
|
|
53593
53593
|
center.y + halfHeight
|
|
53594
53594
|
]);
|
|
@@ -53618,8 +53618,8 @@ function createSvgObjectsFromAssemblyComponent(params2, ctx) {
|
|
|
53618
53618
|
const { center, width, height, rotation: rotation2 = 0, layer = "top" } = elm;
|
|
53619
53619
|
if (!center || typeof width !== "number" || typeof height !== "number")
|
|
53620
53620
|
return null;
|
|
53621
|
-
const [x3, y] =
|
|
53622
|
-
const [pinX, pinY] =
|
|
53621
|
+
const [x3, y] = applyToPoint22(transform2, [center.x, center.y]);
|
|
53622
|
+
const [pinX, pinY] = applyToPoint22(transform2, [portPosition.x, portPosition.y]);
|
|
53623
53623
|
const scaledWidth = width * Math.abs(transform2.a);
|
|
53624
53624
|
const scaledHeight = height * Math.abs(transform2.d);
|
|
53625
53625
|
const isTopLayer = layer === "top";
|
|
@@ -53757,7 +53757,7 @@ function getRectPathData(w3, h, rotation2) {
|
|
|
53757
53757
|
}
|
|
53758
53758
|
function createSvgObjectsFromAssemblyHole(hole, ctx) {
|
|
53759
53759
|
const { transform: transform2 } = ctx;
|
|
53760
|
-
const [x3, y] =
|
|
53760
|
+
const [x3, y] = applyToPoint22(transform2, [hole.x, hole.y]);
|
|
53761
53761
|
if (hole.hole_shape === "circle" || hole.hole_shape === "square") {
|
|
53762
53762
|
const scaledDiameter = hole.hole_diameter * Math.abs(transform2.a);
|
|
53763
53763
|
const radius = scaledDiameter / 2;
|
|
@@ -53821,7 +53821,7 @@ function createSvgObjectsFromAssemblyHole(hole, ctx) {
|
|
|
53821
53821
|
}
|
|
53822
53822
|
function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
53823
53823
|
const { transform: transform2 } = ctx;
|
|
53824
|
-
const [x3, y] =
|
|
53824
|
+
const [x3, y] = applyToPoint22(transform2, [hole.x, hole.y]);
|
|
53825
53825
|
if (hole.shape === "pill") {
|
|
53826
53826
|
const scaledOuterWidth = hole.outer_width * Math.abs(transform2.a);
|
|
53827
53827
|
const scaledOuterHeight = hole.outer_height * Math.abs(transform2.a);
|
|
@@ -53915,7 +53915,7 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
|
53915
53915
|
const scaledRectBorderRadius = (circularHole.rect_border_radius ?? 0) * Math.abs(transform2.a);
|
|
53916
53916
|
const rectCcwRotation = circularHole.rect_ccw_rotation ?? 0;
|
|
53917
53917
|
const holeRadius = scaledHoleDiameter / 2;
|
|
53918
|
-
const [holeCx, holeCy] =
|
|
53918
|
+
const [holeCx, holeCy] = applyToPoint22(transform2, [
|
|
53919
53919
|
circularHole.x + circularHole.hole_offset_x,
|
|
53920
53920
|
circularHole.y + circularHole.hole_offset_y
|
|
53921
53921
|
]);
|
|
@@ -53977,7 +53977,7 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
|
53977
53977
|
const pillHoleWithOffsets = pillHole;
|
|
53978
53978
|
const holeOffsetX = pillHoleWithOffsets.hole_offset_x ?? 0;
|
|
53979
53979
|
const holeOffsetY = pillHoleWithOffsets.hole_offset_y ?? 0;
|
|
53980
|
-
const [holeCenterX, holeCenterY] =
|
|
53980
|
+
const [holeCenterX, holeCenterY] = applyToPoint22(transform2, [
|
|
53981
53981
|
pillHole.x + holeOffsetX,
|
|
53982
53982
|
pillHole.y + holeOffsetY
|
|
53983
53983
|
]);
|
|
@@ -54037,7 +54037,7 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
|
54037
54037
|
const rotatedHoleWithOffsets = rotatedHole;
|
|
54038
54038
|
const holeOffsetX = rotatedHoleWithOffsets.hole_offset_x ?? 0;
|
|
54039
54039
|
const holeOffsetY = rotatedHoleWithOffsets.hole_offset_y ?? 0;
|
|
54040
|
-
const [holeCenterX, holeCenterY] =
|
|
54040
|
+
const [holeCenterX, holeCenterY] = applyToPoint22(transform2, [
|
|
54041
54041
|
rotatedHole.x + holeOffsetX,
|
|
54042
54042
|
rotatedHole.y + holeOffsetY
|
|
54043
54043
|
]);
|
|
@@ -54096,7 +54096,7 @@ function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
|
|
|
54096
54096
|
if (pad.shape === "rect" || pad.shape === "rotated_rect") {
|
|
54097
54097
|
const width = pad.width * Math.abs(transform2.a);
|
|
54098
54098
|
const height = pad.height * Math.abs(transform2.d);
|
|
54099
|
-
const [x3, y] =
|
|
54099
|
+
const [x3, y] = applyToPoint22(transform2, [pad.x, pad.y]);
|
|
54100
54100
|
const scaledBorderRadius = (pad.rect_border_radius ?? 0) * Math.abs(transform2.a);
|
|
54101
54101
|
if (pad.shape === "rotated_rect" && pad.ccw_rotation) {
|
|
54102
54102
|
return [
|
|
@@ -54148,7 +54148,7 @@ function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
|
|
|
54148
54148
|
const width = pad.width * Math.abs(transform2.a);
|
|
54149
54149
|
const height = pad.height * Math.abs(transform2.d);
|
|
54150
54150
|
const radius = pad.radius * Math.abs(transform2.a);
|
|
54151
|
-
const [x3, y] =
|
|
54151
|
+
const [x3, y] = applyToPoint22(transform2, [pad.x, pad.y]);
|
|
54152
54152
|
return [
|
|
54153
54153
|
{
|
|
54154
54154
|
name: "rect",
|
|
@@ -54171,7 +54171,7 @@ function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
|
|
|
54171
54171
|
}
|
|
54172
54172
|
if (pad.shape === "circle") {
|
|
54173
54173
|
const radius = pad.radius * Math.abs(transform2.a);
|
|
54174
|
-
const [x3, y] =
|
|
54174
|
+
const [x3, y] = applyToPoint22(transform2, [pad.x, pad.y]);
|
|
54175
54175
|
return [
|
|
54176
54176
|
{
|
|
54177
54177
|
name: "circle",
|
|
@@ -54190,7 +54190,7 @@ function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
|
|
|
54190
54190
|
];
|
|
54191
54191
|
}
|
|
54192
54192
|
if (pad.shape === "polygon") {
|
|
54193
|
-
const points = (pad.points ?? []).map((point2) =>
|
|
54193
|
+
const points = (pad.points ?? []).map((point2) => applyToPoint22(transform2, [point2.x, point2.y]));
|
|
54194
54194
|
return [
|
|
54195
54195
|
{
|
|
54196
54196
|
name: "polygon",
|
|
@@ -54350,8 +54350,8 @@ function createSvgObjects2(elm, ctx, soup) {
|
|
|
54350
54350
|
}
|
|
54351
54351
|
}
|
|
54352
54352
|
function createSvgObjectFromAssemblyBoundary(transform2, minX, minY, maxX, maxY) {
|
|
54353
|
-
const [x12, y12] =
|
|
54354
|
-
const [x22, y22] =
|
|
54353
|
+
const [x12, y12] = applyToPoint22(transform2, [minX, minY]);
|
|
54354
|
+
const [x22, y22] = applyToPoint22(transform2, [maxX, maxY]);
|
|
54355
54355
|
const width = Math.abs(x22 - x12);
|
|
54356
54356
|
const height = Math.abs(y22 - y12);
|
|
54357
54357
|
const x3 = Math.min(x12, x22);
|
|
@@ -54378,25 +54378,25 @@ function createSvgObjectsFromPinoutBoard(pcbBoard, ctx) {
|
|
|
54378
54378
|
let path42;
|
|
54379
54379
|
if (outline && Array.isArray(outline) && outline.length >= 3) {
|
|
54380
54380
|
path42 = outline.map((point2, index) => {
|
|
54381
|
-
const [x3, y] =
|
|
54381
|
+
const [x3, y] = applyToPoint22(transform2, [point2.x, point2.y]);
|
|
54382
54382
|
return index === 0 ? `M ${x3} ${y}` : `L ${x3} ${y}`;
|
|
54383
54383
|
}).join(" ");
|
|
54384
54384
|
} else {
|
|
54385
54385
|
const halfWidth = width / 2;
|
|
54386
54386
|
const halfHeight = height / 2;
|
|
54387
|
-
const topLeft =
|
|
54387
|
+
const topLeft = applyToPoint22(transform2, [
|
|
54388
54388
|
center.x - halfWidth,
|
|
54389
54389
|
center.y - halfHeight
|
|
54390
54390
|
]);
|
|
54391
|
-
const topRight =
|
|
54391
|
+
const topRight = applyToPoint22(transform2, [
|
|
54392
54392
|
center.x + halfWidth,
|
|
54393
54393
|
center.y - halfHeight
|
|
54394
54394
|
]);
|
|
54395
|
-
const bottomRight =
|
|
54395
|
+
const bottomRight = applyToPoint22(transform2, [
|
|
54396
54396
|
center.x + halfWidth,
|
|
54397
54397
|
center.y + halfHeight
|
|
54398
54398
|
]);
|
|
54399
|
-
const bottomLeft =
|
|
54399
|
+
const bottomLeft = applyToPoint22(transform2, [
|
|
54400
54400
|
center.x - halfWidth,
|
|
54401
54401
|
center.y + halfHeight
|
|
54402
54402
|
]);
|
|
@@ -54414,10 +54414,10 @@ function createSvgObjectsFromPinoutBoard(pcbBoard, ctx) {
|
|
|
54414
54414
|
const halfWidth = width2 / 2;
|
|
54415
54415
|
const halfHeight = height2 / 2;
|
|
54416
54416
|
const [tl2, tr2, br2, bl2] = [
|
|
54417
|
-
|
|
54418
|
-
|
|
54419
|
-
|
|
54420
|
-
|
|
54417
|
+
applyToPoint22(transform2, [x3 - halfWidth, y - halfHeight]),
|
|
54418
|
+
applyToPoint22(transform2, [x3 + halfWidth, y - halfHeight]),
|
|
54419
|
+
applyToPoint22(transform2, [x3 + halfWidth, y + halfHeight]),
|
|
54420
|
+
applyToPoint22(transform2, [x3 - halfWidth, y + halfHeight])
|
|
54421
54421
|
];
|
|
54422
54422
|
path42 += ` M ${tl2[0]} ${tl2[1]} L ${tr2[0]} ${tr2[1]} L ${br2[0]} ${br2[1]} L ${bl2[0]} ${bl2[1]} Z`;
|
|
54423
54423
|
} else if (cutout.shape === "circle") {}
|
|
@@ -54470,7 +54470,7 @@ function createSvgObjectsFromPinoutComponent(elm, ctx) {
|
|
|
54470
54470
|
if (!center || typeof width !== "number" || typeof height !== "number" || width === 0 || height === 0) {
|
|
54471
54471
|
return [];
|
|
54472
54472
|
}
|
|
54473
|
-
const [x3, y] =
|
|
54473
|
+
const [x3, y] = applyToPoint22(transform2, [center.x, center.y]);
|
|
54474
54474
|
const scaledWidth = width * Math.abs(transform2.a);
|
|
54475
54475
|
const scaledHeight = height * Math.abs(transform2.d);
|
|
54476
54476
|
const transformStr = `translate(${x3}, ${y})`;
|
|
@@ -54531,7 +54531,7 @@ function createSvgObjectsFromPinoutComponent(elm, ctx) {
|
|
|
54531
54531
|
}
|
|
54532
54532
|
function createSvgObjectsFromPinoutHole(hole, ctx) {
|
|
54533
54533
|
const { transform: transform2 } = ctx;
|
|
54534
|
-
const [x3, y] =
|
|
54534
|
+
const [x3, y] = applyToPoint22(transform2, [hole.x, hole.y]);
|
|
54535
54535
|
if (hole.hole_shape === "circle" || hole.hole_shape === "square") {
|
|
54536
54536
|
const scaledDiameter = hole.hole_diameter * Math.abs(transform2.a);
|
|
54537
54537
|
const radius = scaledDiameter / 2;
|
|
@@ -54595,7 +54595,7 @@ function createSvgObjectsFromPinoutHole(hole, ctx) {
|
|
|
54595
54595
|
}
|
|
54596
54596
|
function createSvgObjectsFromPinoutPlatedHole(hole, ctx) {
|
|
54597
54597
|
const { transform: transform2 } = ctx;
|
|
54598
|
-
const [x3, y] =
|
|
54598
|
+
const [x3, y] = applyToPoint22(transform2, [hole.x, hole.y]);
|
|
54599
54599
|
if (hole.shape === "pill") {
|
|
54600
54600
|
const scaledOuterWidth = hole.outer_width * Math.abs(transform2.a);
|
|
54601
54601
|
const scaledOuterHeight = hole.outer_height * Math.abs(transform2.a);
|
|
@@ -54827,7 +54827,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
|
54827
54827
|
if (pad.shape === "rect" || pad.shape === "rotated_rect") {
|
|
54828
54828
|
const width = pad.width * Math.abs(transform2.a);
|
|
54829
54829
|
const height = pad.height * Math.abs(transform2.d);
|
|
54830
|
-
const [x3, y] =
|
|
54830
|
+
const [x3, y] = applyToPoint22(transform2, [pad.x, pad.y]);
|
|
54831
54831
|
if (pad.shape === "rotated_rect" && pad.ccw_rotation) {
|
|
54832
54832
|
return [
|
|
54833
54833
|
{
|
|
@@ -54870,7 +54870,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
|
54870
54870
|
const width = pad.width * Math.abs(transform2.a);
|
|
54871
54871
|
const height = pad.height * Math.abs(transform2.d);
|
|
54872
54872
|
const radius = pad.radius * Math.abs(transform2.a);
|
|
54873
|
-
const [x3, y] =
|
|
54873
|
+
const [x3, y] = applyToPoint22(transform2, [pad.x, pad.y]);
|
|
54874
54874
|
return [
|
|
54875
54875
|
{
|
|
54876
54876
|
name: "rect",
|
|
@@ -54893,7 +54893,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
|
54893
54893
|
}
|
|
54894
54894
|
if (pad.shape === "circle") {
|
|
54895
54895
|
const radius = pad.radius * Math.abs(transform2.a);
|
|
54896
|
-
const [x3, y] =
|
|
54896
|
+
const [x3, y] = applyToPoint22(transform2, [pad.x, pad.y]);
|
|
54897
54897
|
return [
|
|
54898
54898
|
{
|
|
54899
54899
|
name: "circle",
|
|
@@ -54912,7 +54912,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
|
54912
54912
|
];
|
|
54913
54913
|
}
|
|
54914
54914
|
if (pad.shape === "polygon") {
|
|
54915
|
-
const points = (pad.points ?? []).map((point2) =>
|
|
54915
|
+
const points = (pad.points ?? []).map((point2) => applyToPoint22(transform2, [point2.x, point2.y]));
|
|
54916
54916
|
return [
|
|
54917
54917
|
{
|
|
54918
54918
|
name: "polygon",
|
|
@@ -54997,7 +54997,7 @@ function createSvgObjectsFromPinoutPort(pcb_port2, ctx) {
|
|
|
54997
54997
|
if (!label_info)
|
|
54998
54998
|
return [];
|
|
54999
54999
|
const { text: label, aliases, elbow_end, label_pos, edge } = label_info;
|
|
55000
|
-
const [port_x, port_y] =
|
|
55000
|
+
const [port_x, port_y] = applyToPoint22(ctx.transform, [pcb_port2.x, pcb_port2.y]);
|
|
55001
55001
|
const start_facing_direction = edge === "left" ? "x-" : edge === "right" ? "x+" : edge === "top" ? "y-" : "y+";
|
|
55002
55002
|
const end_facing_direction = edge === "left" ? "x+" : edge === "right" ? "x-" : edge === "top" ? "y+" : "y-";
|
|
55003
55003
|
const elbow_path = calculateElbow({
|
|
@@ -55147,7 +55147,7 @@ function calculateVerticalEdgeLabels(edge, pinout_labels, {
|
|
|
55147
55147
|
const other_pins = pinout_labels.filter((l) => Math.abs(l.pcb_port.x - primary_x) >= 0.2);
|
|
55148
55148
|
const mapToEdgePort = (pinout_label) => ({
|
|
55149
55149
|
pcb_port: pinout_label.pcb_port,
|
|
55150
|
-
y:
|
|
55150
|
+
y: applyToPoint22(transform2, [
|
|
55151
55151
|
pinout_label.pcb_port.x,
|
|
55152
55152
|
pinout_label.pcb_port.y
|
|
55153
55153
|
])[1],
|
|
@@ -55162,7 +55162,7 @@ function calculateVerticalEdgeLabels(edge, pinout_labels, {
|
|
|
55162
55162
|
} else {
|
|
55163
55163
|
edge_ports = pinout_labels.map((pinout_label) => ({
|
|
55164
55164
|
pcb_port: pinout_label.pcb_port,
|
|
55165
|
-
y:
|
|
55165
|
+
y: applyToPoint22(transform2, [
|
|
55166
55166
|
pinout_label.pcb_port.x,
|
|
55167
55167
|
pinout_label.pcb_port.y
|
|
55168
55168
|
])[1],
|
|
@@ -55171,7 +55171,7 @@ function calculateVerticalEdgeLabels(edge, pinout_labels, {
|
|
|
55171
55171
|
}
|
|
55172
55172
|
if (edge_ports.length === 0)
|
|
55173
55173
|
return;
|
|
55174
|
-
const board_edge_x =
|
|
55174
|
+
const board_edge_x = applyToPoint22(transform2, [
|
|
55175
55175
|
edge === "left" ? board_bounds.minX : board_bounds.maxX,
|
|
55176
55176
|
0
|
|
55177
55177
|
])[0];
|
|
@@ -55518,7 +55518,7 @@ function drawSchematicGrid(params2) {
|
|
|
55518
55518
|
const labelCells = params2.labelCells ?? false;
|
|
55519
55519
|
const gridLines = [];
|
|
55520
55520
|
const transformPoint = (x3, y) => {
|
|
55521
|
-
const [transformedX, transformedY] =
|
|
55521
|
+
const [transformedX, transformedY] = applyToPoint22(params2.transform, [x3, y]);
|
|
55522
55522
|
return { x: transformedX, y: transformedY };
|
|
55523
55523
|
};
|
|
55524
55524
|
for (let x3 = Math.floor(minX);x3 <= Math.ceil(maxX); x3 += cellSize) {
|
|
@@ -55602,10 +55602,10 @@ function drawSchematicLabeledPoints(params2) {
|
|
|
55602
55602
|
const { points, transform: transform2 } = params2;
|
|
55603
55603
|
const labeledPointsGroup = [];
|
|
55604
55604
|
for (const point2 of points) {
|
|
55605
|
-
const [x12, y12] =
|
|
55606
|
-
const [x22, y22] =
|
|
55607
|
-
const [x3, y32] =
|
|
55608
|
-
const [x4, y4] =
|
|
55605
|
+
const [x12, y12] = applyToPoint22(transform2, [point2.x - 0.1, point2.y - 0.1]);
|
|
55606
|
+
const [x22, y22] = applyToPoint22(transform2, [point2.x + 0.1, point2.y + 0.1]);
|
|
55607
|
+
const [x3, y32] = applyToPoint22(transform2, [point2.x - 0.1, point2.y + 0.1]);
|
|
55608
|
+
const [x4, y4] = applyToPoint22(transform2, [point2.x + 0.1, point2.y - 0.1]);
|
|
55609
55609
|
labeledPointsGroup.push({
|
|
55610
55610
|
name: "path",
|
|
55611
55611
|
type: "element",
|
|
@@ -55616,7 +55616,7 @@ function drawSchematicLabeledPoints(params2) {
|
|
|
55616
55616
|
"stroke-opacity": "0.7"
|
|
55617
55617
|
}
|
|
55618
55618
|
});
|
|
55619
|
-
const [labelX, labelY] =
|
|
55619
|
+
const [labelX, labelY] = applyToPoint22(transform2, [
|
|
55620
55620
|
point2.x + 0.15,
|
|
55621
55621
|
point2.y - 0.15
|
|
55622
55622
|
]);
|
|
@@ -55833,7 +55833,7 @@ function createSvgObjectsFromSchVoltageProbe({
|
|
|
55833
55833
|
transform: transform2,
|
|
55834
55834
|
colorMap: colorMap2
|
|
55835
55835
|
}) {
|
|
55836
|
-
const [screenX, screenY] =
|
|
55836
|
+
const [screenX, screenY] = applyToPoint22(transform2, [
|
|
55837
55837
|
probe.position.x,
|
|
55838
55838
|
probe.position.y
|
|
55839
55839
|
]);
|
|
@@ -56010,11 +56010,11 @@ function createSvgObjectsFromSchDebugObject({
|
|
|
56010
56010
|
transform: transform2
|
|
56011
56011
|
}) {
|
|
56012
56012
|
if (debugObject.shape === "rect") {
|
|
56013
|
-
let [screenLeft, screenTop] =
|
|
56013
|
+
let [screenLeft, screenTop] = applyToPoint22(transform2, [
|
|
56014
56014
|
debugObject.center.x - debugObject.size.width / 2,
|
|
56015
56015
|
debugObject.center.y - debugObject.size.height / 2
|
|
56016
56016
|
]);
|
|
56017
|
-
let [screenRight, screenBottom] =
|
|
56017
|
+
let [screenRight, screenBottom] = applyToPoint22(transform2, [
|
|
56018
56018
|
debugObject.center.x + debugObject.size.width / 2,
|
|
56019
56019
|
debugObject.center.y + debugObject.size.height / 2
|
|
56020
56020
|
]);
|
|
@@ -56024,7 +56024,7 @@ function createSvgObjectsFromSchDebugObject({
|
|
|
56024
56024
|
];
|
|
56025
56025
|
const width = Math.abs(screenRight - screenLeft);
|
|
56026
56026
|
const height = Math.abs(screenBottom - screenTop);
|
|
56027
|
-
const [screenCenterX, screenCenterY] =
|
|
56027
|
+
const [screenCenterX, screenCenterY] = applyToPoint22(transform2, [
|
|
56028
56028
|
debugObject.center.x,
|
|
56029
56029
|
debugObject.center.y
|
|
56030
56030
|
]);
|
|
@@ -56070,11 +56070,11 @@ function createSvgObjectsFromSchDebugObject({
|
|
|
56070
56070
|
];
|
|
56071
56071
|
}
|
|
56072
56072
|
if (debugObject.shape === "line") {
|
|
56073
|
-
const [screenStartX, screenStartY] =
|
|
56073
|
+
const [screenStartX, screenStartY] = applyToPoint22(transform2, [
|
|
56074
56074
|
debugObject.start.x,
|
|
56075
56075
|
debugObject.start.y
|
|
56076
56076
|
]);
|
|
56077
|
-
const [screenEndX, screenEndY] =
|
|
56077
|
+
const [screenEndX, screenEndY] = applyToPoint22(transform2, [
|
|
56078
56078
|
debugObject.end.x,
|
|
56079
56079
|
debugObject.end.y
|
|
56080
56080
|
]);
|
|
@@ -56137,11 +56137,11 @@ function createSchematicTrace({
|
|
|
56137
56137
|
const edge = edges[edgeIndex];
|
|
56138
56138
|
if (edge.is_crossing)
|
|
56139
56139
|
continue;
|
|
56140
|
-
const [screenFromX, screenFromY] =
|
|
56140
|
+
const [screenFromX, screenFromY] = applyToPoint22(transform2, [
|
|
56141
56141
|
edge.from.x,
|
|
56142
56142
|
edge.from.y
|
|
56143
56143
|
]);
|
|
56144
|
-
const [screenToX, screenToY] =
|
|
56144
|
+
const [screenToX, screenToY] = applyToPoint22(transform2, [
|
|
56145
56145
|
edge.to.x,
|
|
56146
56146
|
edge.to.y
|
|
56147
56147
|
]);
|
|
@@ -56186,11 +56186,11 @@ function createSchematicTrace({
|
|
|
56186
56186
|
for (const edge of edges) {
|
|
56187
56187
|
if (!edge.is_crossing)
|
|
56188
56188
|
continue;
|
|
56189
|
-
const [screenFromX, screenFromY] =
|
|
56189
|
+
const [screenFromX, screenFromY] = applyToPoint22(transform2, [
|
|
56190
56190
|
edge.from.x,
|
|
56191
56191
|
edge.from.y
|
|
56192
56192
|
]);
|
|
56193
|
-
const [screenToX, screenToY] =
|
|
56193
|
+
const [screenToX, screenToY] = applyToPoint22(transform2, [
|
|
56194
56194
|
edge.to.x,
|
|
56195
56195
|
edge.to.y
|
|
56196
56196
|
]);
|
|
@@ -56234,7 +56234,7 @@ function createSchematicTrace({
|
|
|
56234
56234
|
}
|
|
56235
56235
|
if (trace.junctions) {
|
|
56236
56236
|
for (const junction of trace.junctions) {
|
|
56237
|
-
const [screenX, screenY] =
|
|
56237
|
+
const [screenX, screenY] = applyToPoint22(transform2, [
|
|
56238
56238
|
junction.x,
|
|
56239
56239
|
junction.y
|
|
56240
56240
|
]);
|
|
@@ -56291,8 +56291,8 @@ function createSvgObjectsFromSchematicLine({
|
|
|
56291
56291
|
transform: transform2,
|
|
56292
56292
|
colorMap: colorMap2
|
|
56293
56293
|
}) {
|
|
56294
|
-
const p12 =
|
|
56295
|
-
const p22 =
|
|
56294
|
+
const p12 = applyToPoint22(transform2, { x: schLine.x1, y: schLine.y1 });
|
|
56295
|
+
const p22 = applyToPoint22(transform2, { x: schLine.x2, y: schLine.y2 });
|
|
56296
56296
|
const strokeWidth = schLine.stroke_width ?? 0.02;
|
|
56297
56297
|
const transformedStrokeWidth = Math.abs(transform2.a) * strokeWidth;
|
|
56298
56298
|
return [
|
|
@@ -56324,7 +56324,7 @@ function createSvgObjectsFromSchematicCircle({
|
|
|
56324
56324
|
transform: transform2,
|
|
56325
56325
|
colorMap: colorMap2
|
|
56326
56326
|
}) {
|
|
56327
|
-
const center =
|
|
56327
|
+
const center = applyToPoint22(transform2, schCircle.center);
|
|
56328
56328
|
const transformedRadius = Math.abs(transform2.a) * schCircle.radius;
|
|
56329
56329
|
const strokeWidth = schCircle.stroke_width ?? 0.02;
|
|
56330
56330
|
const transformedStrokeWidth = Math.abs(transform2.a) * strokeWidth;
|
|
@@ -56357,7 +56357,7 @@ function createSvgObjectsFromSchematicRect({
|
|
|
56357
56357
|
transform: transform2,
|
|
56358
56358
|
colorMap: colorMap2
|
|
56359
56359
|
}) {
|
|
56360
|
-
const center =
|
|
56360
|
+
const center = applyToPoint22(transform2, schRect.center);
|
|
56361
56361
|
const transformedWidth = Math.abs(transform2.a) * schRect.width;
|
|
56362
56362
|
const transformedHeight = Math.abs(transform2.d) * schRect.height;
|
|
56363
56363
|
const strokeWidth = schRect.stroke_width ?? 0.02;
|
|
@@ -56396,7 +56396,7 @@ function createSvgObjectsFromSchematicArc({
|
|
|
56396
56396
|
transform: transform2,
|
|
56397
56397
|
colorMap: colorMap2
|
|
56398
56398
|
}) {
|
|
56399
|
-
const center =
|
|
56399
|
+
const center = applyToPoint22(transform2, schArc.center);
|
|
56400
56400
|
const transformedRadius = Math.abs(transform2.a) * schArc.radius;
|
|
56401
56401
|
const strokeWidth = schArc.stroke_width ?? 0.02;
|
|
56402
56402
|
const transformedStrokeWidth = Math.abs(transform2.a) * strokeWidth;
|
|
@@ -56449,7 +56449,7 @@ function createSvgObjectsFromSchematicPath({
|
|
|
56449
56449
|
if (!schPath.points || schPath.points.length < 2) {
|
|
56450
56450
|
return [];
|
|
56451
56451
|
}
|
|
56452
|
-
const transformedPoints = schPath.points.map((p) =>
|
|
56452
|
+
const transformedPoints = schPath.points.map((p) => applyToPoint22(transform2, { x: p.x, y: p.y }));
|
|
56453
56453
|
const pathD = transformedPoints.map((p, i) => `${i === 0 ? "M" : "L"} ${p.x} ${p.y}`).join(" ");
|
|
56454
56454
|
return [
|
|
56455
56455
|
{
|
|
@@ -57396,7 +57396,7 @@ function createSvgObjectsFromSolderPaste(solderPaste, ctx) {
|
|
|
57396
57396
|
const { transform: transform2, layer: layerFilter } = ctx;
|
|
57397
57397
|
if (layerFilter && solderPaste.layer !== layerFilter)
|
|
57398
57398
|
return [];
|
|
57399
|
-
const [x3, y] =
|
|
57399
|
+
const [x3, y] = applyToPoint22(transform2, [solderPaste.x, solderPaste.y]);
|
|
57400
57400
|
if (solderPaste.shape === "rect" || solderPaste.shape === "rotated_rect") {
|
|
57401
57401
|
const width = solderPaste.width * Math.abs(transform2.a);
|
|
57402
57402
|
const height = solderPaste.height * Math.abs(transform2.d);
|
|
@@ -57605,8 +57605,8 @@ function createSvgObjects4({ elm, ctx }) {
|
|
|
57605
57605
|
}
|
|
57606
57606
|
}
|
|
57607
57607
|
function createSvgObjectFromPcbBoundary2(transform2, minX, minY, maxX, maxY) {
|
|
57608
|
-
const [x12, y12] =
|
|
57609
|
-
const [x22, y22] =
|
|
57608
|
+
const [x12, y12] = applyToPoint22(transform2, [minX, minY]);
|
|
57609
|
+
const [x22, y22] = applyToPoint22(transform2, [maxX, maxY]);
|
|
57610
57610
|
const width = Math.abs(x22 - x12);
|
|
57611
57611
|
const height = Math.abs(y22 - y12);
|
|
57612
57612
|
const x3 = Math.min(x12, x22);
|
|
@@ -57923,7 +57923,7 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
|
|
|
57923
57923
|
realCenter,
|
|
57924
57924
|
realToScreenTransform
|
|
57925
57925
|
}) => {
|
|
57926
|
-
const screenCenter =
|
|
57926
|
+
const screenCenter = applyToPoint22(realToScreenTransform, realCenter);
|
|
57927
57927
|
return {
|
|
57928
57928
|
type: "element",
|
|
57929
57929
|
name: "text",
|
|
@@ -58009,8 +58009,8 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
|
|
|
58009
58009
|
minY: Math.min(...paths.flatMap((p) => p.points.map((pt2) => pt2.y))),
|
|
58010
58010
|
maxY: Math.max(...paths.flatMap((p) => p.points.map((pt2) => pt2.y)))
|
|
58011
58011
|
};
|
|
58012
|
-
const [screenMinX, screenMinY] =
|
|
58013
|
-
const [screenMaxX, screenMaxY] =
|
|
58012
|
+
const [screenMinX, screenMinY] = applyToPoint22(compose6(realToScreenTransform, transformFromSymbolToReal), [bounds.minX, bounds.minY]);
|
|
58013
|
+
const [screenMaxX, screenMaxY] = applyToPoint22(compose6(realToScreenTransform, transformFromSymbolToReal), [bounds.maxX, bounds.maxY]);
|
|
58014
58014
|
const rectHeight = Math.abs(screenMaxY - screenMinY);
|
|
58015
58015
|
const rectY = Math.min(screenMinY, screenMaxY);
|
|
58016
58016
|
const rectWidth = Math.abs(screenMaxX - screenMinX);
|
|
@@ -58036,7 +58036,7 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
|
|
|
58036
58036
|
name: "path",
|
|
58037
58037
|
attributes: {
|
|
58038
58038
|
d: points.map((p, i) => {
|
|
58039
|
-
const [x3, y] =
|
|
58039
|
+
const [x3, y] = applyToPoint22(compose6(realToScreenTransform, transformFromSymbolToReal), [p.x, p.y]);
|
|
58040
58040
|
return `${i === 0 ? "M" : "L"} ${x3} ${y}`;
|
|
58041
58041
|
}).join(" ") + (closed ? " Z" : ""),
|
|
58042
58042
|
stroke: colorMap2.schematic.component_outline,
|
|
@@ -58049,7 +58049,7 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
|
|
|
58049
58049
|
});
|
|
58050
58050
|
}
|
|
58051
58051
|
for (const text of texts) {
|
|
58052
|
-
const screenTextPos =
|
|
58052
|
+
const screenTextPos = applyToPoint22(compose6(realToScreenTransform, transformFromSymbolToReal), text);
|
|
58053
58053
|
let textValue = "";
|
|
58054
58054
|
const isReferenceText = text.text === "{REF}";
|
|
58055
58055
|
if (isReferenceText) {
|
|
@@ -58088,7 +58088,7 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
|
|
|
58088
58088
|
});
|
|
58089
58089
|
}
|
|
58090
58090
|
for (const box of boxes) {
|
|
58091
|
-
const screenBoxPos =
|
|
58091
|
+
const screenBoxPos = applyToPoint22(compose6(realToScreenTransform, transformFromSymbolToReal), box);
|
|
58092
58092
|
const symbolToScreenScale = compose6(realToScreenTransform, transformFromSymbolToReal).a;
|
|
58093
58093
|
svgObjects.push({
|
|
58094
58094
|
name: "rect",
|
|
@@ -58107,7 +58107,7 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
|
|
|
58107
58107
|
for (const port of symbol.ports) {
|
|
58108
58108
|
if (connectedSymbolPorts.has(port))
|
|
58109
58109
|
continue;
|
|
58110
|
-
const screenPortPos =
|
|
58110
|
+
const screenPortPos = applyToPoint22(compose6(realToScreenTransform, transformFromSymbolToReal), port);
|
|
58111
58111
|
svgObjects.push({
|
|
58112
58112
|
type: "element",
|
|
58113
58113
|
name: "circle",
|
|
@@ -58124,7 +58124,7 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
|
|
|
58124
58124
|
});
|
|
58125
58125
|
}
|
|
58126
58126
|
for (const circle of circles) {
|
|
58127
|
-
const screenCirclePos =
|
|
58127
|
+
const screenCirclePos = applyToPoint22(compose6(realToScreenTransform, transformFromSymbolToReal), circle);
|
|
58128
58128
|
const screenRadius = Math.abs(circle.radius * realToScreenTransform.a);
|
|
58129
58129
|
svgObjects.push({
|
|
58130
58130
|
type: "element",
|
|
@@ -58191,8 +58191,8 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
|
|
|
58191
58191
|
realEdgePos.y += realPinLineLength;
|
|
58192
58192
|
break;
|
|
58193
58193
|
}
|
|
58194
|
-
const screenSchPortPos =
|
|
58195
|
-
const screenRealEdgePos =
|
|
58194
|
+
const screenSchPortPos = applyToPoint22(transform2, schPort.center);
|
|
58195
|
+
const screenRealEdgePos = applyToPoint22(transform2, realEdgePos);
|
|
58196
58196
|
const isConnected = isSourcePortConnected(circuitJson, schPort.source_port_id);
|
|
58197
58197
|
const is_drawn_with_inversion_circle = schPort.is_drawn_with_inversion_circle ?? false;
|
|
58198
58198
|
const BUBBLE_RADIUS_MM = 0.06;
|
|
@@ -58213,7 +58213,7 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
|
|
|
58213
58213
|
break;
|
|
58214
58214
|
}
|
|
58215
58215
|
}
|
|
58216
|
-
const screenLineEnd =
|
|
58216
|
+
const screenLineEnd = applyToPoint22(transform2, realLineEnd);
|
|
58217
58217
|
if (is_drawn_with_inversion_circle) {
|
|
58218
58218
|
const bubbleRadiusPx = Math.abs(transform2.a) * BUBBLE_RADIUS_MM;
|
|
58219
58219
|
const bubbleCenter = { ...screenRealEdgePos };
|
|
@@ -58370,7 +58370,7 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
|
|
|
58370
58370
|
} else {
|
|
58371
58371
|
realPinNumberPos.y += 0.02;
|
|
58372
58372
|
}
|
|
58373
|
-
const screenPinNumberTextPos =
|
|
58373
|
+
const screenPinNumberTextPos = applyToPoint22(transform2, realPinNumberPos);
|
|
58374
58374
|
svgObjects.push({
|
|
58375
58375
|
name: "text",
|
|
58376
58376
|
type: "element",
|
|
@@ -58410,7 +58410,7 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
|
|
|
58410
58410
|
const realPinEdgeDistance = schPort.distance_from_component_edge ?? 0.4;
|
|
58411
58411
|
realPinNumberPos.x += vecToEdge.x * (realPinEdgeDistance + LABEL_DIST_FROM_EDGE_MM);
|
|
58412
58412
|
realPinNumberPos.y += vecToEdge.y * (realPinEdgeDistance + LABEL_DIST_FROM_EDGE_MM);
|
|
58413
|
-
const screenPinNumberTextPos =
|
|
58413
|
+
const screenPinNumberTextPos = applyToPoint22(transform2, realPinNumberPos);
|
|
58414
58414
|
const label = schPort.display_pin_label ?? schComponent.port_labels?.[`${schPort.pin_number}`];
|
|
58415
58415
|
if (!label)
|
|
58416
58416
|
return [];
|
|
@@ -58456,7 +58456,7 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
|
|
|
58456
58456
|
transform: transform2,
|
|
58457
58457
|
colorMap: colorMap2
|
|
58458
58458
|
}) => {
|
|
58459
|
-
const center =
|
|
58459
|
+
const center = applyToPoint22(transform2, elm.position);
|
|
58460
58460
|
const textAnchorMap = {
|
|
58461
58461
|
center: "middle",
|
|
58462
58462
|
center_right: "end",
|
|
@@ -58538,11 +58538,11 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
|
|
|
58538
58538
|
colorMap: colorMap2
|
|
58539
58539
|
}) => {
|
|
58540
58540
|
const svgObjects = [];
|
|
58541
|
-
const componentScreenTopLeft =
|
|
58541
|
+
const componentScreenTopLeft = applyToPoint22(transform2, {
|
|
58542
58542
|
x: schComponent.center.x - schComponent.size.width / 2,
|
|
58543
58543
|
y: schComponent.center.y + schComponent.size.height / 2
|
|
58544
58544
|
});
|
|
58545
|
-
const componentScreenBottomRight =
|
|
58545
|
+
const componentScreenBottomRight = applyToPoint22(transform2, {
|
|
58546
58546
|
x: schComponent.center.x + schComponent.size.width / 2,
|
|
58547
58547
|
y: schComponent.center.y - schComponent.size.height / 2
|
|
58548
58548
|
});
|
|
@@ -58638,7 +58638,7 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
|
|
|
58638
58638
|
y: schNetLabel.center.y - realTextGrowthVec.y * fullWidthFsr * fontSizeMm / 2
|
|
58639
58639
|
};
|
|
58640
58640
|
const pathRotation = 0;
|
|
58641
|
-
const rotationMatrix =
|
|
58641
|
+
const rotationMatrix = rotate8(pathRotation / 180 * Math.PI);
|
|
58642
58642
|
const symbolBounds = {
|
|
58643
58643
|
minX: Math.min(...symbol.primitives.flatMap((p) => p.type === "path" ? p.points.map((pt2) => pt2.x) : [])),
|
|
58644
58644
|
maxX: Math.max(...symbol.primitives.flatMap((p) => p.type === "path" ? p.points.map((pt2) => pt2.x) : [])),
|
|
@@ -58649,10 +58649,10 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
|
|
|
58649
58649
|
x: symbolBounds.minX,
|
|
58650
58650
|
y: (symbolBounds.minY + symbolBounds.maxY) / 2
|
|
58651
58651
|
};
|
|
58652
|
-
const rotatedSymbolEnd =
|
|
58652
|
+
const rotatedSymbolEnd = applyToPoint22(rotationMatrix, symbolEndPoint);
|
|
58653
58653
|
const symbolToRealTransform = compose6(translate6(realAnchorPosition.x - rotatedSymbolEnd.x, realAnchorPosition.y - rotatedSymbolEnd.y), rotationMatrix, scale5(1));
|
|
58654
|
-
const [screenMinX, screenMinY] =
|
|
58655
|
-
const [screenMaxX, screenMaxY] =
|
|
58654
|
+
const [screenMinX, screenMinY] = applyToPoint22(compose6(realToScreenTransform, symbolToRealTransform), [bounds.minX, bounds.minY]);
|
|
58655
|
+
const [screenMaxX, screenMaxY] = applyToPoint22(compose6(realToScreenTransform, symbolToRealTransform), [bounds.maxX, bounds.maxY]);
|
|
58656
58656
|
const rectHeight = Math.abs(screenMaxY - screenMinY);
|
|
58657
58657
|
const rectY = Math.min(screenMinY, screenMaxY);
|
|
58658
58658
|
const rectWidth = Math.abs(screenMaxX - screenMinX);
|
|
@@ -58673,7 +58673,7 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
|
|
|
58673
58673
|
});
|
|
58674
58674
|
for (const path42 of symbolPaths) {
|
|
58675
58675
|
const symbolPath = path42.points.map((p, i) => {
|
|
58676
|
-
const [x3, y] =
|
|
58676
|
+
const [x3, y] = applyToPoint22(compose6(realToScreenTransform, symbolToRealTransform), [p.x, p.y]);
|
|
58677
58677
|
return `${i === 0 ? "M" : "L"} ${x3} ${y}`;
|
|
58678
58678
|
}).join(" ");
|
|
58679
58679
|
svgObjects.push({
|
|
@@ -58691,7 +58691,7 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
|
|
|
58691
58691
|
});
|
|
58692
58692
|
}
|
|
58693
58693
|
for (const text of symbolTexts) {
|
|
58694
|
-
const screenTextPos =
|
|
58694
|
+
const screenTextPos = applyToPoint22(compose6(realToScreenTransform, symbolToRealTransform), text);
|
|
58695
58695
|
let textValue = text.text;
|
|
58696
58696
|
if (textValue === "{REF}") {
|
|
58697
58697
|
textValue = labelText || "";
|
|
@@ -58730,7 +58730,7 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
|
|
|
58730
58730
|
});
|
|
58731
58731
|
}
|
|
58732
58732
|
for (const box of symbolBoxes) {
|
|
58733
|
-
const screenBoxPos =
|
|
58733
|
+
const screenBoxPos = applyToPoint22(compose6(realToScreenTransform, symbolToRealTransform), box);
|
|
58734
58734
|
const symbolToScreenScale = compose6(realToScreenTransform, symbolToRealTransform).a;
|
|
58735
58735
|
svgObjects.push({
|
|
58736
58736
|
name: "rect",
|
|
@@ -58747,7 +58747,7 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
|
|
|
58747
58747
|
});
|
|
58748
58748
|
}
|
|
58749
58749
|
for (const circle of symbolCircles) {
|
|
58750
|
-
const screenCirclePos =
|
|
58750
|
+
const screenCirclePos = applyToPoint22(compose6(realToScreenTransform, symbolToRealTransform), circle);
|
|
58751
58751
|
const symbolToScreenScale = compose6(realToScreenTransform, symbolToRealTransform).a;
|
|
58752
58752
|
svgObjects.push({
|
|
58753
58753
|
name: "circle",
|
|
@@ -58784,12 +58784,12 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
|
|
|
58784
58784
|
const fontSizePx = getSchScreenFontSize(realToScreenTransform, "net_label");
|
|
58785
58785
|
const fontSizeMm = getSchMmFontSize("net_label");
|
|
58786
58786
|
const textWidthFSR = estimateTextWidth(labelText || "");
|
|
58787
|
-
const screenCenter =
|
|
58787
|
+
const screenCenter = applyToPoint22(realToScreenTransform, schNetLabel.center);
|
|
58788
58788
|
const realTextGrowthVec = getUnitVectorFromOutsideToEdge(schNetLabel.anchor_side);
|
|
58789
58789
|
const screenTextGrowthVec = { ...realTextGrowthVec };
|
|
58790
58790
|
screenTextGrowthVec.y *= -1;
|
|
58791
58791
|
const fullWidthFsr = textWidthFSR + ARROW_POINT_WIDTH_FSR * 2 + END_PADDING_EXTRA_PER_CHARACTER_FSR * labelText.length + END_PADDING_FSR;
|
|
58792
|
-
const screenAnchorPosition = schNetLabel.anchor_position ?
|
|
58792
|
+
const screenAnchorPosition = schNetLabel.anchor_position ? applyToPoint22(realToScreenTransform, schNetLabel.anchor_position) : {
|
|
58793
58793
|
x: screenCenter.x - screenTextGrowthVec.x * fullWidthFsr * fontSizePx / 2,
|
|
58794
58794
|
y: screenCenter.y - screenTextGrowthVec.y * fullWidthFsr * fontSizePx / 2
|
|
58795
58795
|
};
|
|
@@ -58824,7 +58824,7 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
|
|
|
58824
58824
|
x: ARROW_POINT_WIDTH_FSR,
|
|
58825
58825
|
y: -0.6
|
|
58826
58826
|
}
|
|
58827
|
-
].map((fontRelativePoint) =>
|
|
58827
|
+
].map((fontRelativePoint) => applyToPoint22(compose6(realToScreenTransform, translate6(realAnchorPosition.x, realAnchorPosition.y), scale5(fontSizeMm), rotate8(pathRotation / 180 * Math.PI)), fontRelativePoint));
|
|
58828
58828
|
const pathD = `
|
|
58829
58829
|
M ${screenOutlinePoints[0].x},${screenOutlinePoints[0].y}
|
|
58830
58830
|
L ${screenOutlinePoints[1].x},${screenOutlinePoints[1].y}
|
|
@@ -58894,11 +58894,11 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
|
|
|
58894
58894
|
transform: transform2,
|
|
58895
58895
|
colorMap: colorMap2
|
|
58896
58896
|
}) => {
|
|
58897
|
-
const topLeft =
|
|
58897
|
+
const topLeft = applyToPoint22(transform2, {
|
|
58898
58898
|
x: schematicBox.x,
|
|
58899
58899
|
y: schematicBox.y
|
|
58900
58900
|
});
|
|
58901
|
-
const bottomRight =
|
|
58901
|
+
const bottomRight = applyToPoint22(transform2, {
|
|
58902
58902
|
x: schematicBox.x + schematicBox.width,
|
|
58903
58903
|
y: schematicBox.y + schematicBox.height
|
|
58904
58904
|
});
|
|
@@ -58960,11 +58960,11 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
|
|
|
58960
58960
|
const svgObjects = [];
|
|
58961
58961
|
const borderStrokeWidth = border_width * Math.abs(transform2.a);
|
|
58962
58962
|
const gridStrokeWidth = getSchStrokeSize(transform2);
|
|
58963
|
-
const [screenTopLeftX, screenTopLeftY] =
|
|
58963
|
+
const [screenTopLeftX, screenTopLeftY] = applyToPoint22(transform2, [
|
|
58964
58964
|
topLeftX,
|
|
58965
58965
|
topLeftY
|
|
58966
58966
|
]);
|
|
58967
|
-
const [screenBottomRightX, screenBottomRightY] =
|
|
58967
|
+
const [screenBottomRightX, screenBottomRightY] = applyToPoint22(transform2, [
|
|
58968
58968
|
topLeftX + totalWidth,
|
|
58969
58969
|
topLeftY - totalHeight
|
|
58970
58970
|
]);
|
|
@@ -58992,8 +58992,8 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
|
|
|
58992
58992
|
const segmentEndY = segmentStartY - row_heights[j2];
|
|
58993
58993
|
const isMerged = cells.some((cell) => cell.start_column_index <= i && cell.end_column_index > i && cell.start_row_index <= j2 && cell.end_row_index >= j2);
|
|
58994
58994
|
if (!isMerged) {
|
|
58995
|
-
const start =
|
|
58996
|
-
const end =
|
|
58995
|
+
const start = applyToPoint22(transform2, { x: currentX, y: segmentStartY });
|
|
58996
|
+
const end = applyToPoint22(transform2, { x: currentX, y: segmentEndY });
|
|
58997
58997
|
svgObjects.push({
|
|
58998
58998
|
name: "line",
|
|
58999
58999
|
type: "element",
|
|
@@ -59020,11 +59020,11 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
|
|
|
59020
59020
|
const segmentEndX = segmentStartX + column_widths[j2];
|
|
59021
59021
|
const isMerged = cells.some((cell) => cell.start_row_index <= i && cell.end_row_index > i && cell.start_column_index <= j2 && cell.end_column_index >= j2);
|
|
59022
59022
|
if (!isMerged) {
|
|
59023
|
-
const start =
|
|
59023
|
+
const start = applyToPoint22(transform2, {
|
|
59024
59024
|
x: segmentStartX,
|
|
59025
59025
|
y: currentY
|
|
59026
59026
|
});
|
|
59027
|
-
const end =
|
|
59027
|
+
const end = applyToPoint22(transform2, { x: segmentEndX, y: currentY });
|
|
59028
59028
|
svgObjects.push({
|
|
59029
59029
|
name: "line",
|
|
59030
59030
|
type: "element",
|
|
@@ -59066,7 +59066,7 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
|
|
|
59066
59066
|
} else if (vertical_align === "bottom") {
|
|
59067
59067
|
realTextAnchorPos.y = cellTopLeftY - cellHeight + cell_padding;
|
|
59068
59068
|
}
|
|
59069
|
-
const screenTextAnchorPos =
|
|
59069
|
+
const screenTextAnchorPos = applyToPoint22(transform2, realTextAnchorPos);
|
|
59070
59070
|
const fontSize = getSchScreenFontSize(transform2, "reference_designator", cell.font_size);
|
|
59071
59071
|
const textAnchorMap = {
|
|
59072
59072
|
left: "start",
|
|
@@ -59118,7 +59118,7 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
|
|
|
59118
59118
|
schPort,
|
|
59119
59119
|
transform: transform2
|
|
59120
59120
|
}) => {
|
|
59121
|
-
const screenSchPortPos =
|
|
59121
|
+
const screenSchPortPos = applyToPoint22(transform2, schPort.center);
|
|
59122
59122
|
const pinRadiusPx = Math.abs(transform2.a) * PIN_CIRCLE_RADIUS_MM2 * 2;
|
|
59123
59123
|
return [
|
|
59124
59124
|
{
|
|
@@ -59168,7 +59168,7 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
|
|
|
59168
59168
|
const svgObjects = [];
|
|
59169
59169
|
const radiusPx = Math.abs(transform2.a) * PIN_CIRCLE_RADIUS_MM3;
|
|
59170
59170
|
const strokeWidth = Math.abs(transform2.a) * PIN_CIRCLE_RADIUS_MM3;
|
|
59171
|
-
const screenPos =
|
|
59171
|
+
const screenPos = applyToPoint22(transform2, schPort.center);
|
|
59172
59172
|
svgObjects.push({
|
|
59173
59173
|
name: "circle",
|
|
59174
59174
|
type: "element",
|
|
@@ -59215,7 +59215,7 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
|
|
|
59215
59215
|
textAnchor = "middle";
|
|
59216
59216
|
break;
|
|
59217
59217
|
}
|
|
59218
|
-
const screenLabelPos =
|
|
59218
|
+
const screenLabelPos = applyToPoint22(transform2, labelPos);
|
|
59219
59219
|
const fontSizePx = getSchScreenFontSize(transform2, "pin_number");
|
|
59220
59220
|
if (schPort.facing_direction === "up" || schPort.facing_direction === "down") {
|
|
59221
59221
|
rotation2 = `rotate(-90 ${screenLabelPos.x} ${screenLabelPos.y})`;
|
|
@@ -100574,7 +100574,7 @@ var import_perfect_cli = __toESM2(require_dist2(), 1);
|
|
|
100574
100574
|
// lib/getVersion.ts
|
|
100575
100575
|
import { createRequire as createRequire2 } from "node:module";
|
|
100576
100576
|
// package.json
|
|
100577
|
-
var version = "0.1.
|
|
100577
|
+
var version = "0.1.1322";
|
|
100578
100578
|
var package_default = {
|
|
100579
100579
|
name: "@tscircuit/cli",
|
|
100580
100580
|
version,
|
|
@@ -100609,7 +100609,7 @@ var package_default = {
|
|
|
100609
100609
|
"circuit-json": "^0.0.403",
|
|
100610
100610
|
"circuit-json-to-bom-csv": "^0.0.7",
|
|
100611
100611
|
"circuit-json-to-gerber": "^0.0.49",
|
|
100612
|
-
"circuit-json-to-kicad": "^0.0.
|
|
100612
|
+
"circuit-json-to-kicad": "^0.0.125",
|
|
100613
100613
|
"circuit-json-to-pnp-csv": "^0.0.7",
|
|
100614
100614
|
"circuit-json-to-readable-netlist": "^0.0.15",
|
|
100615
100615
|
"circuit-json-to-spice": "^0.0.10",
|
|
@@ -104571,7 +104571,7 @@ import {
|
|
|
104571
104571
|
TextEffects as TextEffects6,
|
|
104572
104572
|
TextEffectsFont as TextEffectsFont6
|
|
104573
104573
|
} from "kicadts";
|
|
104574
|
-
import { applyToPoint as
|
|
104574
|
+
import { applyToPoint as applyToPoint15 } from "transformation-matrix";
|
|
104575
104575
|
import {
|
|
104576
104576
|
Property as Property2,
|
|
104577
104577
|
TextEffects as TextEffects7,
|
|
@@ -104596,8 +104596,10 @@ import {
|
|
|
104596
104596
|
import"kicadts";
|
|
104597
104597
|
import { FpText, TextEffects as TextEffects8, TextEffectsFont as TextEffectsFont8 } from "kicadts";
|
|
104598
104598
|
import { applyToPoint as applyToPoint9, rotate as rotate2, identity } from "transformation-matrix";
|
|
104599
|
+
import { FpLine, Stroke as Stroke10 } from "kicadts";
|
|
104600
|
+
import { applyToPoint as applyToPoint10, identity as identity2, rotate as rotate3 } from "transformation-matrix";
|
|
104599
104601
|
import { FpText as FpText3, TextEffects as TextEffects9, TextEffectsFont as TextEffectsFont9 } from "kicadts";
|
|
104600
|
-
import { applyToPoint as
|
|
104602
|
+
import { applyToPoint as applyToPoint11, rotate as rotate4, identity as identity3 } from "transformation-matrix";
|
|
104601
104603
|
import { FootprintModel as FootprintModel3 } from "kicadts";
|
|
104602
104604
|
import {
|
|
104603
104605
|
FootprintPad,
|
|
@@ -104609,22 +104611,22 @@ import {
|
|
|
104609
104611
|
PadNet
|
|
104610
104612
|
} from "kicadts";
|
|
104611
104613
|
import {
|
|
104612
|
-
applyToPoint as
|
|
104614
|
+
applyToPoint as applyToPoint12,
|
|
104613
104615
|
compose as compose4,
|
|
104614
104616
|
translate as translate4,
|
|
104615
104617
|
scale as scale3,
|
|
104616
|
-
rotate as
|
|
104618
|
+
rotate as rotate5
|
|
104617
104619
|
} from "transformation-matrix";
|
|
104618
104620
|
import { FootprintPad as FootprintPad2, PadDrill, PadNet as PadNet2 } from "kicadts";
|
|
104619
|
-
import { applyToPoint as applyToPoint12, rotate as rotate5, identity as identity3 } from "transformation-matrix";
|
|
104620
|
-
import { FootprintPad as FootprintPad3, PadDrill as PadDrill2 } from "kicadts";
|
|
104621
104621
|
import { applyToPoint as applyToPoint13, rotate as rotate6, identity as identity4 } from "transformation-matrix";
|
|
104622
|
+
import { FootprintPad as FootprintPad3, PadDrill as PadDrill2 } from "kicadts";
|
|
104623
|
+
import { applyToPoint as applyToPoint14, rotate as rotate7, identity as identity5 } from "transformation-matrix";
|
|
104622
104624
|
import { Segment, SegmentNet } from "kicadts";
|
|
104623
|
-
import { applyToPoint as applyToPoint15 } from "transformation-matrix";
|
|
104624
|
-
import { Via, ViaNet } from "kicadts";
|
|
104625
104625
|
import { applyToPoint as applyToPoint16 } from "transformation-matrix";
|
|
104626
|
-
import {
|
|
104626
|
+
import { Via, ViaNet } from "kicadts";
|
|
104627
104627
|
import { applyToPoint as applyToPoint17 } from "transformation-matrix";
|
|
104628
|
+
import { Footprint as Footprint4 } from "kicadts";
|
|
104629
|
+
import { applyToPoint as applyToPoint18 } from "transformation-matrix";
|
|
104628
104630
|
import { GrLine } from "kicadts";
|
|
104629
104631
|
import {
|
|
104630
104632
|
At as At2,
|
|
@@ -104633,8 +104635,8 @@ import {
|
|
|
104633
104635
|
TextEffectsFont as TextEffectsFont10,
|
|
104634
104636
|
TextEffectsJustify as TextEffectsJustify3
|
|
104635
104637
|
} from "kicadts";
|
|
104636
|
-
import { applyToPoint as
|
|
104637
|
-
import { applyToPoint as
|
|
104638
|
+
import { applyToPoint as applyToPoint19 } from "transformation-matrix";
|
|
104639
|
+
import { applyToPoint as applyToPoint21 } from "transformation-matrix";
|
|
104638
104640
|
import {
|
|
104639
104641
|
GrText as GrText2,
|
|
104640
104642
|
TextEffects as TextEffects11,
|
|
@@ -104642,7 +104644,7 @@ import {
|
|
|
104642
104644
|
TextEffectsJustify as TextEffectsJustify4,
|
|
104643
104645
|
At as At3
|
|
104644
104646
|
} from "kicadts";
|
|
104645
|
-
import { applyToPoint as
|
|
104647
|
+
import { applyToPoint as applyToPoint20 } from "transformation-matrix";
|
|
104646
104648
|
import { cju as cju3 } from "@tscircuit/circuit-json-util";
|
|
104647
104649
|
import { cju as cju4 } from "@tscircuit/circuit-json-util";
|
|
104648
104650
|
import { parseKicadSexpr as parseKicadSexpr2, KicadSch as KicadSch2 } from "kicadts";
|
|
@@ -104816,7 +104818,9 @@ function buildSymbolDataFromSchematicPrimitives(params2) {
|
|
|
104816
104818
|
circuitJson,
|
|
104817
104819
|
schematicSymbolId,
|
|
104818
104820
|
schematicSymbol,
|
|
104819
|
-
schematicComponentId
|
|
104821
|
+
schematicComponentId,
|
|
104822
|
+
schematicComponentCenter,
|
|
104823
|
+
schematicComponentSize
|
|
104820
104824
|
} = params2;
|
|
104821
104825
|
const circles = circuitJson.filter((el) => el.type === "schematic_circle" && el.schematic_symbol_id === schematicSymbolId);
|
|
104822
104826
|
const symbolLines = circuitJson.filter((el) => el.type === "schematic_line" && el.schematic_symbol_id === schematicSymbolId);
|
|
@@ -104894,9 +104898,10 @@ function buildSymbolDataFromSchematicPrimitives(params2) {
|
|
|
104894
104898
|
facingDirection: port.facing_direction
|
|
104895
104899
|
}));
|
|
104896
104900
|
symbolPorts.sort((a, b) => a.pinNumber - b.pinNumber);
|
|
104901
|
+
const symbolCenter = schematicSymbol.center || schematicComponentCenter || { x: 0, y: 0 };
|
|
104897
104902
|
return {
|
|
104898
|
-
center:
|
|
104899
|
-
size: schematicSymbol.size || { width: 1, height: 1 },
|
|
104903
|
+
center: symbolCenter,
|
|
104904
|
+
size: schematicSymbol.size || schematicComponentSize || { width: 1, height: 1 },
|
|
104900
104905
|
primitives,
|
|
104901
104906
|
texts: symbolTexts,
|
|
104902
104907
|
ports: symbolPorts
|
|
@@ -105309,7 +105314,8 @@ var AddLibrarySymbolsStage = class extends ConverterStage {
|
|
|
105309
105314
|
keywords: this.getKeywords(sourceComp),
|
|
105310
105315
|
fpFilters: this.getFpFilters(sourceComp),
|
|
105311
105316
|
footprintRef: footprintName ? `tscircuit:${footprintName}` : "",
|
|
105312
|
-
referencePrefix: getReferencePrefixForComponent(sourceComp)
|
|
105317
|
+
referencePrefix: getReferencePrefixForComponent(sourceComp),
|
|
105318
|
+
symbolScale: this.ctx.kicadSchematicScaleFactor
|
|
105313
105319
|
});
|
|
105314
105320
|
}
|
|
105315
105321
|
createLibrarySymbolFromSchematicSymbol(schematicComponent, sourceComp, cadComponent, schematicSymbolId) {
|
|
@@ -105338,7 +105344,9 @@ var AddLibrarySymbolsStage = class extends ConverterStage {
|
|
|
105338
105344
|
circuitJson: this.ctx.circuitJson,
|
|
105339
105345
|
schematicSymbolId,
|
|
105340
105346
|
schematicSymbol,
|
|
105341
|
-
schematicComponentId: schematicComponent.schematic_component_id
|
|
105347
|
+
schematicComponentId: schematicComponent.schematic_component_id,
|
|
105348
|
+
schematicComponentCenter: schematicComponent.center,
|
|
105349
|
+
schematicComponentSize: schematicComponent.size
|
|
105342
105350
|
});
|
|
105343
105351
|
const footprintName = getKicadCompatibleComponentName(sourceComp, cadComponent);
|
|
105344
105352
|
return this.createLibrarySymbol({
|
|
@@ -105351,7 +105359,7 @@ var AddLibrarySymbolsStage = class extends ConverterStage {
|
|
|
105351
105359
|
fpFilters: this.getFpFilters(sourceComp, schematicSymbol.name),
|
|
105352
105360
|
footprintRef: footprintName ? `tscircuit:${footprintName}` : "",
|
|
105353
105361
|
referencePrefix: getReferencePrefixForComponent(sourceComp),
|
|
105354
|
-
symbolScale:
|
|
105362
|
+
symbolScale: this.ctx.kicadSchematicScaleFactor
|
|
105355
105363
|
});
|
|
105356
105364
|
}
|
|
105357
105365
|
createLibrarySymbolForNetLabel({
|
|
@@ -105374,7 +105382,8 @@ var AddLibrarySymbolsStage = class extends ConverterStage {
|
|
|
105374
105382
|
description: isPower ? "Power net label" : isGround ? "Ground net label" : "Net symbol",
|
|
105375
105383
|
keywords: isPower ? "power net" : isGround ? "ground net" : "net",
|
|
105376
105384
|
fpFilters: "",
|
|
105377
|
-
referencePrefix: libId.split(":")[1]?.[0] || "U"
|
|
105385
|
+
referencePrefix: libId.split(":")[1]?.[0] || "U",
|
|
105386
|
+
symbolScale: this.ctx.kicadSchematicScaleFactor
|
|
105378
105387
|
});
|
|
105379
105388
|
}
|
|
105380
105389
|
getSymbolData(symbolName, schematicComponent) {
|
|
@@ -105395,8 +105404,6 @@ var AddLibrarySymbolsStage = class extends ConverterStage {
|
|
|
105395
105404
|
referencePrefix,
|
|
105396
105405
|
symbolScale
|
|
105397
105406
|
}) {
|
|
105398
|
-
const CIRCUIT_JSON_SCALE_FACTOR = 15;
|
|
105399
|
-
const c2kMatSchScale = symbolScale ?? this.ctx.c2kMatSch?.a ?? CIRCUIT_JSON_SCALE_FACTOR;
|
|
105400
105407
|
const symbol = new SchematicSymbol4({
|
|
105401
105408
|
libraryId: libId,
|
|
105402
105409
|
excludeFromSim: false,
|
|
@@ -105422,7 +105429,7 @@ var AddLibrarySymbolsStage = class extends ConverterStage {
|
|
|
105422
105429
|
libId,
|
|
105423
105430
|
symbolData,
|
|
105424
105431
|
isChip,
|
|
105425
|
-
c2kMatSchScale
|
|
105432
|
+
c2kMatSchScale: symbolScale
|
|
105426
105433
|
});
|
|
105427
105434
|
symbol.subSymbols.push(drawingSymbol);
|
|
105428
105435
|
const pinSymbol = createPinSubsymbol({
|
|
@@ -105431,7 +105438,7 @@ var AddLibrarySymbolsStage = class extends ConverterStage {
|
|
|
105431
105438
|
isChip,
|
|
105432
105439
|
schematicComponent,
|
|
105433
105440
|
schematicPorts: this.ctx.db.schematic_port.list(),
|
|
105434
|
-
c2kMatSchScale
|
|
105441
|
+
c2kMatSchScale: symbolScale
|
|
105435
105442
|
});
|
|
105436
105443
|
symbol.subSymbols.push(pinSymbol);
|
|
105437
105444
|
symbol._sxEmbeddedFonts = new EmbeddedFonts(false);
|
|
@@ -105530,7 +105537,8 @@ var AddSchematicSymbolsStage = class extends ConverterStage {
|
|
|
105530
105537
|
const symLibId = new SymbolLibId(libId);
|
|
105531
105538
|
symbol._sxLibId = symLibId;
|
|
105532
105539
|
const { reference, value, description } = this.getComponentMetadata(sourceComponent);
|
|
105533
|
-
const
|
|
105540
|
+
const hasChipManufacturerValue = sourceComponent.ftype === "simple_chip" && Boolean(sourceComponent.manufacturer_part_number);
|
|
105541
|
+
const { refTextPos, valTextPos } = this.getTextPositions(schematicComponent, hasChipManufacturerValue);
|
|
105534
105542
|
let symbolMetadata;
|
|
105535
105543
|
if (schematicSymbolId) {
|
|
105536
105544
|
const schSymEl = this.ctx.circuitJson.find((el) => el.type === "schematic_symbol" && el.schematic_symbol_id === schematicSymbolId);
|
|
@@ -105546,7 +105554,7 @@ var AddSchematicSymbolsStage = class extends ConverterStage {
|
|
|
105546
105554
|
at: [refTextPos.x, refTextPos.y, 0],
|
|
105547
105555
|
effects: this.createTextEffects(Number(refMeta?.effects?.font?.size?.x ?? 1.27), refMeta?.effects?.hide ?? false)
|
|
105548
105556
|
});
|
|
105549
|
-
const hideValue = sourceComponent.ftype === "simple_chip";
|
|
105557
|
+
const hideValue = sourceComponent.ftype === "simple_chip" && !hasChipManufacturerValue;
|
|
105550
105558
|
const valMeta = symbolMetadata?.properties?.Value;
|
|
105551
105559
|
const valueProperty = new SymbolProperty2({
|
|
105552
105560
|
key: "Value",
|
|
@@ -105665,22 +105673,62 @@ var AddSchematicSymbolsStage = class extends ConverterStage {
|
|
|
105665
105673
|
}
|
|
105666
105674
|
this.finished = true;
|
|
105667
105675
|
}
|
|
105668
|
-
getTextPositions(schematicComponent,
|
|
105676
|
+
getTextPositions(schematicComponent, placeValueAtNamePosition) {
|
|
105677
|
+
const c2kMatSch = this.ctx.c2kMatSch;
|
|
105678
|
+
const schematicScale = c2kMatSch.a;
|
|
105679
|
+
const symbolKicadPos = applyToPoint5(c2kMatSch, {
|
|
105680
|
+
x: schematicComponent.center.x,
|
|
105681
|
+
y: schematicComponent.center.y
|
|
105682
|
+
});
|
|
105683
|
+
const componentHeightMm = (schematicComponent.size?.height || 1) * schematicScale;
|
|
105684
|
+
const referenceAboveBodyY = symbolKicadPos.y - componentHeightMm / 2 - 3;
|
|
105685
|
+
const isCustomSymbol = this.isCustomSymbolComponent(schematicComponent);
|
|
105686
|
+
if (isCustomSymbol) {
|
|
105687
|
+
const customHeightMm = (schematicComponent.size?.height || 1) * this.ctx.kicadSchematicScaleFactor;
|
|
105688
|
+
const refTextPos2 = {
|
|
105689
|
+
x: symbolKicadPos.x,
|
|
105690
|
+
y: symbolKicadPos.y - customHeightMm / 2 - 3
|
|
105691
|
+
};
|
|
105692
|
+
const valTextPos2 = {
|
|
105693
|
+
x: symbolKicadPos.x,
|
|
105694
|
+
y: symbolKicadPos.y + customHeightMm / 2 + 3
|
|
105695
|
+
};
|
|
105696
|
+
if (placeValueAtNamePosition) {
|
|
105697
|
+
return {
|
|
105698
|
+
refTextPos: refTextPos2,
|
|
105699
|
+
valTextPos: { x: symbolKicadPos.x, y: symbolKicadPos.y }
|
|
105700
|
+
};
|
|
105701
|
+
}
|
|
105702
|
+
return { refTextPos: refTextPos2, valTextPos: valTextPos2 };
|
|
105703
|
+
}
|
|
105669
105704
|
const schematicTexts = this.ctx.db.schematic_text?.list?.()?.filter((t) => t.schematic_component_id === schematicComponent.schematic_component_id) || [];
|
|
105670
105705
|
const refText = schematicTexts.find((t) => t.text && t.text.length > 0);
|
|
105671
|
-
if (refText
|
|
105672
|
-
const
|
|
105706
|
+
if (refText) {
|
|
105707
|
+
const nameTextPos = applyToPoint5(c2kMatSch, {
|
|
105673
105708
|
x: refText.position.x,
|
|
105674
105709
|
y: refText.position.y
|
|
105675
105710
|
});
|
|
105711
|
+
if (placeValueAtNamePosition) {
|
|
105712
|
+
return {
|
|
105713
|
+
refTextPos: { x: symbolKicadPos.x, y: referenceAboveBodyY },
|
|
105714
|
+
valTextPos: nameTextPos
|
|
105715
|
+
};
|
|
105716
|
+
}
|
|
105717
|
+
const refTextPos2 = nameTextPos;
|
|
105676
105718
|
const valTextPos2 = { x: symbolKicadPos.x, y: symbolKicadPos.y + 6 };
|
|
105677
105719
|
return { refTextPos: refTextPos2, valTextPos: valTextPos2 };
|
|
105678
105720
|
}
|
|
105679
105721
|
const symbolName = schematicComponent.symbol_name;
|
|
105722
|
+
if (!symbolName) {
|
|
105723
|
+
return {
|
|
105724
|
+
refTextPos: { x: symbolKicadPos.x, y: referenceAboveBodyY },
|
|
105725
|
+
valTextPos: { x: symbolKicadPos.x, y: symbolKicadPos.y + 6 }
|
|
105726
|
+
};
|
|
105727
|
+
}
|
|
105680
105728
|
const symbol = symbols3[symbolName];
|
|
105681
105729
|
if (!symbol) {
|
|
105682
105730
|
return {
|
|
105683
|
-
refTextPos: { x: symbolKicadPos.x, y:
|
|
105731
|
+
refTextPos: { x: symbolKicadPos.x, y: referenceAboveBodyY },
|
|
105684
105732
|
valTextPos: { x: symbolKicadPos.x, y: symbolKicadPos.y + 6 }
|
|
105685
105733
|
};
|
|
105686
105734
|
}
|
|
@@ -105698,16 +105746,22 @@ var AddSchematicSymbolsStage = class extends ConverterStage {
|
|
|
105698
105746
|
const symbolCenter = symbol.center || { x: 0, y: 0 };
|
|
105699
105747
|
const isVertical = symbolName.includes("_down") || symbolName.includes("_up");
|
|
105700
105748
|
const horizontalTextOffset = isVertical ? 0.15 : 0;
|
|
105701
|
-
const refTextPos = refTextPrimitive
|
|
105749
|
+
const refTextPos = refTextPrimitive ? applyToPoint5(c2kMatSch, {
|
|
105702
105750
|
x: schematicComponent.center.x + (refTextPrimitive.x - symbolCenter.x) + horizontalTextOffset,
|
|
105703
105751
|
y: schematicComponent.center.y + (refTextPrimitive.y - symbolCenter.y)
|
|
105704
|
-
}) : { x: symbolKicadPos.x, y:
|
|
105705
|
-
const valTextPos = valTextPrimitive
|
|
105752
|
+
}) : { x: symbolKicadPos.x, y: referenceAboveBodyY };
|
|
105753
|
+
const valTextPos = valTextPrimitive ? applyToPoint5(c2kMatSch, {
|
|
105706
105754
|
x: schematicComponent.center.x + (valTextPrimitive.x - symbolCenter.x) + horizontalTextOffset,
|
|
105707
105755
|
y: schematicComponent.center.y + (valTextPrimitive.y - symbolCenter.y)
|
|
105708
105756
|
}) : { x: symbolKicadPos.x, y: symbolKicadPos.y + 6 };
|
|
105709
105757
|
return { refTextPos, valTextPos };
|
|
105710
105758
|
}
|
|
105759
|
+
isCustomSymbolComponent(schematicComponent) {
|
|
105760
|
+
const componentId = schematicComponent.schematic_component_id;
|
|
105761
|
+
if (!componentId)
|
|
105762
|
+
return false;
|
|
105763
|
+
return this.ctx.circuitJson.some((el) => (el.type === "schematic_line" || el.type === "schematic_circle" || el.type === "schematic_path") && el.schematic_component_id === componentId && el.schematic_symbol_id);
|
|
105764
|
+
}
|
|
105711
105765
|
getComponentMetadata(sourceComp) {
|
|
105712
105766
|
const name = sourceComp.name || "?";
|
|
105713
105767
|
const reference = getReferenceDesignator(sourceComp);
|
|
@@ -105742,7 +105796,7 @@ var AddSchematicSymbolsStage = class extends ConverterStage {
|
|
|
105742
105796
|
if (sourceComp.ftype === "simple_chip") {
|
|
105743
105797
|
return {
|
|
105744
105798
|
reference,
|
|
105745
|
-
value:
|
|
105799
|
+
value: sourceComp.manufacturer_part_number || "",
|
|
105746
105800
|
description: "Integrated Circuit"
|
|
105747
105801
|
};
|
|
105748
105802
|
}
|
|
@@ -106121,6 +106175,7 @@ function selectSchematicPaperSize(contentWidth, contentHeight, paddingMm = 20) {
|
|
|
106121
106175
|
}
|
|
106122
106176
|
return PAPER_SIZES[PAPER_SIZES.length - 1];
|
|
106123
106177
|
}
|
|
106178
|
+
var DEFAULT_SCHEMATIC_SCALE_FACTOR = 15;
|
|
106124
106179
|
var CircuitJsonToKicadSchConverter = class {
|
|
106125
106180
|
ctx;
|
|
106126
106181
|
pipeline;
|
|
@@ -106130,11 +106185,11 @@ var CircuitJsonToKicadSchConverter = class {
|
|
|
106130
106185
|
return this.pipeline[this.currentStageIndex];
|
|
106131
106186
|
}
|
|
106132
106187
|
constructor(circuitJson) {
|
|
106133
|
-
const
|
|
106188
|
+
const kicadSchematicScaleFactor = DEFAULT_SCHEMATIC_SCALE_FACTOR;
|
|
106134
106189
|
const db = cju(circuitJson);
|
|
106135
106190
|
const { center, bounds } = getSchematicBoundsAndCenter(db);
|
|
106136
|
-
const schematicWidthMm = (bounds.maxX - bounds.minX) *
|
|
106137
|
-
const schematicHeightMm = (bounds.maxY - bounds.minY) *
|
|
106191
|
+
const schematicWidthMm = (bounds.maxX - bounds.minX) * kicadSchematicScaleFactor;
|
|
106192
|
+
const schematicHeightMm = (bounds.maxY - bounds.minY) * kicadSchematicScaleFactor;
|
|
106138
106193
|
const paperSize = selectSchematicPaperSize(schematicWidthMm, schematicHeightMm);
|
|
106139
106194
|
const KICAD_CENTER_X = paperSize.width / 2;
|
|
106140
106195
|
const KICAD_CENTER_Y = paperSize.height / 2;
|
|
@@ -106145,8 +106200,9 @@ var CircuitJsonToKicadSchConverter = class {
|
|
|
106145
106200
|
generator: "circuit-json-to-kicad",
|
|
106146
106201
|
generatorVersion: "0.0.1"
|
|
106147
106202
|
}),
|
|
106203
|
+
kicadSchematicScaleFactor,
|
|
106148
106204
|
schematicPaperSize: paperSize,
|
|
106149
|
-
c2kMatSch: compose2(translate2(KICAD_CENTER_X, KICAD_CENTER_Y), scale(
|
|
106205
|
+
c2kMatSch: compose2(translate2(KICAD_CENTER_X, KICAD_CENTER_Y), scale(kicadSchematicScaleFactor, -kicadSchematicScaleFactor), translate2(-center.x, -center.y))
|
|
106150
106206
|
};
|
|
106151
106207
|
this.pipeline = [
|
|
106152
106208
|
new InitializeSchematicStage(circuitJson, this.ctx),
|
|
@@ -106596,6 +106652,15 @@ function applyMetadataToFootprint({
|
|
|
106596
106652
|
effects: createTextEffects2(descMeta?.effects),
|
|
106597
106653
|
hidden: descMeta?.hide ?? true
|
|
106598
106654
|
}));
|
|
106655
|
+
newProperties.push(new Property2({
|
|
106656
|
+
key: "Supplier Part Number",
|
|
106657
|
+
value: componentProperty.supplierPartNumber,
|
|
106658
|
+
position: [0, 0, 0],
|
|
106659
|
+
layer: "F.Fab",
|
|
106660
|
+
uuid: generateDeterministicUuid(`${componentProperty.reference}-property-SupplierPartNumber`),
|
|
106661
|
+
effects: createTextEffects2(),
|
|
106662
|
+
hidden: true
|
|
106663
|
+
}));
|
|
106599
106664
|
footprint.properties = newProperties;
|
|
106600
106665
|
if (metadata?.attributes) {
|
|
106601
106666
|
if (!footprint.attr) {
|
|
@@ -106649,64 +106714,78 @@ function applyMetadataToFootprint({
|
|
|
106649
106714
|
footprint.models = [model, ...existingModels];
|
|
106650
106715
|
}
|
|
106651
106716
|
}
|
|
106717
|
+
function getJlcpcbSupplierPartNumber(sourceComp) {
|
|
106718
|
+
const jlcpcbPartNumbers = sourceComp.supplier_part_numbers?.jlcpcb;
|
|
106719
|
+
return jlcpcbPartNumbers && jlcpcbPartNumbers.length > 0 ? jlcpcbPartNumbers.join(", ") : undefined;
|
|
106720
|
+
}
|
|
106652
106721
|
function getkicadComponentProperty(sourceComp) {
|
|
106653
106722
|
const name = sourceComp.name || "?";
|
|
106654
106723
|
const reference = getReferenceDesignator(sourceComp);
|
|
106724
|
+
const supplierPartNumber = getJlcpcbSupplierPartNumber(sourceComp);
|
|
106655
106725
|
if (sourceComp.ftype === "simple_resistor") {
|
|
106656
106726
|
const resistor = sourceComp;
|
|
106657
106727
|
return {
|
|
106658
106728
|
reference,
|
|
106659
|
-
kicadComponentValue: resistor.display_resistance || "R"
|
|
106729
|
+
kicadComponentValue: resistor.display_resistance || "R",
|
|
106730
|
+
supplierPartNumber
|
|
106660
106731
|
};
|
|
106661
106732
|
}
|
|
106662
106733
|
if (sourceComp.ftype === "simple_capacitor") {
|
|
106663
106734
|
const capacitor = sourceComp;
|
|
106664
106735
|
return {
|
|
106665
106736
|
reference,
|
|
106666
|
-
kicadComponentValue: capacitor.display_capacitance || "C"
|
|
106737
|
+
kicadComponentValue: capacitor.display_capacitance || "C",
|
|
106738
|
+
supplierPartNumber
|
|
106667
106739
|
};
|
|
106668
106740
|
}
|
|
106669
106741
|
if (sourceComp.ftype === "simple_inductor") {
|
|
106670
106742
|
const inductor = sourceComp;
|
|
106671
106743
|
return {
|
|
106672
106744
|
reference,
|
|
106673
|
-
kicadComponentValue: inductor.display_inductance || "L"
|
|
106745
|
+
kicadComponentValue: inductor.display_inductance || "L",
|
|
106746
|
+
supplierPartNumber
|
|
106674
106747
|
};
|
|
106675
106748
|
}
|
|
106676
106749
|
if (sourceComp.ftype === "simple_diode") {
|
|
106677
106750
|
return {
|
|
106678
106751
|
reference,
|
|
106679
|
-
kicadComponentValue: "D"
|
|
106752
|
+
kicadComponentValue: "D",
|
|
106753
|
+
supplierPartNumber
|
|
106680
106754
|
};
|
|
106681
106755
|
}
|
|
106682
106756
|
if (sourceComp.ftype === "simple_chip") {
|
|
106683
106757
|
return {
|
|
106684
106758
|
reference,
|
|
106685
|
-
kicadComponentValue: sourceComp?.manufacturer_part_number
|
|
106759
|
+
kicadComponentValue: sourceComp?.manufacturer_part_number,
|
|
106760
|
+
supplierPartNumber
|
|
106686
106761
|
};
|
|
106687
106762
|
}
|
|
106688
106763
|
if (sourceComp.ftype === "simple_led") {
|
|
106689
106764
|
return {
|
|
106690
106765
|
reference,
|
|
106691
|
-
kicadComponentValue: sourceComp.manufacturer_part_number || "LED"
|
|
106766
|
+
kicadComponentValue: sourceComp.manufacturer_part_number || "LED",
|
|
106767
|
+
supplierPartNumber
|
|
106692
106768
|
};
|
|
106693
106769
|
}
|
|
106694
106770
|
if (sourceComp.ftype === "simple_switch") {
|
|
106695
106771
|
return {
|
|
106696
106772
|
reference,
|
|
106697
|
-
kicadComponentValue: sourceComp.manufacturer_part_number || "SW"
|
|
106773
|
+
kicadComponentValue: sourceComp.manufacturer_part_number || "SW",
|
|
106774
|
+
supplierPartNumber
|
|
106698
106775
|
};
|
|
106699
106776
|
}
|
|
106700
106777
|
if (sourceComp.ftype === "simple_potentiometer") {
|
|
106701
106778
|
const potentiometer = sourceComp;
|
|
106702
106779
|
return {
|
|
106703
106780
|
reference,
|
|
106704
|
-
kicadComponentValue: potentiometer.display_max_resistance || "POT"
|
|
106781
|
+
kicadComponentValue: potentiometer.display_max_resistance || "POT",
|
|
106782
|
+
supplierPartNumber
|
|
106705
106783
|
};
|
|
106706
106784
|
}
|
|
106707
106785
|
return {
|
|
106708
106786
|
reference,
|
|
106709
|
-
kicadComponentValue: name
|
|
106787
|
+
kicadComponentValue: name,
|
|
106788
|
+
supplierPartNumber
|
|
106710
106789
|
};
|
|
106711
106790
|
}
|
|
106712
106791
|
function convertSilkscreenCircles(silkscreenCircles, componentCenter) {
|
|
@@ -106924,13 +107003,52 @@ function convertSilkscreenTexts(silkscreenTexts, componentCenter, componentRotat
|
|
|
106924
107003
|
}
|
|
106925
107004
|
return fpTexts;
|
|
106926
107005
|
}
|
|
107006
|
+
function convertSilkscreenPaths(silkscreenPaths, { componentCenter, componentRotation = 0 }) {
|
|
107007
|
+
const fpLines = [];
|
|
107008
|
+
const rotationMatrix = componentRotation !== 0 ? rotate3(componentRotation * Math.PI / 180) : identity2();
|
|
107009
|
+
for (const path16 of silkscreenPaths) {
|
|
107010
|
+
if (!path16.route || path16.route.length < 2)
|
|
107011
|
+
continue;
|
|
107012
|
+
const layerMap = {
|
|
107013
|
+
top: "F.SilkS",
|
|
107014
|
+
bottom: "B.SilkS"
|
|
107015
|
+
};
|
|
107016
|
+
const kicadLayer = layerMap[path16.layer] || path16.layer || "F.SilkS";
|
|
107017
|
+
for (let i = 0;i < path16.route.length - 1; i++) {
|
|
107018
|
+
const startPoint = path16.route[i];
|
|
107019
|
+
const endPoint = path16.route[i + 1];
|
|
107020
|
+
if (!startPoint || !endPoint)
|
|
107021
|
+
continue;
|
|
107022
|
+
const startRelative = applyToPoint10(rotationMatrix, {
|
|
107023
|
+
x: startPoint.x - componentCenter.x,
|
|
107024
|
+
y: -(startPoint.y - componentCenter.y)
|
|
107025
|
+
});
|
|
107026
|
+
const endRelative = applyToPoint10(rotationMatrix, {
|
|
107027
|
+
x: endPoint.x - componentCenter.x,
|
|
107028
|
+
y: -(endPoint.y - componentCenter.y)
|
|
107029
|
+
});
|
|
107030
|
+
const fpLine = new FpLine({
|
|
107031
|
+
start: { x: startRelative.x, y: startRelative.y },
|
|
107032
|
+
end: { x: endRelative.x, y: endRelative.y },
|
|
107033
|
+
layer: kicadLayer,
|
|
107034
|
+
stroke: new Stroke10
|
|
107035
|
+
});
|
|
107036
|
+
if (fpLine.stroke) {
|
|
107037
|
+
fpLine.stroke.width = path16.stroke_width || 0.15;
|
|
107038
|
+
fpLine.stroke.type = "default";
|
|
107039
|
+
}
|
|
107040
|
+
fpLines.push(fpLine);
|
|
107041
|
+
}
|
|
107042
|
+
}
|
|
107043
|
+
return fpLines;
|
|
107044
|
+
}
|
|
106927
107045
|
function convertNoteTexts(noteTexts, componentCenter, componentRotation) {
|
|
106928
107046
|
const fpTexts = [];
|
|
106929
107047
|
for (const textElement of noteTexts) {
|
|
106930
107048
|
const relX = textElement.anchor_position.x - componentCenter.x;
|
|
106931
107049
|
const relY = -(textElement.anchor_position.y - componentCenter.y);
|
|
106932
|
-
const rotationMatrix = componentRotation !== 0 ?
|
|
106933
|
-
const rotatedPos =
|
|
107050
|
+
const rotationMatrix = componentRotation !== 0 ? rotate4(componentRotation * Math.PI / 180) : identity3();
|
|
107051
|
+
const rotatedPos = applyToPoint11(rotationMatrix, { x: relX, y: relY });
|
|
106934
107052
|
const fontSize = textElement.font_size || 1;
|
|
106935
107053
|
const font = new TextEffectsFont9;
|
|
106936
107054
|
font.size = { width: fontSize, height: fontSize };
|
|
@@ -106994,8 +107112,8 @@ function createSmdPadFromCircuitJson({
|
|
|
106994
107112
|
} else {
|
|
106995
107113
|
throw new Error("Pad must have either x/y coordinates or points array");
|
|
106996
107114
|
}
|
|
106997
|
-
const cj2kicadMatrix = compose4(componentRotation !== 0 ?
|
|
106998
|
-
const rotatedPos =
|
|
107115
|
+
const cj2kicadMatrix = compose4(componentRotation !== 0 ? rotate5(componentRotation * Math.PI / 180) : { a: 1, b: 0, c: 0, d: 1, e: 0, f: 0 }, scale3(1, -1), translate4(-componentCenter.x, -componentCenter.y));
|
|
107116
|
+
const rotatedPos = applyToPoint12(cj2kicadMatrix, {
|
|
106999
107117
|
x: padX,
|
|
107000
107118
|
y: padY
|
|
107001
107119
|
});
|
|
@@ -107008,6 +107126,8 @@ function createSmdPadFromCircuitJson({
|
|
|
107008
107126
|
let padSize;
|
|
107009
107127
|
let padOptions;
|
|
107010
107128
|
let padPrimitives;
|
|
107129
|
+
let roundrect_rratio;
|
|
107130
|
+
let rotation = 0;
|
|
107011
107131
|
if (pcbPad.shape === "circle") {
|
|
107012
107132
|
padShape = "circle";
|
|
107013
107133
|
padSize = [
|
|
@@ -107018,7 +107138,7 @@ function createSmdPadFromCircuitJson({
|
|
|
107018
107138
|
const points = pcbPad.points;
|
|
107019
107139
|
const pointTransformMatrix = compose4(scale3(1, -1), translate4(-padX, -padY));
|
|
107020
107140
|
const relativePoints = points.map((p) => {
|
|
107021
|
-
const transformed =
|
|
107141
|
+
const transformed = applyToPoint12(pointTransformMatrix, { x: p.x, y: p.y });
|
|
107022
107142
|
return new Xy4(transformed.x, transformed.y);
|
|
107023
107143
|
});
|
|
107024
107144
|
const grPoly = new PadPrimitiveGrPoly;
|
|
@@ -107031,19 +107151,32 @@ function createSmdPadFromCircuitJson({
|
|
|
107031
107151
|
padOptions = new PadOptions;
|
|
107032
107152
|
padOptions.anchor = "circle";
|
|
107033
107153
|
padSize = [0.2, 0.2];
|
|
107034
|
-
} else {
|
|
107035
|
-
|
|
107036
|
-
|
|
107037
|
-
"
|
|
107038
|
-
|
|
107039
|
-
|
|
107154
|
+
} else if (pcbPad.shape === "rotated_rect") {
|
|
107155
|
+
const cornerRadius = pcbPad.corner_radius ?? pcbPad.rect_border_radius;
|
|
107156
|
+
if (cornerRadius) {
|
|
107157
|
+
padShape = "roundrect";
|
|
107158
|
+
roundrect_rratio = cornerRadius / Math.min(pcbPad.width, pcbPad.height);
|
|
107159
|
+
} else {
|
|
107160
|
+
padShape = "rect";
|
|
107161
|
+
}
|
|
107162
|
+
padSize = [pcbPad.width, pcbPad.height];
|
|
107163
|
+
rotation = pcbPad.ccw_rotation;
|
|
107164
|
+
} else if (pcbPad.shape === "rect") {
|
|
107165
|
+
const cornerRadius = pcbPad.corner_radius ?? pcbPad.rect_border_radius;
|
|
107166
|
+
if (cornerRadius) {
|
|
107167
|
+
padShape = "roundrect";
|
|
107168
|
+
roundrect_rratio = cornerRadius / Math.min(pcbPad.width, pcbPad.height);
|
|
107169
|
+
} else {
|
|
107170
|
+
padShape = "rect";
|
|
107171
|
+
}
|
|
107172
|
+
padSize = [pcbPad.width, pcbPad.height];
|
|
107040
107173
|
}
|
|
107041
107174
|
const padData = `pad:${componentId}:${padNumber}:${rotatedPos.x},${rotatedPos.y}`;
|
|
107042
107175
|
const pad = new FootprintPad({
|
|
107043
107176
|
number: String(padNumber),
|
|
107044
107177
|
padType: "smd",
|
|
107045
107178
|
shape: padShape,
|
|
107046
|
-
at: [rotatedPos.x, rotatedPos.y,
|
|
107179
|
+
at: [rotatedPos.x, rotatedPos.y, rotation],
|
|
107047
107180
|
size: padSize,
|
|
107048
107181
|
layers: [
|
|
107049
107182
|
`${padLayer}`,
|
|
@@ -107063,15 +107196,27 @@ function createSmdPadFromCircuitJson({
|
|
|
107063
107196
|
}
|
|
107064
107197
|
return pad;
|
|
107065
107198
|
}
|
|
107066
|
-
function convertSmdPads(
|
|
107199
|
+
function convertSmdPads({
|
|
107200
|
+
pcbPads,
|
|
107201
|
+
componentCenter,
|
|
107202
|
+
componentRotation,
|
|
107203
|
+
componentId,
|
|
107204
|
+
startPadNumber,
|
|
107205
|
+
getNetInfo
|
|
107206
|
+
}, ctx) {
|
|
107067
107207
|
const pads = [];
|
|
107068
107208
|
let padNumber = startPadNumber;
|
|
107069
107209
|
for (const pcbPad of pcbPads) {
|
|
107070
107210
|
const netInfo = getNetInfo(pcbPad.pcb_port_id);
|
|
107211
|
+
const pcbPort = pcbPad.pcb_port_id ? ctx.db.pcb_port?.get(pcbPad.pcb_port_id) : undefined;
|
|
107212
|
+
const sourcePort = pcbPort?.source_port_id ? ctx.db.source_port?.get(pcbPort.source_port_id) : undefined;
|
|
107213
|
+
const pinHint = pcbPad.port_hints?.find((h) => /^pin[A-Za-z0-9_]+$/i.test(h));
|
|
107214
|
+
const gridHint = pcbPad.port_hints?.find((h) => /^[A-Za-z]?\d+[A-Za-z0-9_]*$/.test(h));
|
|
107215
|
+
const resolvedPadNumber = sourcePort?.pin_number != null ? String(sourcePort.pin_number) : pinHint ? pinHint.replace(/^pin/i, "") : gridHint ?? String(padNumber);
|
|
107071
107216
|
const pad = createSmdPadFromCircuitJson({
|
|
107072
107217
|
pcbPad,
|
|
107073
107218
|
componentCenter,
|
|
107074
|
-
padNumber,
|
|
107219
|
+
padNumber: resolvedPadNumber,
|
|
107075
107220
|
componentRotation,
|
|
107076
107221
|
netInfo,
|
|
107077
107222
|
componentId
|
|
@@ -107094,8 +107239,8 @@ function createThruHolePadFromCircuitJson({
|
|
|
107094
107239
|
}
|
|
107095
107240
|
const relativeX = platedHole.x - componentCenter.x;
|
|
107096
107241
|
const relativeY = -(platedHole.y - componentCenter.y);
|
|
107097
|
-
const rotationMatrix = componentRotation !== 0 ?
|
|
107098
|
-
const rotatedPos =
|
|
107242
|
+
const rotationMatrix = componentRotation !== 0 ? rotate6(componentRotation * Math.PI / 180) : identity4();
|
|
107243
|
+
const rotatedPos = applyToPoint13(rotationMatrix, {
|
|
107099
107244
|
x: relativeX,
|
|
107100
107245
|
y: relativeY
|
|
107101
107246
|
});
|
|
@@ -107111,7 +107256,7 @@ function createThruHolePadFromCircuitJson({
|
|
|
107111
107256
|
y: platedHole.hole_offset_y ?? 0
|
|
107112
107257
|
};
|
|
107113
107258
|
if (rawOffset.x !== 0 || rawOffset.y !== 0) {
|
|
107114
|
-
const rotatedOffset =
|
|
107259
|
+
const rotatedOffset = applyToPoint13(rotationMatrix, {
|
|
107115
107260
|
x: -rawOffset.x,
|
|
107116
107261
|
y: rawOffset.y
|
|
107117
107262
|
});
|
|
@@ -107127,10 +107272,7 @@ function createThruHolePadFromCircuitJson({
|
|
|
107127
107272
|
});
|
|
107128
107273
|
} else if (platedHole.shape === "pill" || platedHole.shape === "oval") {
|
|
107129
107274
|
padShape = "oval";
|
|
107130
|
-
padSize = [
|
|
107131
|
-
platedHole.outer_width,
|
|
107132
|
-
platedHole.outer_height
|
|
107133
|
-
];
|
|
107275
|
+
padSize = [platedHole.outer_width, platedHole.outer_height];
|
|
107134
107276
|
drill = new PadDrill({
|
|
107135
107277
|
oval: true,
|
|
107136
107278
|
diameter: platedHole.hole_width,
|
|
@@ -107139,10 +107281,7 @@ function createThruHolePadFromCircuitJson({
|
|
|
107139
107281
|
});
|
|
107140
107282
|
} else if (platedHole.shape === "pill_hole_with_rect_pad") {
|
|
107141
107283
|
padShape = "rect";
|
|
107142
|
-
padSize = [
|
|
107143
|
-
platedHole.rect_pad_width,
|
|
107144
|
-
platedHole.rect_pad_height
|
|
107145
|
-
];
|
|
107284
|
+
padSize = [platedHole.rect_pad_width, platedHole.rect_pad_height];
|
|
107146
107285
|
drill = new PadDrill({
|
|
107147
107286
|
oval: true,
|
|
107148
107287
|
diameter: platedHole.hole_width,
|
|
@@ -107151,20 +107290,15 @@ function createThruHolePadFromCircuitJson({
|
|
|
107151
107290
|
});
|
|
107152
107291
|
} else if (platedHole.shape === "circular_hole_with_rect_pad") {
|
|
107153
107292
|
padShape = "rect";
|
|
107154
|
-
padSize = [
|
|
107155
|
-
platedHole.rect_pad_width,
|
|
107156
|
-
platedHole.rect_pad_height
|
|
107157
|
-
];
|
|
107293
|
+
padSize = [platedHole.rect_pad_width, platedHole.rect_pad_height];
|
|
107158
107294
|
drill = new PadDrill({
|
|
107159
107295
|
diameter: platedHole.hole_diameter,
|
|
107160
107296
|
offset: drillOffset
|
|
107161
107297
|
});
|
|
107298
|
+
rotation = platedHole.rect_ccw_rotation || 0;
|
|
107162
107299
|
} else if (platedHole.shape === "rotated_pill_hole_with_rect_pad") {
|
|
107163
107300
|
padShape = "rect";
|
|
107164
|
-
padSize = [
|
|
107165
|
-
platedHole.rect_pad_width,
|
|
107166
|
-
platedHole.rect_pad_height
|
|
107167
|
-
];
|
|
107301
|
+
padSize = [platedHole.rect_pad_width, platedHole.rect_pad_height];
|
|
107168
107302
|
drill = new PadDrill({
|
|
107169
107303
|
oval: true,
|
|
107170
107304
|
diameter: platedHole.hole_width,
|
|
@@ -107194,15 +107328,27 @@ function createThruHolePadFromCircuitJson({
|
|
|
107194
107328
|
}
|
|
107195
107329
|
return pad;
|
|
107196
107330
|
}
|
|
107197
|
-
function convertPlatedHoles(
|
|
107331
|
+
function convertPlatedHoles({
|
|
107332
|
+
platedHoles,
|
|
107333
|
+
componentCenter,
|
|
107334
|
+
componentRotation,
|
|
107335
|
+
componentId,
|
|
107336
|
+
startPadNumber,
|
|
107337
|
+
getNetInfo
|
|
107338
|
+
}, ctx) {
|
|
107198
107339
|
const pads = [];
|
|
107199
107340
|
let padNumber = startPadNumber;
|
|
107200
107341
|
for (const platedHole of platedHoles) {
|
|
107201
107342
|
const netInfo = getNetInfo(platedHole.pcb_port_id);
|
|
107343
|
+
const pcbPort = platedHole.pcb_port_id ? ctx.db.pcb_port?.get(platedHole.pcb_port_id) : undefined;
|
|
107344
|
+
const sourcePort = pcbPort?.source_port_id ? ctx.db.source_port?.get(pcbPort.source_port_id) : undefined;
|
|
107345
|
+
const pinHint = platedHole.port_hints?.find((h) => /^pin[A-Za-z0-9_]+$/i.test(h));
|
|
107346
|
+
const gridHint = platedHole.port_hints?.find((h) => /^[A-Za-z]?\d+[A-Za-z0-9_]*$/.test(h));
|
|
107347
|
+
const resolvedPadNumber = sourcePort?.pin_number != null ? String(sourcePort.pin_number) : pinHint ? pinHint.replace(/^pin/i, "") : gridHint ?? String(padNumber);
|
|
107202
107348
|
const pad = createThruHolePadFromCircuitJson({
|
|
107203
107349
|
platedHole,
|
|
107204
107350
|
componentCenter,
|
|
107205
|
-
padNumber,
|
|
107351
|
+
padNumber: resolvedPadNumber,
|
|
107206
107352
|
componentRotation,
|
|
107207
107353
|
netInfo,
|
|
107208
107354
|
componentId
|
|
@@ -107224,8 +107370,8 @@ function createNpthPadFromCircuitJson({
|
|
|
107224
107370
|
}
|
|
107225
107371
|
const relativeX = pcbHole.x - componentCenter.x;
|
|
107226
107372
|
const relativeY = -(pcbHole.y - componentCenter.y);
|
|
107227
|
-
const rotationMatrix = componentRotation !== 0 ?
|
|
107228
|
-
const rotatedPos =
|
|
107373
|
+
const rotationMatrix = componentRotation !== 0 ? rotate7(componentRotation * Math.PI / 180) : identity5();
|
|
107374
|
+
const rotatedPos = applyToPoint14(rotationMatrix, {
|
|
107229
107375
|
x: relativeX,
|
|
107230
107376
|
y: relativeY
|
|
107231
107377
|
});
|
|
@@ -107339,7 +107485,7 @@ var AddFootprintsStage = class extends ConverterStage {
|
|
|
107339
107485
|
const sourceComponent = component.source_component_id ? this.ctx.db.source_component.get(component.source_component_id) : null;
|
|
107340
107486
|
const cadComponent = this.getCadComponentForPcbComponent(component.pcb_component_id);
|
|
107341
107487
|
const footprintName = sourceComponent ? getKicadCompatibleComponentName(sourceComponent, cadComponent) : "Unknown";
|
|
107342
|
-
const transformedPos =
|
|
107488
|
+
const transformedPos = applyToPoint15(c2kMatPcb, {
|
|
107343
107489
|
x: component.center.x,
|
|
107344
107490
|
y: component.center.y
|
|
107345
107491
|
});
|
|
@@ -107356,13 +107502,34 @@ var AddFootprintsStage = class extends ConverterStage {
|
|
|
107356
107502
|
const pcbNoteTexts = this.ctx.db.pcb_note_text?.list().filter((text) => text.pcb_component_id === component.pcb_component_id) || [];
|
|
107357
107503
|
fpTexts.push(...convertNoteTexts(pcbNoteTexts, component.center, component.rotation || 0));
|
|
107358
107504
|
footprint.fpTexts = fpTexts;
|
|
107505
|
+
const pcbSilkscreenPaths = this.ctx.db.pcb_silkscreen_path?.list().filter((path16) => path16.pcb_component_id === component.pcb_component_id) || [];
|
|
107506
|
+
const fpLines = footprint.fpLines ?? [];
|
|
107507
|
+
fpLines.push(...convertSilkscreenPaths(pcbSilkscreenPaths, {
|
|
107508
|
+
componentCenter: component.center,
|
|
107509
|
+
componentRotation: component.rotation || 0
|
|
107510
|
+
}));
|
|
107511
|
+
footprint.fpLines = fpLines;
|
|
107359
107512
|
const fpPads = footprint.fpPads;
|
|
107360
107513
|
const getNetInfo = (pcbPortId) => this.getNetInfoForPcbPort(pcbPortId);
|
|
107361
107514
|
const pcbPads = this.ctx.db.pcb_smtpad?.list().filter((pad) => pad.pcb_component_id === component.pcb_component_id) || [];
|
|
107362
|
-
const { pads: smdPads, nextPadNumber } = convertSmdPads(
|
|
107515
|
+
const { pads: smdPads, nextPadNumber } = convertSmdPads({
|
|
107516
|
+
pcbPads,
|
|
107517
|
+
componentCenter: component.center,
|
|
107518
|
+
componentRotation: component.rotation || 0,
|
|
107519
|
+
componentId: component.pcb_component_id,
|
|
107520
|
+
startPadNumber: 1,
|
|
107521
|
+
getNetInfo
|
|
107522
|
+
}, this.ctx);
|
|
107363
107523
|
fpPads.push(...smdPads);
|
|
107364
107524
|
const pcbPlatedHoles = this.ctx.db.pcb_plated_hole?.list().filter((hole) => hole.pcb_component_id === component.pcb_component_id) || [];
|
|
107365
|
-
const { pads: thruHolePads } = convertPlatedHoles(
|
|
107525
|
+
const { pads: thruHolePads } = convertPlatedHoles({
|
|
107526
|
+
platedHoles: pcbPlatedHoles,
|
|
107527
|
+
componentCenter: component.center,
|
|
107528
|
+
componentRotation: component.rotation || 0,
|
|
107529
|
+
componentId: component.pcb_component_id,
|
|
107530
|
+
startPadNumber: nextPadNumber,
|
|
107531
|
+
getNetInfo
|
|
107532
|
+
}, this.ctx);
|
|
107366
107533
|
fpPads.push(...thruHolePads);
|
|
107367
107534
|
const pcbHoles = this.ctx.db.pcb_hole?.list().filter((hole) => hole.pcb_component_id === component.pcb_component_id) || [];
|
|
107368
107535
|
const npthPads = convertNpthHoles(pcbHoles, component.center, component.rotation || 0);
|
|
@@ -107496,11 +107663,11 @@ var AddTracesStage = class extends ConverterStage {
|
|
|
107496
107663
|
for (let i = 0;i < trace.route.length - 1; i++) {
|
|
107497
107664
|
const startPoint = trace.route[i];
|
|
107498
107665
|
const endPoint = trace.route[i + 1];
|
|
107499
|
-
const transformedStart =
|
|
107666
|
+
const transformedStart = applyToPoint16(c2kMatPcb, {
|
|
107500
107667
|
x: startPoint.x,
|
|
107501
107668
|
y: startPoint.y
|
|
107502
107669
|
});
|
|
107503
|
-
const transformedEnd =
|
|
107670
|
+
const transformedEnd = applyToPoint16(c2kMatPcb, {
|
|
107504
107671
|
x: endPoint.x,
|
|
107505
107672
|
y: endPoint.y
|
|
107506
107673
|
});
|
|
@@ -107623,7 +107790,7 @@ var AddViasStage = class extends ConverterStage {
|
|
|
107623
107790
|
this.finished = true;
|
|
107624
107791
|
return;
|
|
107625
107792
|
}
|
|
107626
|
-
const transformedPos =
|
|
107793
|
+
const transformedPos = applyToPoint17(c2kMatPcb, {
|
|
107627
107794
|
x: via.x,
|
|
107628
107795
|
y: via.y
|
|
107629
107796
|
});
|
|
@@ -107717,7 +107884,7 @@ var AddStandalonePcbElements = class extends ConverterStage {
|
|
|
107717
107884
|
if (elm.type === "pcb_hole") {
|
|
107718
107885
|
const hole = elm;
|
|
107719
107886
|
const footprintSeed = `standalone_hole:${hole.pcb_hole_id}:${hole.x},${hole.y}`;
|
|
107720
|
-
const kicadPos =
|
|
107887
|
+
const kicadPos = applyToPoint18(c2kMatPcb, { x: hole.x, y: hole.y });
|
|
107721
107888
|
const libraryLink = this.getHoleLibraryLink(hole);
|
|
107722
107889
|
const footprint = new Footprint4({
|
|
107723
107890
|
libraryLink,
|
|
@@ -107736,7 +107903,7 @@ var AddStandalonePcbElements = class extends ConverterStage {
|
|
|
107736
107903
|
} else if (elm.type === "pcb_plated_hole") {
|
|
107737
107904
|
const hole = elm;
|
|
107738
107905
|
const footprintSeed = `standalone_plated_hole:${hole.pcb_plated_hole_id}:${hole.x},${hole.y}`;
|
|
107739
|
-
const kicadPos =
|
|
107906
|
+
const kicadPos = applyToPoint18(c2kMatPcb, { x: hole.x, y: hole.y });
|
|
107740
107907
|
const libraryLink = this.getPlatedHoleLibraryLink(hole);
|
|
107741
107908
|
const footprint = new Footprint4({
|
|
107742
107909
|
libraryLink,
|
|
@@ -107787,7 +107954,19 @@ var AddStandalonePcbElements = class extends ConverterStage {
|
|
|
107787
107954
|
}
|
|
107788
107955
|
if (shape === "circular_hole_with_rect_pad") {
|
|
107789
107956
|
const h = hole;
|
|
107790
|
-
|
|
107957
|
+
let link = `tscircuit:platedhole_${shape}_holeDiameter${h.hole_diameter}mm_rectPadWidth${h.rect_pad_width}mm_rectPadHeight${h.rect_pad_height}mm`;
|
|
107958
|
+
if (h.rect_ccw_rotation) {
|
|
107959
|
+
link += `_ccwRotation${h.rect_ccw_rotation}deg`;
|
|
107960
|
+
}
|
|
107961
|
+
return link;
|
|
107962
|
+
}
|
|
107963
|
+
if (shape === "rotated_pill_hole_with_rect_pad") {
|
|
107964
|
+
const h = hole;
|
|
107965
|
+
let link = `tscircuit:platedhole_${shape}_holeWidth${h.hole_width}mm_holeHeight${h.hole_height}mm_rectPadWidth${h.rect_pad_width}mm_rectPadHeight${h.rect_pad_height}mm`;
|
|
107966
|
+
if (h.rect_ccw_rotation) {
|
|
107967
|
+
link += `_ccwRotation${h.rect_ccw_rotation}deg`;
|
|
107968
|
+
}
|
|
107969
|
+
return link;
|
|
107791
107970
|
}
|
|
107792
107971
|
return "tscircuit:platedhole";
|
|
107793
107972
|
}
|
|
@@ -107802,7 +107981,7 @@ function createFabricationNoteTextFromCircuitJson({
|
|
|
107802
107981
|
if (!textElement.text || !textElement.anchor_position) {
|
|
107803
107982
|
return null;
|
|
107804
107983
|
}
|
|
107805
|
-
const transformedPos =
|
|
107984
|
+
const transformedPos = applyToPoint19(c2kMatPcb, {
|
|
107806
107985
|
x: textElement.anchor_position.x,
|
|
107807
107986
|
y: textElement.anchor_position.y
|
|
107808
107987
|
});
|
|
@@ -107858,7 +108037,7 @@ function createGrTextFromCircuitJson({
|
|
|
107858
108037
|
if (!textElement.text || !textElement.anchor_position) {
|
|
107859
108038
|
return null;
|
|
107860
108039
|
}
|
|
107861
|
-
const transformedPos =
|
|
108040
|
+
const transformedPos = applyToPoint20(c2kMatPcb, {
|
|
107862
108041
|
x: textElement.anchor_position.x,
|
|
107863
108042
|
y: textElement.anchor_position.y
|
|
107864
108043
|
});
|
|
@@ -107908,6 +108087,20 @@ function createGrTextFromCircuitJson({
|
|
|
107908
108087
|
grText.position = position;
|
|
107909
108088
|
return grText;
|
|
107910
108089
|
}
|
|
108090
|
+
var pointsAreEqual = (a, b) => !!a && !!b && a.x === b.x && a.y === b.y;
|
|
108091
|
+
var normalizeOutlineCorners = (corners) => {
|
|
108092
|
+
const dedupedCorners = [];
|
|
108093
|
+
for (const corner of corners) {
|
|
108094
|
+
const previousCorner = dedupedCorners[dedupedCorners.length - 1];
|
|
108095
|
+
if (pointsAreEqual(previousCorner, corner))
|
|
108096
|
+
continue;
|
|
108097
|
+
dedupedCorners.push(corner);
|
|
108098
|
+
}
|
|
108099
|
+
while (dedupedCorners.length > 1 && pointsAreEqual(dedupedCorners[0], dedupedCorners[dedupedCorners.length - 1])) {
|
|
108100
|
+
dedupedCorners.pop();
|
|
108101
|
+
}
|
|
108102
|
+
return dedupedCorners;
|
|
108103
|
+
};
|
|
107911
108104
|
var AddGraphicsStage = class extends ConverterStage {
|
|
107912
108105
|
_step() {
|
|
107913
108106
|
const { kicadPcb, c2kMatPcb } = this.ctx;
|
|
@@ -107917,7 +108110,7 @@ var AddGraphicsStage = class extends ConverterStage {
|
|
|
107917
108110
|
if (!c2kMatPcb) {
|
|
107918
108111
|
throw new Error("PCB transformation matrix not initialized in context");
|
|
107919
108112
|
}
|
|
107920
|
-
const pcbSilkscreenPaths = this.ctx.db.pcb_silkscreen_path?.list() || [];
|
|
108113
|
+
const pcbSilkscreenPaths = this.ctx.db.pcb_silkscreen_path?.list().filter((path16) => !path16.pcb_component_id) || [];
|
|
107921
108114
|
for (const path16 of pcbSilkscreenPaths) {
|
|
107922
108115
|
if (!path16.route || path16.route.length < 2)
|
|
107923
108116
|
continue;
|
|
@@ -107926,11 +108119,11 @@ var AddGraphicsStage = class extends ConverterStage {
|
|
|
107926
108119
|
const endPoint = path16.route[i + 1];
|
|
107927
108120
|
if (!startPoint || !endPoint)
|
|
107928
108121
|
continue;
|
|
107929
|
-
const transformedStart =
|
|
108122
|
+
const transformedStart = applyToPoint21(c2kMatPcb, {
|
|
107930
108123
|
x: startPoint.x,
|
|
107931
108124
|
y: startPoint.y
|
|
107932
108125
|
});
|
|
107933
|
-
const transformedEnd =
|
|
108126
|
+
const transformedEnd = applyToPoint21(c2kMatPcb, {
|
|
107934
108127
|
x: endPoint.x,
|
|
107935
108128
|
y: endPoint.y
|
|
107936
108129
|
});
|
|
@@ -107983,7 +108176,7 @@ var AddGraphicsStage = class extends ConverterStage {
|
|
|
107983
108176
|
}
|
|
107984
108177
|
let corners;
|
|
107985
108178
|
if (board.outline && board.outline.length > 0) {
|
|
107986
|
-
corners = board.outline;
|
|
108179
|
+
corners = normalizeOutlineCorners(board.outline);
|
|
107987
108180
|
} else {
|
|
107988
108181
|
const halfWidth = board.width ? board.width / 2 : 0;
|
|
107989
108182
|
const halfHeight = board.height ? board.height / 2 : 0;
|
|
@@ -107994,12 +108187,18 @@ var AddGraphicsStage = class extends ConverterStage {
|
|
|
107994
108187
|
{ x: board.center.x - halfWidth, y: board.center.y + halfHeight }
|
|
107995
108188
|
];
|
|
107996
108189
|
}
|
|
107997
|
-
const transformedCorners = corners.map((corner) =>
|
|
108190
|
+
const transformedCorners = corners.map((corner) => applyToPoint21(c2kMatPcb, corner));
|
|
108191
|
+
if (transformedCorners.length < 2) {
|
|
108192
|
+
this.finished = true;
|
|
108193
|
+
return;
|
|
108194
|
+
}
|
|
107998
108195
|
for (let i = 0;i < transformedCorners.length; i++) {
|
|
107999
108196
|
const start = transformedCorners[i];
|
|
108000
108197
|
const end = transformedCorners[(i + 1) % transformedCorners.length];
|
|
108001
108198
|
if (!start || !end)
|
|
108002
108199
|
continue;
|
|
108200
|
+
if (pointsAreEqual(start, end))
|
|
108201
|
+
continue;
|
|
108003
108202
|
const edgeLine = new GrLine({
|
|
108004
108203
|
start: { x: start.x, y: start.y },
|
|
108005
108204
|
end: { x: end.x, y: end.y },
|
|
@@ -201860,7 +202059,7 @@ function rectanglePolygon({
|
|
|
201860
202059
|
if (rotationDeg) {
|
|
201861
202060
|
const matrix2 = rotateDEG(rotationDeg, cx2, cy2);
|
|
201862
202061
|
const rotatedCorners = corners.map((pt3) => {
|
|
201863
|
-
const p3 =
|
|
202062
|
+
const p3 = applyToPoint22(matrix2, { x: pt3.x, y: pt3.y });
|
|
201864
202063
|
return new Point$3(p3.x, p3.y);
|
|
201865
202064
|
});
|
|
201866
202065
|
poly = new Polygon$1(rotatedCorners);
|
|
@@ -201925,7 +202124,7 @@ function computeOverlapDistance(compPoly, boardPoly, componentCenter, componentW
|
|
|
201925
202124
|
}
|
|
201926
202125
|
const matrix2 = rotateDEG(rotationDeg, componentCenter.x, componentCenter.y);
|
|
201927
202126
|
const rotatePoint3 = (pt3) => {
|
|
201928
|
-
const p3 =
|
|
202127
|
+
const p3 = applyToPoint22(matrix2, pt3);
|
|
201929
202128
|
return new Point$3(p3.x, p3.y);
|
|
201930
202129
|
};
|
|
201931
202130
|
const rotatedPoints = corners.concat(midpoints).map(rotatePoint3);
|
|
@@ -220061,25 +220260,25 @@ var PrimitiveComponent2 = class extends Renderable {
|
|
|
220061
220260
|
computePcbPropsTransform() {
|
|
220062
220261
|
const rotation4 = this._getPcbRotationBeforeLayout() ?? 0;
|
|
220063
220262
|
const { pcbX, pcbY } = this.getResolvedPcbPositionProp();
|
|
220064
|
-
const matrix2 = compose6(translate6(pcbX, pcbY),
|
|
220263
|
+
const matrix2 = compose6(translate6(pcbX, pcbY), rotate8(rotation4 * Math.PI / 180));
|
|
220065
220264
|
return matrix2;
|
|
220066
220265
|
}
|
|
220067
220266
|
_computePcbGlobalTransformBeforeLayout() {
|
|
220068
220267
|
const manualPlacement = this.getSubcircuit()._getPcbManualPlacementForComponent(this);
|
|
220069
220268
|
if (manualPlacement && this.props.pcbX === undefined && this.props.pcbY === undefined) {
|
|
220070
220269
|
const rotation4 = this._getPcbRotationBeforeLayout() ?? 0;
|
|
220071
|
-
return compose6(this.parent?._computePcbGlobalTransformBeforeLayout() ??
|
|
220270
|
+
return compose6(this.parent?._computePcbGlobalTransformBeforeLayout() ?? identity6(), compose6(translate6(manualPlacement.x, manualPlacement.y), rotate8(rotation4 * Math.PI / 180)));
|
|
220072
220271
|
}
|
|
220073
220272
|
if (this.isPcbPrimitive) {
|
|
220074
220273
|
const primitiveContainer = this.getPrimitiveContainer();
|
|
220075
220274
|
if (primitiveContainer) {
|
|
220076
220275
|
const isFlipped = primitiveContainer._parsedProps.layer === "bottom";
|
|
220077
220276
|
if (isFlipped) {
|
|
220078
|
-
return compose6(this.parent?._computePcbGlobalTransformBeforeLayout() ??
|
|
220277
|
+
return compose6(this.parent?._computePcbGlobalTransformBeforeLayout() ?? identity6(), flipY(), this.computePcbPropsTransform());
|
|
220079
220278
|
}
|
|
220080
220279
|
}
|
|
220081
220280
|
}
|
|
220082
|
-
return compose6(this.parent?._computePcbGlobalTransformBeforeLayout() ??
|
|
220281
|
+
return compose6(this.parent?._computePcbGlobalTransformBeforeLayout() ?? identity6(), this.computePcbPropsTransform());
|
|
220083
220282
|
}
|
|
220084
220283
|
getPrimitiveContainer() {
|
|
220085
220284
|
if (this.isPrimitiveContainer)
|
|
@@ -220146,7 +220345,7 @@ var PrimitiveComponent2 = class extends Renderable {
|
|
|
220146
220345
|
const manualPlacementTransform = this._getSchematicGlobalManualPlacementTransform(this);
|
|
220147
220346
|
if (manualPlacementTransform)
|
|
220148
220347
|
return manualPlacementTransform;
|
|
220149
|
-
return compose6(this.parent?.computeSchematicGlobalTransform?.() ??
|
|
220348
|
+
return compose6(this.parent?.computeSchematicGlobalTransform?.() ?? identity6(), this.computeSchematicPropsTransform());
|
|
220150
220349
|
}
|
|
220151
220350
|
_getSchematicSymbolName() {
|
|
220152
220351
|
const { _parsedProps: props } = this;
|
|
@@ -220232,7 +220431,7 @@ var PrimitiveComponent2 = class extends Renderable {
|
|
|
220232
220431
|
return null;
|
|
220233
220432
|
for (const position2 of placementConfigPositions) {
|
|
220234
220433
|
if (isMatchingSelector(component, position2.selector) || component.props.name === position2.selector) {
|
|
220235
|
-
const center2 =
|
|
220434
|
+
const center2 = applyToPoint22(this._computePcbGlobalTransformBeforeLayout(), position2.center);
|
|
220236
220435
|
return center2;
|
|
220237
220436
|
}
|
|
220238
220437
|
}
|
|
@@ -220249,7 +220448,7 @@ var PrimitiveComponent2 = class extends Renderable {
|
|
|
220249
220448
|
return null;
|
|
220250
220449
|
for (const position2 of placementConfigPositions) {
|
|
220251
220450
|
if (isMatchingSelector(component, position2.selector) || component.props.name === position2.selector) {
|
|
220252
|
-
const center2 =
|
|
220451
|
+
const center2 = applyToPoint22(this.computeSchematicGlobalTransform(), position2.center);
|
|
220253
220452
|
return center2;
|
|
220254
220453
|
}
|
|
220255
220454
|
}
|
|
@@ -220262,20 +220461,20 @@ var PrimitiveComponent2 = class extends Renderable {
|
|
|
220262
220461
|
for (const position2 of manualEdits.schematic_placements ?? []) {
|
|
220263
220462
|
if (isMatchingSelector(component, position2.selector) || component.props.name === position2.selector) {
|
|
220264
220463
|
if (position2.relative_to === "group_center") {
|
|
220265
|
-
return compose6(this.parent?._computePcbGlobalTransformBeforeLayout() ??
|
|
220464
|
+
return compose6(this.parent?._computePcbGlobalTransformBeforeLayout() ?? identity6(), translate6(position2.center.x, position2.center.y));
|
|
220266
220465
|
}
|
|
220267
220466
|
}
|
|
220268
220467
|
}
|
|
220269
220468
|
return null;
|
|
220270
220469
|
}
|
|
220271
220470
|
_getGlobalPcbPositionBeforeLayout() {
|
|
220272
|
-
return
|
|
220471
|
+
return applyToPoint22(this._computePcbGlobalTransformBeforeLayout(), {
|
|
220273
220472
|
x: 0,
|
|
220274
220473
|
y: 0
|
|
220275
220474
|
});
|
|
220276
220475
|
}
|
|
220277
220476
|
_getGlobalSchematicPositionBeforeLayout() {
|
|
220278
|
-
return
|
|
220477
|
+
return applyToPoint22(this.computeSchematicGlobalTransform(), { x: 0, y: 0 });
|
|
220279
220478
|
}
|
|
220280
220479
|
_getBoard() {
|
|
220281
220480
|
let current2 = this;
|
|
@@ -222718,7 +222917,7 @@ function Trace_doInitialPcbManualTraceRender(trace) {
|
|
|
222718
222917
|
layer: currentLayer,
|
|
222719
222918
|
start_pcb_port_id: anchorPort.pcb_port_id
|
|
222720
222919
|
});
|
|
222721
|
-
const transform2 = subcircuit._isInflatedFromCircuitJson ? trace._computePcbGlobalTransformBeforeLayout() : anchorPort?._computePcbGlobalTransformBeforeLayout?.() ||
|
|
222920
|
+
const transform2 = subcircuit._isInflatedFromCircuitJson ? trace._computePcbGlobalTransformBeforeLayout() : anchorPort?._computePcbGlobalTransformBeforeLayout?.() || identity6();
|
|
222722
222921
|
const pcbPath2 = props.pcbPath;
|
|
222723
222922
|
for (const pt3 of pcbPath2) {
|
|
222724
222923
|
let coordinates;
|
|
@@ -222752,7 +222951,7 @@ function Trace_doInitialPcbManualTraceRender(trace) {
|
|
|
222752
222951
|
viaToLayer = pt3.toLayer;
|
|
222753
222952
|
}
|
|
222754
222953
|
}
|
|
222755
|
-
const finalCoordinates = isGlobalPosition ? coordinates :
|
|
222954
|
+
const finalCoordinates = isGlobalPosition ? coordinates : applyToPoint22(transform2, coordinates);
|
|
222756
222955
|
if (isViaPoint) {
|
|
222757
222956
|
route.push({
|
|
222758
222957
|
route_type: "via",
|
|
@@ -223411,7 +223610,7 @@ var createInstanceFromReactElement = (reactElm) => {
|
|
|
223411
223610
|
this.children.push(instance);
|
|
223412
223611
|
},
|
|
223413
223612
|
computePcbGlobalTransform() {
|
|
223414
|
-
return
|
|
223613
|
+
return identity6();
|
|
223415
223614
|
}
|
|
223416
223615
|
};
|
|
223417
223616
|
const containerErrors = [];
|
|
@@ -223587,7 +223786,7 @@ var CourtyardOutline = class extends PrimitiveComponent2 {
|
|
|
223587
223786
|
pcb_component_id,
|
|
223588
223787
|
layer,
|
|
223589
223788
|
outline: props.outline.map((p3) => {
|
|
223590
|
-
const transformedPosition =
|
|
223789
|
+
const transformedPosition = applyToPoint22(transform2, {
|
|
223591
223790
|
x: p3.x,
|
|
223592
223791
|
y: p3.y
|
|
223593
223792
|
});
|
|
@@ -223764,7 +223963,7 @@ var Cutout = class extends PrimitiveComponent2 {
|
|
|
223764
223963
|
inserted_pcb_cutout = db.pcb_cutout.insert(circleData);
|
|
223765
223964
|
} else if (props.shape === "polygon") {
|
|
223766
223965
|
const transform2 = this._computePcbGlobalTransformBeforeLayout();
|
|
223767
|
-
const transformedPoints = props.points.map((p3) =>
|
|
223966
|
+
const transformedPoints = props.points.map((p3) => applyToPoint22(transform2, p3));
|
|
223768
223967
|
const polygonData = {
|
|
223769
223968
|
shape: "polygon",
|
|
223770
223969
|
points: transformedPoints,
|
|
@@ -223925,7 +224124,7 @@ var FabricationNotePath = class extends PrimitiveComponent2 {
|
|
|
223925
224124
|
layer,
|
|
223926
224125
|
color: props.color,
|
|
223927
224126
|
route: props.route.map((p3) => {
|
|
223928
|
-
const transformedPosition =
|
|
224127
|
+
const transformedPosition = applyToPoint22(transform2, {
|
|
223929
224128
|
x: p3.x,
|
|
223930
224129
|
y: p3.y
|
|
223931
224130
|
});
|
|
@@ -224418,8 +224617,8 @@ var PcbNoteLine = class extends PrimitiveComponent2 {
|
|
|
224418
224617
|
const subcircuit = this.getSubcircuit();
|
|
224419
224618
|
const group = this.getGroup();
|
|
224420
224619
|
const transform2 = this._computePcbGlobalTransformBeforeLayout();
|
|
224421
|
-
const start =
|
|
224422
|
-
const end =
|
|
224620
|
+
const start = applyToPoint22(transform2, { x: props.x1, y: props.y1 });
|
|
224621
|
+
const end = applyToPoint22(transform2, { x: props.x2, y: props.y2 });
|
|
224423
224622
|
const pcb_component_id = this.parent?.pcb_component_id ?? this.getPrimitiveContainer()?.pcb_component_id ?? undefined;
|
|
224424
224623
|
const pcb_note_line2 = db.pcb_note_line.insert({
|
|
224425
224624
|
pcb_component_id,
|
|
@@ -224484,7 +224683,7 @@ var PcbNotePath = class extends PrimitiveComponent2 {
|
|
|
224484
224683
|
const { x: x3, y: y32, ...rest } = point6;
|
|
224485
224684
|
const numericX = typeof x3 === "string" ? parseFloat(x3) : x3;
|
|
224486
224685
|
const numericY = typeof y32 === "string" ? parseFloat(y32) : y32;
|
|
224487
|
-
const transformed =
|
|
224686
|
+
const transformed = applyToPoint22(transform2, { x: numericX, y: numericY });
|
|
224488
224687
|
return { ...rest, x: transformed.x, y: transformed.y };
|
|
224489
224688
|
});
|
|
224490
224689
|
const pcb_note_path2 = db.pcb_note_path.insert({
|
|
@@ -224545,7 +224744,7 @@ var PcbNoteRect = class extends PrimitiveComponent2 {
|
|
|
224545
224744
|
const { db } = this.root;
|
|
224546
224745
|
const { _parsedProps: props } = this;
|
|
224547
224746
|
const transform2 = this._computePcbGlobalTransformBeforeLayout();
|
|
224548
|
-
const center2 =
|
|
224747
|
+
const center2 = applyToPoint22(transform2, { x: 0, y: 0 });
|
|
224549
224748
|
const subcircuit = this.getSubcircuit();
|
|
224550
224749
|
const group = this.getGroup();
|
|
224551
224750
|
const pcb_component_id = this.parent?.pcb_component_id ?? this.getPrimitiveContainer()?.pcb_component_id ?? undefined;
|
|
@@ -224606,7 +224805,7 @@ var PcbNoteText = class extends PrimitiveComponent2 {
|
|
|
224606
224805
|
const { db } = this.root;
|
|
224607
224806
|
const { _parsedProps: props } = this;
|
|
224608
224807
|
const transform2 = this._computePcbGlobalTransformBeforeLayout();
|
|
224609
|
-
const anchorPosition =
|
|
224808
|
+
const anchorPosition = applyToPoint22(transform2, { x: 0, y: 0 });
|
|
224610
224809
|
const subcircuit = this.getSubcircuit();
|
|
224611
224810
|
const group = this.getGroup();
|
|
224612
224811
|
const pcb_component_id = this.parent?.pcb_component_id ?? this.getPrimitiveContainer()?.pcb_component_id ?? undefined;
|
|
@@ -224675,7 +224874,7 @@ var PcbTrace = class extends PrimitiveComponent2 {
|
|
|
224675
224874
|
const parentTransform = this._computePcbGlobalTransformBeforeLayout();
|
|
224676
224875
|
const transformedRoute = props.route.map((point6) => {
|
|
224677
224876
|
const { x: x3, y: y32, ...restOfPoint } = point6;
|
|
224678
|
-
const transformedPoint =
|
|
224877
|
+
const transformedPoint = applyToPoint22(parentTransform, { x: x3, y: y32 });
|
|
224679
224878
|
if (point6.route_type === "wire" && point6.layer) {
|
|
224680
224879
|
return {
|
|
224681
224880
|
...transformedPoint,
|
|
@@ -225102,8 +225301,8 @@ var SilkscreenLine = class extends PrimitiveComponent2 {
|
|
|
225102
225301
|
}
|
|
225103
225302
|
const subcircuit = this.getSubcircuit();
|
|
225104
225303
|
const transform2 = this._computePcbGlobalTransformBeforeLayout();
|
|
225105
|
-
const p12 =
|
|
225106
|
-
const p222 =
|
|
225304
|
+
const p12 = applyToPoint22(transform2, { x: props.x1, y: props.y1 });
|
|
225305
|
+
const p222 = applyToPoint22(transform2, { x: props.x2, y: props.y2 });
|
|
225107
225306
|
const pcb_component_id = this.parent?.pcb_component_id ?? this.getPrimitiveContainer()?.pcb_component_id;
|
|
225108
225307
|
const pcb_silkscreen_line2 = db.pcb_silkscreen_line.insert({
|
|
225109
225308
|
pcb_component_id,
|
|
@@ -225170,7 +225369,7 @@ var SilkscreenPath = class extends PrimitiveComponent2 {
|
|
|
225170
225369
|
pcb_component_id,
|
|
225171
225370
|
layer,
|
|
225172
225371
|
route: props.route.map((p3) => {
|
|
225173
|
-
const transformedPosition =
|
|
225372
|
+
const transformedPosition = applyToPoint22(transform2, {
|
|
225174
225373
|
x: p3.x,
|
|
225175
225374
|
y: p3.y
|
|
225176
225375
|
});
|
|
@@ -225380,7 +225579,7 @@ var SilkscreenText = class extends PrimitiveComponent2 {
|
|
|
225380
225579
|
});
|
|
225381
225580
|
const fontSize = props.fontSize ?? resolvedPcbSxFontSize ?? this.getInheritedProperty("pcbStyle")?.silkscreenFontSize ?? this._footprinterFontSize ?? 1;
|
|
225382
225581
|
const hasResolvedPcbSxPosition = resolvedPcbSxPcbX !== undefined || resolvedPcbSxPcbY !== undefined;
|
|
225383
|
-
const position2 = hasResolvedPcbSxPosition && this._footprinterFontSize !== undefined ?
|
|
225582
|
+
const position2 = hasResolvedPcbSxPosition && this._footprinterFontSize !== undefined ? applyToPoint22(compose6(this.parent?._computePcbGlobalTransformBeforeLayout() ?? identity6(), isFlipped ? flipY() : identity6()), {
|
|
225384
225583
|
x: this.resolvePcbCoordinate({
|
|
225385
225584
|
rawValue: resolvedPcbSxPcbX ?? props.pcbX ?? 0,
|
|
225386
225585
|
axis: "pcbX"
|
|
@@ -225666,7 +225865,7 @@ var SmtPad = class extends PrimitiveComponent2 {
|
|
|
225666
225865
|
});
|
|
225667
225866
|
} else if (props.shape === "polygon") {
|
|
225668
225867
|
const transformedPoints = props.points.map((point6) => {
|
|
225669
|
-
const transformed =
|
|
225868
|
+
const transformed = applyToPoint22(globalTransform, {
|
|
225670
225869
|
x: distance.parse(point6.x),
|
|
225671
225870
|
y: distance.parse(point6.y)
|
|
225672
225871
|
});
|
|
@@ -226513,7 +226712,7 @@ var Port = class extends PrimitiveComponent2 {
|
|
|
226513
226712
|
}
|
|
226514
226713
|
}
|
|
226515
226714
|
const transform2 = compose6(parentNormalComponent.computeSchematicGlobalTransform(), translate6(-symbol.center.x, -symbol.center.y));
|
|
226516
|
-
return
|
|
226715
|
+
return applyToPoint22(transform2, schematicSymbolPortDef);
|
|
226517
226716
|
}
|
|
226518
226717
|
const parentBoxDim = parentNormalComponent?._getSchematicBoxDimensions();
|
|
226519
226718
|
if (parentBoxDim && this.props.pinNumber !== undefined) {
|
|
@@ -226521,7 +226720,7 @@ var Port = class extends PrimitiveComponent2 {
|
|
|
226521
226720
|
if (!localPortPosition) {
|
|
226522
226721
|
throw new Error(`Couldn't find position for schematic_port for port ${this.getString()} inside of the schematic box`);
|
|
226523
226722
|
}
|
|
226524
|
-
return
|
|
226723
|
+
return applyToPoint22(parentNormalComponent.computeSchematicGlobalTransform(), localPortPosition);
|
|
226525
226724
|
}
|
|
226526
226725
|
throw new Error(`Couldn't find position for schematic_port for port ${this.getString()}`);
|
|
226527
226726
|
}
|
|
@@ -226883,15 +227082,15 @@ var Port = class extends PrimitiveComponent2 {
|
|
|
226883
227082
|
const { db } = this.root;
|
|
226884
227083
|
const schPort = db.schematic_port.get(this.schematic_port_id);
|
|
226885
227084
|
if (schPort) {
|
|
226886
|
-
const newCenter =
|
|
227085
|
+
const newCenter = applyToPoint22(transform2, schPort.center);
|
|
226887
227086
|
db.schematic_port.update(this.schematic_port_id, {
|
|
226888
227087
|
center: newCenter
|
|
226889
227088
|
});
|
|
226890
227089
|
if (this.schematic_stem_line_id) {
|
|
226891
227090
|
const line2 = db.schematic_line.get(this.schematic_stem_line_id);
|
|
226892
227091
|
if (line2) {
|
|
226893
|
-
const p12 =
|
|
226894
|
-
const p222 =
|
|
227092
|
+
const p12 = applyToPoint22(transform2, { x: line2.x1, y: line2.y1 });
|
|
227093
|
+
const p222 = applyToPoint22(transform2, { x: line2.x2, y: line2.y2 });
|
|
226895
227094
|
db.schematic_line.update(this.schematic_stem_line_id, {
|
|
226896
227095
|
x1: p12.x,
|
|
226897
227096
|
y1: p12.y,
|
|
@@ -229428,7 +229627,7 @@ var extractPcbPrimitivesFromCircuitJson = ({
|
|
|
229428
229627
|
}) => {
|
|
229429
229628
|
const componentCenter = pcbComponent.center || { x: 0, y: 0 };
|
|
229430
229629
|
const componentRotation = pcbComponent.rotation || 0;
|
|
229431
|
-
const absoluteToComponentRelativeTransform = inverse(compose6(translate6(componentCenter.x, componentCenter.y),
|
|
229630
|
+
const absoluteToComponentRelativeTransform = inverse(compose6(translate6(componentCenter.x, componentCenter.y), rotate8(componentRotation * Math.PI / 180)));
|
|
229432
229631
|
const relativeElements = db.toArray().filter((elm) => ("pcb_component_id" in elm) && elm.pcb_component_id === pcbComponent.pcb_component_id);
|
|
229433
229632
|
const clonedRelativeElements = structuredClone(relativeElements);
|
|
229434
229633
|
transformPCBElements(clonedRelativeElements, absoluteToComponentRelativeTransform);
|
|
@@ -230454,7 +230653,7 @@ var TraceHint = class extends PrimitiveComponent2 {
|
|
|
230454
230653
|
return [];
|
|
230455
230654
|
const globalTransform = this._computePcbGlobalTransformBeforeLayout();
|
|
230456
230655
|
return offsets.map((offset) => ({
|
|
230457
|
-
...
|
|
230656
|
+
...applyToPoint22(globalTransform, offset),
|
|
230458
230657
|
via: offset.via,
|
|
230459
230658
|
to_layer: offset.to_layer,
|
|
230460
230659
|
trace_width: offset.trace_width
|
|
@@ -231456,7 +231655,7 @@ var applyPackOutput = (group, packOutput, clusterMap) => {
|
|
|
231456
231655
|
if (!member)
|
|
231457
231656
|
continue;
|
|
231458
231657
|
const originalCenter2 = member.center;
|
|
231459
|
-
const transformMatrix2 = compose6(group._computePcbGlobalTransformBeforeLayout(), translate6(center2.x + rotatedRel.x, center2.y + rotatedRel.y),
|
|
231658
|
+
const transformMatrix2 = compose6(group._computePcbGlobalTransformBeforeLayout(), translate6(center2.x + rotatedRel.x, center2.y + rotatedRel.y), rotate8(angleRad), translate6(-originalCenter2.x, -originalCenter2.y));
|
|
231460
231659
|
const related = db.toArray().filter((elm) => ("pcb_component_id" in elm) && elm.pcb_component_id === memberId);
|
|
231461
231660
|
transformPCBElements(related, transformMatrix2);
|
|
231462
231661
|
updateCadRotation({
|
|
@@ -231481,7 +231680,7 @@ var applyPackOutput = (group, packOutput, clusterMap) => {
|
|
|
231481
231680
|
}
|
|
231482
231681
|
const originalCenter2 = pcbComponent.center;
|
|
231483
231682
|
const rotationDegrees2 = ccwRotationDegrees ?? ccwRotationOffset ?? 0;
|
|
231484
|
-
const transformMatrix2 = compose6(group._computePcbGlobalTransformBeforeLayout(), translate6(center2.x, center2.y),
|
|
231683
|
+
const transformMatrix2 = compose6(group._computePcbGlobalTransformBeforeLayout(), translate6(center2.x, center2.y), rotate8(rotationDegrees2 * Math.PI / 180), translate6(-originalCenter2.x, -originalCenter2.y));
|
|
231485
231684
|
const related = db.toArray().filter((elm) => ("pcb_component_id" in elm) && elm.pcb_component_id === componentId);
|
|
231486
231685
|
transformPCBElements(related, transformMatrix2);
|
|
231487
231686
|
updateCadRotation({
|
|
@@ -231497,7 +231696,7 @@ var applyPackOutput = (group, packOutput, clusterMap) => {
|
|
|
231497
231696
|
continue;
|
|
231498
231697
|
const originalCenter = pcbGroup.center;
|
|
231499
231698
|
const rotationDegrees = ccwRotationDegrees ?? ccwRotationOffset ?? 0;
|
|
231500
|
-
const transformMatrix = compose6(group._computePcbGlobalTransformBeforeLayout(), translate6(center2.x, center2.y),
|
|
231699
|
+
const transformMatrix = compose6(group._computePcbGlobalTransformBeforeLayout(), translate6(center2.x, center2.y), rotate8(rotationDegrees * Math.PI / 180), translate6(-originalCenter.x, -originalCenter.y));
|
|
231501
231700
|
const relatedElements = db.toArray().filter((elm) => {
|
|
231502
231701
|
if ("source_group_id" in elm && elm.source_group_id) {
|
|
231503
231702
|
if (elm.source_group_id === componentId) {
|
|
@@ -235733,10 +235932,10 @@ var IsolatedCircuit = class {
|
|
|
235733
235932
|
throw new Error("project.preview is not yet implemented");
|
|
235734
235933
|
}
|
|
235735
235934
|
computeSchematicGlobalTransform() {
|
|
235736
|
-
return
|
|
235935
|
+
return identity6();
|
|
235737
235936
|
}
|
|
235738
235937
|
_computePcbGlobalTransformBeforeLayout() {
|
|
235739
|
-
return
|
|
235938
|
+
return identity6();
|
|
235740
235939
|
}
|
|
235741
235940
|
selectAll(selector) {
|
|
235742
235941
|
this._guessRootComponent();
|
|
@@ -236898,7 +237097,7 @@ var Subpanel = class _Subpanel extends Group6 {
|
|
|
236898
237097
|
_panelPositionOffset = null;
|
|
236899
237098
|
_computePcbGlobalTransformBeforeLayout() {
|
|
236900
237099
|
if (this._panelPositionOffset) {
|
|
236901
|
-
const parentTransform = this.parent?._computePcbGlobalTransformBeforeLayout?.() ??
|
|
237100
|
+
const parentTransform = this.parent?._computePcbGlobalTransformBeforeLayout?.() ?? identity6();
|
|
236902
237101
|
return compose6(parentTransform, translate6(this._panelPositionOffset.x, this._panelPositionOffset.y));
|
|
236903
237102
|
}
|
|
236904
237103
|
return super._computePcbGlobalTransformBeforeLayout();
|
|
@@ -237898,13 +238097,13 @@ var FabricationNoteDimension = class extends PrimitiveComponent2 {
|
|
|
237898
238097
|
const target = this.getSubcircuit().selectOne(input);
|
|
237899
238098
|
if (!target) {
|
|
237900
238099
|
this.renderError(`FabricationNoteDimension could not find selector "${input}"`);
|
|
237901
|
-
return
|
|
238100
|
+
return applyToPoint22(transform2, { x: 0, y: 0 });
|
|
237902
238101
|
}
|
|
237903
238102
|
return target._getGlobalPcbPositionBeforeLayout();
|
|
237904
238103
|
}
|
|
237905
238104
|
const numericX = typeof input.x === "string" ? parseFloat(input.x) : input.x;
|
|
237906
238105
|
const numericY = typeof input.y === "string" ? parseFloat(input.y) : input.y;
|
|
237907
|
-
return
|
|
238106
|
+
return applyToPoint22(transform2, { x: numericX, y: numericY });
|
|
237908
238107
|
}
|
|
237909
238108
|
doInitialPcbPrimitiveRender() {
|
|
237910
238109
|
if (this.root?.pcbDisabled)
|
|
@@ -238004,7 +238203,7 @@ var PcbNoteDimension = class extends PrimitiveComponent2 {
|
|
|
238004
238203
|
const target = this.getSubcircuit().selectOne(`.${input}`);
|
|
238005
238204
|
if (!target) {
|
|
238006
238205
|
this.renderError(`PcbNoteDimension could not find selector "${input}"`);
|
|
238007
|
-
return
|
|
238206
|
+
return applyToPoint22(transform2, { x: 0, y: 0 });
|
|
238008
238207
|
}
|
|
238009
238208
|
const targetPcbComponentId = target.pcb_component_id;
|
|
238010
238209
|
const root = this.root;
|
|
@@ -238021,7 +238220,7 @@ var PcbNoteDimension = class extends PrimitiveComponent2 {
|
|
|
238021
238220
|
}
|
|
238022
238221
|
const numericX = typeof input.x === "string" ? parseFloat(input.x) : input.x;
|
|
238023
238222
|
const numericY = typeof input.y === "string" ? parseFloat(input.y) : input.y;
|
|
238024
|
-
return
|
|
238223
|
+
return applyToPoint22(transform2, { x: numericX, y: numericY });
|
|
238025
238224
|
}
|
|
238026
238225
|
doInitialPcbPrimitiveRender() {
|
|
238027
238226
|
if (this.root?.pcbDisabled)
|
|
@@ -238300,7 +238499,7 @@ var NetLabel = class extends PrimitiveComponent2 {
|
|
|
238300
238499
|
const connectedPorts = this._getConnectedPorts();
|
|
238301
238500
|
if (connectedPorts.length > 0) {
|
|
238302
238501
|
const portPos = connectedPorts[0]._getGlobalSchematicPositionBeforeLayout();
|
|
238303
|
-
const parentCenter =
|
|
238502
|
+
const parentCenter = applyToPoint22(this.parent?.computeSchematicGlobalTransform?.() ?? identity6(), { x: 0, y: 0 });
|
|
238304
238503
|
return translate6(portPos.x - parentCenter.x, portPos.y - parentCenter.y);
|
|
238305
238504
|
}
|
|
238306
238505
|
}
|
|
@@ -239573,7 +239772,7 @@ var SchematicText = class extends PrimitiveComponent2 {
|
|
|
239573
239772
|
const text = db.schematic_text.get(this.schematic_text_id);
|
|
239574
239773
|
if (!text)
|
|
239575
239774
|
return;
|
|
239576
|
-
const newPosition =
|
|
239775
|
+
const newPosition = applyToPoint22(transform2, text.position);
|
|
239577
239776
|
db.schematic_text.update(this.schematic_text_id, {
|
|
239578
239777
|
position: { x: newPosition.x, y: newPosition.y }
|
|
239579
239778
|
});
|
|
@@ -239623,8 +239822,8 @@ var SchematicLine = class extends PrimitiveComponent2 {
|
|
|
239623
239822
|
const line2 = db.schematic_line.get(this.schematic_line_id);
|
|
239624
239823
|
if (!line2)
|
|
239625
239824
|
return;
|
|
239626
|
-
const p12 =
|
|
239627
|
-
const p222 =
|
|
239825
|
+
const p12 = applyToPoint22(transform2, { x: line2.x1, y: line2.y1 });
|
|
239826
|
+
const p222 = applyToPoint22(transform2, { x: line2.x2, y: line2.y2 });
|
|
239628
239827
|
db.schematic_line.update(this.schematic_line_id, {
|
|
239629
239828
|
x1: p12.x,
|
|
239630
239829
|
y1: p12.y,
|
|
@@ -239681,11 +239880,11 @@ var SchematicRect = class extends PrimitiveComponent2 {
|
|
|
239681
239880
|
const rect = db.schematic_rect.get(this.schematic_rect_id);
|
|
239682
239881
|
if (!rect)
|
|
239683
239882
|
return;
|
|
239684
|
-
const topLeft =
|
|
239883
|
+
const topLeft = applyToPoint22(transform2, {
|
|
239685
239884
|
x: rect.center.x - rect.width / 2,
|
|
239686
239885
|
y: rect.center.y + rect.height / 2
|
|
239687
239886
|
});
|
|
239688
|
-
const bottomRight =
|
|
239887
|
+
const bottomRight = applyToPoint22(transform2, {
|
|
239689
239888
|
x: rect.center.x + rect.width / 2,
|
|
239690
239889
|
y: rect.center.y - rect.height / 2
|
|
239691
239890
|
});
|
|
@@ -239750,8 +239949,8 @@ var SchematicArc = class extends PrimitiveComponent2 {
|
|
|
239750
239949
|
const arc2 = db.schematic_arc.get(this.schematic_arc_id);
|
|
239751
239950
|
if (!arc2)
|
|
239752
239951
|
return;
|
|
239753
|
-
const newCenter =
|
|
239754
|
-
const edgePoint =
|
|
239952
|
+
const newCenter = applyToPoint22(transform2, arc2.center);
|
|
239953
|
+
const edgePoint = applyToPoint22(transform2, {
|
|
239755
239954
|
x: arc2.center.x + arc2.radius,
|
|
239756
239955
|
y: arc2.center.y
|
|
239757
239956
|
});
|
|
@@ -239809,8 +240008,8 @@ var SchematicCircle = class extends PrimitiveComponent2 {
|
|
|
239809
240008
|
const circle2 = db.schematic_circle.get(this.schematic_circle_id);
|
|
239810
240009
|
if (!circle2)
|
|
239811
240010
|
return;
|
|
239812
|
-
const newCenter =
|
|
239813
|
-
const edgePoint =
|
|
240011
|
+
const newCenter = applyToPoint22(transform2, circle2.center);
|
|
240012
|
+
const edgePoint = applyToPoint22(transform2, {
|
|
239814
240013
|
x: circle2.center.x + circle2.radius,
|
|
239815
240014
|
y: circle2.center.y
|
|
239816
240015
|
});
|
|
@@ -240015,7 +240214,7 @@ var SchematicPath = class extends PrimitiveComponent2 {
|
|
|
240015
240214
|
if (!path42)
|
|
240016
240215
|
continue;
|
|
240017
240216
|
const newPoints = path42.points.map((point6) => {
|
|
240018
|
-
const transformed =
|
|
240217
|
+
const transformed = applyToPoint22(transform2, point6);
|
|
240019
240218
|
return { x: transformed.x, y: transformed.y };
|
|
240020
240219
|
});
|
|
240021
240220
|
db.schematic_path.update(pathId, {
|
|
@@ -247226,11 +247425,11 @@ import {
|
|
|
247226
247425
|
|
|
247227
247426
|
// node_modules/dsn-converter/dist/index.js
|
|
247228
247427
|
import { su as su7 } from "@tscircuit/soup-util";
|
|
247229
|
-
import { applyToPoint as
|
|
247428
|
+
import { applyToPoint as applyToPoint24, scale as scale7 } from "transformation-matrix";
|
|
247230
247429
|
import { su as su23 } from "@tscircuit/soup-util";
|
|
247231
247430
|
import Debug4 from "debug";
|
|
247232
247431
|
import { su as su33 } from "@tscircuit/soup-util";
|
|
247233
|
-
import { applyToPoint as
|
|
247432
|
+
import { applyToPoint as applyToPoint23, scale as scale22 } from "transformation-matrix";
|
|
247234
247433
|
import { su as su42 } from "@tscircuit/soup-util";
|
|
247235
247434
|
import Debug22 from "debug";
|
|
247236
247435
|
import { scale as scale32, applyToPoint as applyToPoint92 } from "transformation-matrix";
|
|
@@ -247466,7 +247665,7 @@ function processComponentsAndPads(componentGroups, circuitElements, pcb) {
|
|
|
247466
247665
|
const sourceComponent = su7(circuitElements).source_component.list().find((e4) => e4.source_component_id === pcbComponent?.source_component_id);
|
|
247467
247666
|
const footprintName = getFootprintName(sourceComponent, pcbComponent);
|
|
247468
247667
|
const componentName = sourceComponent?.name || "Unknown";
|
|
247469
|
-
const circuitSpaceCoordinates =
|
|
247668
|
+
const circuitSpaceCoordinates = applyToPoint24(transformMmToUm, pcbComponent.center);
|
|
247470
247669
|
if (!componentsByFootprint.has(footprintName)) {
|
|
247471
247670
|
componentsByFootprint.set(footprintName, []);
|
|
247472
247671
|
}
|
|
@@ -247978,7 +248177,7 @@ function processPlatedHoles(componentGroups, circuitElements, pcb) {
|
|
|
247978
248177
|
componentsByFootprint.set(key, []);
|
|
247979
248178
|
componentsByFootprint.get(key).push({
|
|
247980
248179
|
componentName: sourceComponent?.name || "Unknown",
|
|
247981
|
-
coordinates:
|
|
248180
|
+
coordinates: applyToPoint23(transformMmToUm2, pcbComponent.center),
|
|
247982
248181
|
rotation: pcbComponent.rotation || 0,
|
|
247983
248182
|
value: getComponentValue(sourceComponent),
|
|
247984
248183
|
sourceComponent
|
|
@@ -250608,10 +250807,10 @@ import { z as z49 } from "zod";
|
|
|
250608
250807
|
import { z as z50 } from "zod";
|
|
250609
250808
|
import { lineAlphabet as lineAlphabet2 } from "@tscircuit/alphabet";
|
|
250610
250809
|
import {
|
|
250611
|
-
applyToPoint as
|
|
250810
|
+
applyToPoint as applyToPoint25,
|
|
250612
250811
|
compose as compose8,
|
|
250613
|
-
identity as
|
|
250614
|
-
rotate as
|
|
250812
|
+
identity as identity8,
|
|
250813
|
+
rotate as rotate10,
|
|
250615
250814
|
translate as translate8
|
|
250616
250815
|
} from "transformation-matrix";
|
|
250617
250816
|
var defineExcellonDrillCommand = ({
|
|
@@ -251998,10 +252197,10 @@ var convertSoupToGerberCommands = (soup, opts = {}) => {
|
|
|
251998
252197
|
}
|
|
251999
252198
|
if (rotation4) {
|
|
252000
252199
|
const rad = rotation4 * Math.PI / 180;
|
|
252001
|
-
transforms.push(translate8(cx2, cy2),
|
|
252200
|
+
transforms.push(translate8(cx2, cy2), rotate10(rad), translate8(-cx2, -cy2));
|
|
252002
252201
|
}
|
|
252003
252202
|
const transformMatrix = transforms.length > 0 ? compose8(...transforms) : undefined;
|
|
252004
|
-
const applyTransform2 = (point5) => transformMatrix ?
|
|
252203
|
+
const applyTransform2 = (point5) => transformMatrix ? applyToPoint25(transformMatrix, point5) : point5;
|
|
252005
252204
|
if (layerType === "copper" && element.is_knockout) {
|
|
252006
252205
|
const padding = element.knockout_padding ?? {
|
|
252007
252206
|
left: 0.2,
|
|
@@ -252176,13 +252375,13 @@ var convertSoupToGerberCommands = (soup, opts = {}) => {
|
|
|
252176
252375
|
{ x: w4, y: -h4 },
|
|
252177
252376
|
{ x: -w4, y: -h4 }
|
|
252178
252377
|
];
|
|
252179
|
-
let transformMatrix =
|
|
252378
|
+
let transformMatrix = identity8();
|
|
252180
252379
|
if (rotation4) {
|
|
252181
252380
|
const angle_rad = rotation4 * Math.PI / 180;
|
|
252182
|
-
transformMatrix =
|
|
252381
|
+
transformMatrix = rotate10(angle_rad);
|
|
252183
252382
|
}
|
|
252184
252383
|
transformMatrix = compose8(translate8(center2.x, center2.y), transformMatrix);
|
|
252185
|
-
const transformedPoints = points.map((p3) =>
|
|
252384
|
+
const transformedPoints = points.map((p3) => applyToPoint25(transformMatrix, p3));
|
|
252186
252385
|
const rect_builder = gerberBuilder().add("select_aperture", { aperture_number: 10 }).add("start_region_statement", {});
|
|
252187
252386
|
rect_builder.add("move_operation", {
|
|
252188
252387
|
x: transformedPoints[0].x,
|
|
@@ -252537,23 +252736,23 @@ var convertSoupToGerberCommands = (soup, opts = {}) => {
|
|
|
252537
252736
|
const h4 = height / 2;
|
|
252538
252737
|
const r4 = Math.max(0, Math.min(corner_radius ?? 0, Math.abs(w4), Math.abs(h4)));
|
|
252539
252738
|
const makeTransformMatrix = () => {
|
|
252540
|
-
let transformMatrix2 =
|
|
252739
|
+
let transformMatrix2 = identity8();
|
|
252541
252740
|
if (rotation4) {
|
|
252542
252741
|
const angle_rad = rotation4 * Math.PI / 180;
|
|
252543
|
-
transformMatrix2 =
|
|
252742
|
+
transformMatrix2 = rotate10(angle_rad);
|
|
252544
252743
|
}
|
|
252545
252744
|
return compose8(translate8(center2.x, center2.y), transformMatrix2);
|
|
252546
252745
|
};
|
|
252547
252746
|
const transformMatrix = makeTransformMatrix();
|
|
252548
252747
|
if (r4 > 0) {
|
|
252549
252748
|
const startPoint = { x: -w4 + r4, y: h4 };
|
|
252550
|
-
let currentPoint =
|
|
252749
|
+
let currentPoint = applyToPoint25(transformMatrix, startPoint);
|
|
252551
252750
|
cutout_builder.add("move_operation", {
|
|
252552
252751
|
x: currentPoint.x,
|
|
252553
252752
|
y: mfy(currentPoint.y)
|
|
252554
252753
|
});
|
|
252555
252754
|
const addLine = (point5) => {
|
|
252556
|
-
const transformedPoint =
|
|
252755
|
+
const transformedPoint = applyToPoint25(transformMatrix, point5);
|
|
252557
252756
|
cutout_builder.add("plot_operation", {
|
|
252558
252757
|
x: transformedPoint.x,
|
|
252559
252758
|
y: mfy(transformedPoint.y)
|
|
@@ -252561,8 +252760,8 @@ var convertSoupToGerberCommands = (soup, opts = {}) => {
|
|
|
252561
252760
|
currentPoint = transformedPoint;
|
|
252562
252761
|
};
|
|
252563
252762
|
const addArc = (options) => {
|
|
252564
|
-
const transformedPoint =
|
|
252565
|
-
const transformedCenter =
|
|
252763
|
+
const transformedPoint = applyToPoint25(transformMatrix, options.point);
|
|
252764
|
+
const transformedCenter = applyToPoint25(transformMatrix, options.center);
|
|
252566
252765
|
cutout_builder.add("set_movement_mode_to_clockwise_circular", {}).add("plot_operation", {
|
|
252567
252766
|
x: transformedPoint.x,
|
|
252568
252767
|
y: mfy(transformedPoint.y),
|
|
@@ -252598,7 +252797,7 @@ var convertSoupToGerberCommands = (soup, opts = {}) => {
|
|
|
252598
252797
|
{ x: w4, y: -h4 },
|
|
252599
252798
|
{ x: -w4, y: -h4 }
|
|
252600
252799
|
];
|
|
252601
|
-
const transformedPoints = points.map((p3) =>
|
|
252800
|
+
const transformedPoints = points.map((p3) => applyToPoint25(transformMatrix, p3));
|
|
252602
252801
|
cutout_builder.add("move_operation", {
|
|
252603
252802
|
x: transformedPoints[0].x,
|
|
252604
252803
|
y: mfy(transformedPoints[0].y)
|
|
@@ -260456,7 +260655,7 @@ var any_circuit_element2 = external_exports2.union([
|
|
|
260456
260655
|
var any_soup_element2 = any_circuit_element2;
|
|
260457
260656
|
expectTypesMatch3(true);
|
|
260458
260657
|
expectStringUnionsMatch2(true);
|
|
260459
|
-
function
|
|
260658
|
+
function applyToPoint26(matrix2, point22) {
|
|
260460
260659
|
return Array.isArray(point22) ? [
|
|
260461
260660
|
matrix2.a * point22[0] + matrix2.c * point22[1] + matrix2.e,
|
|
260462
260661
|
matrix2.b * point22[0] + matrix2.d * point22[1] + matrix2.f
|
|
@@ -261420,7 +261619,7 @@ var transformPCBElement2 = (elm, matrix2) => {
|
|
|
261420
261619
|
const tsr = decomposeTSR2(matrix2);
|
|
261421
261620
|
const flipPadWidthHeight = Math.round(tsr.rotation.angle / (Math.PI / 2)) % 2 === 1;
|
|
261422
261621
|
if (elm.type === "pcb_plated_hole" || elm.type === "pcb_hole" || elm.type === "pcb_via" || elm.type === "pcb_smtpad" || elm.type === "pcb_port") {
|
|
261423
|
-
const { x: x3, y: y4 } =
|
|
261622
|
+
const { x: x3, y: y4 } = applyToPoint26(matrix2, {
|
|
261424
261623
|
x: Number(elm.x),
|
|
261425
261624
|
y: Number(elm.y)
|
|
261426
261625
|
});
|
|
@@ -261428,7 +261627,7 @@ var transformPCBElement2 = (elm, matrix2) => {
|
|
|
261428
261627
|
elm.y = y4;
|
|
261429
261628
|
if (elm.type === "pcb_smtpad" && elm.shape === "polygon" && Array.isArray(elm.points)) {
|
|
261430
261629
|
elm.points = elm.points.map((point22) => {
|
|
261431
|
-
const tp3 =
|
|
261630
|
+
const tp3 = applyToPoint26(matrix2, { x: point22.x, y: point22.y });
|
|
261432
261631
|
return {
|
|
261433
261632
|
x: tp3.x,
|
|
261434
261633
|
y: tp3.y
|
|
@@ -261436,13 +261635,13 @@ var transformPCBElement2 = (elm, matrix2) => {
|
|
|
261436
261635
|
});
|
|
261437
261636
|
}
|
|
261438
261637
|
} else if (elm.type === "pcb_keepout" || elm.type === "pcb_board") {
|
|
261439
|
-
elm.center =
|
|
261638
|
+
elm.center = applyToPoint26(matrix2, elm.center);
|
|
261440
261639
|
} else if (elm.type === "pcb_silkscreen_text" || elm.type === "pcb_fabrication_note_text" || elm.type === "pcb_note_text") {
|
|
261441
|
-
elm.anchor_position =
|
|
261640
|
+
elm.anchor_position = applyToPoint26(matrix2, elm.anchor_position);
|
|
261442
261641
|
} else if (elm.type === "pcb_silkscreen_circle" || elm.type === "pcb_silkscreen_rect" || elm.type === "pcb_note_rect" || elm.type === "pcb_courtyard_rect" || elm.type === "pcb_courtyard_circle") {
|
|
261443
|
-
elm.center =
|
|
261642
|
+
elm.center = applyToPoint26(matrix2, elm.center);
|
|
261444
261643
|
} else if (elm.type === "pcb_component") {
|
|
261445
|
-
elm.center =
|
|
261644
|
+
elm.center = applyToPoint26(matrix2, elm.center);
|
|
261446
261645
|
elm.rotation = elm.rotation + tsr.rotation.angle / Math.PI * 180;
|
|
261447
261646
|
elm.rotation = elm.rotation % 360;
|
|
261448
261647
|
if (flipPadWidthHeight) {
|
|
@@ -261450,21 +261649,21 @@ var transformPCBElement2 = (elm, matrix2) => {
|
|
|
261450
261649
|
}
|
|
261451
261650
|
} else if (elm.type === "pcb_courtyard_outline") {
|
|
261452
261651
|
elm.outline = elm.outline.map((p3) => {
|
|
261453
|
-
const tp3 =
|
|
261652
|
+
const tp3 = applyToPoint26(matrix2, p3);
|
|
261454
261653
|
p3.x = tp3.x;
|
|
261455
261654
|
p3.y = tp3.y;
|
|
261456
261655
|
return p3;
|
|
261457
261656
|
});
|
|
261458
261657
|
} else if (elm.type === "pcb_courtyard_polygon") {
|
|
261459
261658
|
elm.points = elm.points.map((p3) => {
|
|
261460
|
-
const tp3 =
|
|
261659
|
+
const tp3 = applyToPoint26(matrix2, p3);
|
|
261461
261660
|
p3.x = tp3.x;
|
|
261462
261661
|
p3.y = tp3.y;
|
|
261463
261662
|
return p3;
|
|
261464
261663
|
});
|
|
261465
261664
|
} else if (elm.type === "pcb_silkscreen_path" || elm.type === "pcb_trace" || elm.type === "pcb_fabrication_note_path" || elm.type === "pcb_note_path") {
|
|
261466
261665
|
elm.route = elm.route.map((rp3) => {
|
|
261467
|
-
const tp3 =
|
|
261666
|
+
const tp3 = applyToPoint26(matrix2, rp3);
|
|
261468
261667
|
rp3.x = tp3.x;
|
|
261469
261668
|
rp3.y = tp3.y;
|
|
261470
261669
|
return rp3;
|
|
@@ -261472,14 +261671,14 @@ var transformPCBElement2 = (elm, matrix2) => {
|
|
|
261472
261671
|
} else if (elm.type === "pcb_silkscreen_line" || elm.type === "pcb_note_line") {
|
|
261473
261672
|
const p12 = { x: elm.x1, y: elm.y1 };
|
|
261474
261673
|
const p23 = { x: elm.x2, y: elm.y2 };
|
|
261475
|
-
const p1t =
|
|
261476
|
-
const p2t =
|
|
261674
|
+
const p1t = applyToPoint26(matrix2, p12);
|
|
261675
|
+
const p2t = applyToPoint26(matrix2, p23);
|
|
261477
261676
|
elm.x1 = p1t.x;
|
|
261478
261677
|
elm.y1 = p1t.y;
|
|
261479
261678
|
elm.x2 = p2t.x;
|
|
261480
261679
|
elm.y2 = p2t.y;
|
|
261481
261680
|
} else if (elm.type === "cad_component") {
|
|
261482
|
-
const newPos =
|
|
261681
|
+
const newPos = applyToPoint26(matrix2, {
|
|
261483
261682
|
x: elm.position.x,
|
|
261484
261683
|
y: elm.position.y
|
|
261485
261684
|
});
|
|
@@ -262274,15 +262473,15 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, {
|
|
|
262274
262473
|
for (const e4 of circuitElements) {
|
|
262275
262474
|
if (e4.type === "pcb_cutout") {
|
|
262276
262475
|
if (e4.shape === "polygon") {
|
|
262277
|
-
e4.points = e4.points.map((p3) =>
|
|
262476
|
+
e4.points = e4.points.map((p3) => applyToPoint26(matrix2, p3));
|
|
262278
262477
|
} else if (e4.shape === "circle" || e4.shape === "rect") {
|
|
262279
|
-
e4.center =
|
|
262478
|
+
e4.center = applyToPoint26(matrix2, e4.center);
|
|
262280
262479
|
} else if ("route" in e4) {
|
|
262281
262480
|
const cutoutPath = e4;
|
|
262282
|
-
cutoutPath.route = cutoutPath.route.map((p3) =>
|
|
262481
|
+
cutoutPath.route = cutoutPath.route.map((p3) => applyToPoint26(matrix2, p3));
|
|
262283
262482
|
}
|
|
262284
262483
|
} else if (e4.type === "pcb_smtpad" && e4.shape === "polygon") {
|
|
262285
|
-
e4.points = e4.points.map((p3) =>
|
|
262484
|
+
e4.points = e4.points.map((p3) => applyToPoint26(matrix2, p3));
|
|
262286
262485
|
}
|
|
262287
262486
|
}
|
|
262288
262487
|
const cad = circuitElements.find((e4) => e4.type === "cad_component");
|
|
@@ -267015,7 +267214,7 @@ var any_circuit_element3 = z160.union([
|
|
|
267015
267214
|
var any_soup_element3 = any_circuit_element3;
|
|
267016
267215
|
expectTypesMatch4(true);
|
|
267017
267216
|
expectStringUnionsMatch3(true);
|
|
267018
|
-
function
|
|
267217
|
+
function applyToPoint27(matrix2, point22) {
|
|
267019
267218
|
return Array.isArray(point22) ? [
|
|
267020
267219
|
matrix2.a * point22[0] + matrix2.c * point22[1] + matrix2.e,
|
|
267021
267220
|
matrix2.b * point22[0] + matrix2.d * point22[1] + matrix2.f
|
|
@@ -267978,7 +268177,7 @@ var transformPCBElement3 = (elm, matrix2) => {
|
|
|
267978
268177
|
const tsr = decomposeTSR3(matrix2);
|
|
267979
268178
|
const flipPadWidthHeight = Math.round(tsr.rotation.angle / (Math.PI / 2)) % 2 === 1;
|
|
267980
268179
|
if (elm.type === "pcb_plated_hole" || elm.type === "pcb_hole" || elm.type === "pcb_via" || elm.type === "pcb_smtpad" || elm.type === "pcb_port") {
|
|
267981
|
-
const { x: x3, y: y4 } =
|
|
268180
|
+
const { x: x3, y: y4 } = applyToPoint27(matrix2, {
|
|
267982
268181
|
x: Number(elm.x),
|
|
267983
268182
|
y: Number(elm.y)
|
|
267984
268183
|
});
|
|
@@ -267986,7 +268185,7 @@ var transformPCBElement3 = (elm, matrix2) => {
|
|
|
267986
268185
|
elm.y = y4;
|
|
267987
268186
|
if (elm.type === "pcb_smtpad" && elm.shape === "polygon" && Array.isArray(elm.points)) {
|
|
267988
268187
|
elm.points = elm.points.map((point22) => {
|
|
267989
|
-
const tp3 =
|
|
268188
|
+
const tp3 = applyToPoint27(matrix2, { x: point22.x, y: point22.y });
|
|
267990
268189
|
return {
|
|
267991
268190
|
x: tp3.x,
|
|
267992
268191
|
y: tp3.y
|
|
@@ -267994,13 +268193,13 @@ var transformPCBElement3 = (elm, matrix2) => {
|
|
|
267994
268193
|
});
|
|
267995
268194
|
}
|
|
267996
268195
|
} else if (elm.type === "pcb_keepout" || elm.type === "pcb_board") {
|
|
267997
|
-
elm.center =
|
|
268196
|
+
elm.center = applyToPoint27(matrix2, elm.center);
|
|
267998
268197
|
} else if (elm.type === "pcb_silkscreen_text" || elm.type === "pcb_fabrication_note_text" || elm.type === "pcb_note_text") {
|
|
267999
|
-
elm.anchor_position =
|
|
268198
|
+
elm.anchor_position = applyToPoint27(matrix2, elm.anchor_position);
|
|
268000
268199
|
} else if (elm.type === "pcb_silkscreen_circle" || elm.type === "pcb_silkscreen_rect" || elm.type === "pcb_note_rect" || elm.type === "pcb_courtyard_rect" || elm.type === "pcb_courtyard_circle") {
|
|
268001
|
-
elm.center =
|
|
268200
|
+
elm.center = applyToPoint27(matrix2, elm.center);
|
|
268002
268201
|
} else if (elm.type === "pcb_component") {
|
|
268003
|
-
elm.center =
|
|
268202
|
+
elm.center = applyToPoint27(matrix2, elm.center);
|
|
268004
268203
|
elm.rotation = elm.rotation + tsr.rotation.angle / Math.PI * 180;
|
|
268005
268204
|
elm.rotation = elm.rotation % 360;
|
|
268006
268205
|
if (flipPadWidthHeight) {
|
|
@@ -268008,21 +268207,21 @@ var transformPCBElement3 = (elm, matrix2) => {
|
|
|
268008
268207
|
}
|
|
268009
268208
|
} else if (elm.type === "pcb_courtyard_outline") {
|
|
268010
268209
|
elm.outline = elm.outline.map((p3) => {
|
|
268011
|
-
const tp3 =
|
|
268210
|
+
const tp3 = applyToPoint27(matrix2, p3);
|
|
268012
268211
|
p3.x = tp3.x;
|
|
268013
268212
|
p3.y = tp3.y;
|
|
268014
268213
|
return p3;
|
|
268015
268214
|
});
|
|
268016
268215
|
} else if (elm.type === "pcb_courtyard_polygon") {
|
|
268017
268216
|
elm.points = elm.points.map((p3) => {
|
|
268018
|
-
const tp3 =
|
|
268217
|
+
const tp3 = applyToPoint27(matrix2, p3);
|
|
268019
268218
|
p3.x = tp3.x;
|
|
268020
268219
|
p3.y = tp3.y;
|
|
268021
268220
|
return p3;
|
|
268022
268221
|
});
|
|
268023
268222
|
} else if (elm.type === "pcb_silkscreen_path" || elm.type === "pcb_trace" || elm.type === "pcb_fabrication_note_path" || elm.type === "pcb_note_path") {
|
|
268024
268223
|
elm.route = elm.route.map((rp3) => {
|
|
268025
|
-
const tp3 =
|
|
268224
|
+
const tp3 = applyToPoint27(matrix2, rp3);
|
|
268026
268225
|
rp3.x = tp3.x;
|
|
268027
268226
|
rp3.y = tp3.y;
|
|
268028
268227
|
return rp3;
|
|
@@ -268030,14 +268229,14 @@ var transformPCBElement3 = (elm, matrix2) => {
|
|
|
268030
268229
|
} else if (elm.type === "pcb_silkscreen_line" || elm.type === "pcb_note_line") {
|
|
268031
268230
|
const p12 = { x: elm.x1, y: elm.y1 };
|
|
268032
268231
|
const p23 = { x: elm.x2, y: elm.y2 };
|
|
268033
|
-
const p1t =
|
|
268034
|
-
const p2t =
|
|
268232
|
+
const p1t = applyToPoint27(matrix2, p12);
|
|
268233
|
+
const p2t = applyToPoint27(matrix2, p23);
|
|
268035
268234
|
elm.x1 = p1t.x;
|
|
268036
268235
|
elm.y1 = p1t.y;
|
|
268037
268236
|
elm.x2 = p2t.x;
|
|
268038
268237
|
elm.y2 = p2t.y;
|
|
268039
268238
|
} else if (elm.type === "cad_component") {
|
|
268040
|
-
const newPos =
|
|
268239
|
+
const newPos = applyToPoint27(matrix2, {
|
|
268041
268240
|
x: elm.position.x,
|
|
268042
268241
|
y: elm.position.y
|
|
268043
268242
|
});
|
|
@@ -268829,15 +269028,15 @@ var convertEasyEdaJsonToCircuitJson2 = (easyEdaJson, {
|
|
|
268829
269028
|
for (const e4 of circuitElements) {
|
|
268830
269029
|
if (e4.type === "pcb_cutout") {
|
|
268831
269030
|
if (e4.shape === "polygon") {
|
|
268832
|
-
e4.points = e4.points.map((p3) =>
|
|
269031
|
+
e4.points = e4.points.map((p3) => applyToPoint27(matrix2, p3));
|
|
268833
269032
|
} else if (e4.shape === "circle" || e4.shape === "rect") {
|
|
268834
|
-
e4.center =
|
|
269033
|
+
e4.center = applyToPoint27(matrix2, e4.center);
|
|
268835
269034
|
} else if ("route" in e4) {
|
|
268836
269035
|
const cutoutPath = e4;
|
|
268837
|
-
cutoutPath.route = cutoutPath.route.map((p3) =>
|
|
269036
|
+
cutoutPath.route = cutoutPath.route.map((p3) => applyToPoint27(matrix2, p3));
|
|
268838
269037
|
}
|
|
268839
269038
|
} else if (e4.type === "pcb_smtpad" && e4.shape === "polygon") {
|
|
268840
|
-
e4.points = e4.points.map((p3) =>
|
|
269039
|
+
e4.points = e4.points.map((p3) => applyToPoint27(matrix2, p3));
|
|
268841
269040
|
}
|
|
268842
269041
|
}
|
|
268843
269042
|
const cad = circuitElements.find((e4) => e4.type === "cad_component");
|