@tscircuit/cli 0.1.2451 → 0.1.2453
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 +2 -2
- package/dist/lib/index.js +29 -10
- package/package.json +3 -3
package/dist/cli/main.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
[diffend] Oversized file quarantined before diffing.
|
|
2
2
|
name: package/dist/cli/main.js
|
|
3
|
-
size:
|
|
4
|
-
sha256:
|
|
3
|
+
size: 47929051 bytes
|
|
4
|
+
sha256: 24912cb606fda118b7172cda29c2f60b3053f65a63a32104ed6d42062f343cd2
|
package/dist/lib/index.js
CHANGED
|
@@ -75342,24 +75342,43 @@ function buildSymbolDataFromSchematicPrimitives(params2) {
|
|
|
75342
75342
|
ports: symbolPorts
|
|
75343
75343
|
};
|
|
75344
75344
|
}
|
|
75345
|
+
var SCHEMATIC_INTERNAL_UNITS_PER_MM = 1e4;
|
|
75346
|
+
var HALF_INTERNAL_UNIT = 0.5;
|
|
75347
|
+
var UNIT_ROUNDOFF = Number.EPSILON / 2;
|
|
75348
|
+
var SYMBOL_COORDINATE_ROUNDING_STEPS = 6;
|
|
75349
|
+
var SYMBOL_COORDINATE_ROUNDOFF_FACTOR = SYMBOL_COORDINATE_ROUNDING_STEPS * UNIT_ROUNDOFF / (1 - SYMBOL_COORDINATE_ROUNDING_STEPS * UNIT_ROUNDOFF);
|
|
75345
75350
|
function toSchematicInternalUnits(mm) {
|
|
75346
|
-
return Math.sign(mm) * Math.round(Math.abs(mm) *
|
|
75351
|
+
return Math.sign(mm) * Math.round(Math.abs(mm) * SCHEMATIC_INTERNAL_UNITS_PER_MM);
|
|
75347
75352
|
}
|
|
75348
75353
|
function roundSchematicCoordinate(mm) {
|
|
75349
|
-
return toSchematicInternalUnits(mm) /
|
|
75354
|
+
return toSchematicInternalUnits(mm) / SCHEMATIC_INTERNAL_UNITS_PER_MM;
|
|
75350
75355
|
}
|
|
75351
75356
|
function transformSchematicPoint(transform, point) {
|
|
75352
75357
|
const { x, y } = applyToPoint(transform, point);
|
|
75353
75358
|
return { x: roundSchematicCoordinate(x), y: roundSchematicCoordinate(y) };
|
|
75354
75359
|
}
|
|
75360
|
+
function roundSymbolCoordinate(mm, magnitude) {
|
|
75361
|
+
const units = Math.abs(mm) * SCHEMATIC_INTERNAL_UNITS_PER_MM;
|
|
75362
|
+
const midpoint = Math.floor(units) + HALF_INTERNAL_UNIT;
|
|
75363
|
+
const tolerance = SYMBOL_COORDINATE_ROUNDOFF_FACTOR * magnitude * SCHEMATIC_INTERNAL_UNITS_PER_MM;
|
|
75364
|
+
const roundedUnits = tolerance < HALF_INTERNAL_UNIT && Math.abs(units - midpoint) <= tolerance ? Math.sign(mm) * Math.ceil(midpoint) : toSchematicInternalUnits(mm);
|
|
75365
|
+
return roundedUnits / SCHEMATIC_INTERNAL_UNITS_PER_MM;
|
|
75366
|
+
}
|
|
75367
|
+
function transformSymbolPoint(transform, point) {
|
|
75368
|
+
const { x, y } = applyToPoint(transform, point);
|
|
75369
|
+
return {
|
|
75370
|
+
x: roundSymbolCoordinate(x, Math.abs(transform.a * point.x) + Math.abs(transform.c * point.y) + Math.abs(transform.e)),
|
|
75371
|
+
y: roundSymbolCoordinate(y, Math.abs(transform.b * point.x) + Math.abs(transform.d * point.y) + Math.abs(transform.f))
|
|
75372
|
+
};
|
|
75373
|
+
}
|
|
75355
75374
|
function createArcFromPrimitive({
|
|
75356
75375
|
primitive,
|
|
75357
75376
|
transform,
|
|
75358
75377
|
scale: scale9
|
|
75359
75378
|
}) {
|
|
75360
|
-
const start =
|
|
75361
|
-
const mid =
|
|
75362
|
-
const end =
|
|
75379
|
+
const start = transformSymbolPoint(transform, primitive.start);
|
|
75380
|
+
const mid = transformSymbolPoint(transform, primitive.mid);
|
|
75381
|
+
const end = transformSymbolPoint(transform, primitive.end);
|
|
75363
75382
|
return SymbolArc.fromSexprPrimitives([
|
|
75364
75383
|
["start", start.x, start.y],
|
|
75365
75384
|
["mid", mid.x, mid.y],
|
|
@@ -75426,7 +75445,7 @@ function createCircleFromPrimitive({
|
|
|
75426
75445
|
transform,
|
|
75427
75446
|
scale: scale9
|
|
75428
75447
|
}) {
|
|
75429
|
-
const scaledPos =
|
|
75448
|
+
const scaledPos = transformSymbolPoint(transform, {
|
|
75430
75449
|
x: primitive.x,
|
|
75431
75450
|
y: primitive.y
|
|
75432
75451
|
});
|
|
@@ -75463,7 +75482,7 @@ function createPolylineFromPoints({
|
|
|
75463
75482
|
}) {
|
|
75464
75483
|
const polyline = new SymbolPolyline;
|
|
75465
75484
|
const xyPoints = points.map((p) => {
|
|
75466
|
-
const transformed =
|
|
75485
|
+
const transformed = transformSymbolPoint(transform, p);
|
|
75467
75486
|
return new Xy(transformed.x, transformed.y);
|
|
75468
75487
|
});
|
|
75469
75488
|
const pts = new Pts(xyPoints);
|
|
@@ -75485,8 +75504,8 @@ function createRectangleFromPrimitive({
|
|
|
75485
75504
|
transform,
|
|
75486
75505
|
scale: scale9
|
|
75487
75506
|
}) {
|
|
75488
|
-
const start =
|
|
75489
|
-
const end =
|
|
75507
|
+
const start = transformSymbolPoint(transform, primitive.start);
|
|
75508
|
+
const end = transformSymbolPoint(transform, primitive.end);
|
|
75490
75509
|
return SymbolRectangle.fromSexprPrimitives([
|
|
75491
75510
|
["start", start.x, start.y],
|
|
75492
75511
|
["end", end.x, end.y],
|
|
@@ -75513,7 +75532,7 @@ function createTextFromPrimitive({
|
|
|
75513
75532
|
scale: scale9
|
|
75514
75533
|
}) {
|
|
75515
75534
|
const symbolText = new SymbolText;
|
|
75516
|
-
const scaledPos =
|
|
75535
|
+
const scaledPos = transformSymbolPoint(transform, {
|
|
75517
75536
|
x: schText.x,
|
|
75518
75537
|
y: schText.y
|
|
75519
75538
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tscircuit/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2453",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/tscircuit/cli"
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"@tscircuit/circuit-json-pcb-style-analysis": "https://jscdn.tscircuit.com/@tscircuit/circuit-json-pcb-style-analysis/0.0.5.tgz",
|
|
21
21
|
"@tscircuit/circuit-json-placement-analysis": "^0.0.17",
|
|
22
22
|
"@tscircuit/circuit-json-routing-analysis": "^0.0.8",
|
|
23
|
-
"@tscircuit/circuit-json-schematic-placement-analysis": "https://jscdn.tscircuit.com/@tscircuit/circuit-json-schematic-placement-analysis/0.0.
|
|
23
|
+
"@tscircuit/circuit-json-schematic-placement-analysis": "https://jscdn.tscircuit.com/@tscircuit/circuit-json-schematic-placement-analysis/0.0.97.tgz",
|
|
24
24
|
"@tscircuit/circuit-json-to-drawing": "https://jscdn.tscircuit.com/@tscircuit/circuit-json-to-drawing/0.0.3.tgz",
|
|
25
25
|
"@tscircuit/fake-snippets": "^0.0.226",
|
|
26
26
|
"@tscircuit/file-server": "^0.0.32",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"circuit-json-to-fdm-component-box": "^0.0.2",
|
|
45
45
|
"circuit-json-to-footprinter": "^0.0.59",
|
|
46
46
|
"circuit-json-to-gerber": "^0.0.122",
|
|
47
|
-
"circuit-json-to-kicad": "0.0.
|
|
47
|
+
"circuit-json-to-kicad": "0.0.274",
|
|
48
48
|
"circuit-json-to-readable-netlist": "^0.0.15",
|
|
49
49
|
"circuit-json-to-step": "^0.0.63",
|
|
50
50
|
"circuit-json-to-tscircuit": "^0.0.50",
|