easyeda 0.0.257 → 0.0.259
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/index.js +23 -11
- package/dist/browser/index.js.map +1 -1
- package/dist/index.js +23 -11
- package/dist/index.js.map +1 -1
- package/dist/main.cjs +26 -14
- package/dist/main.cjs.map +1 -1
- package/package.json +3 -3
package/dist/browser/index.js
CHANGED
|
@@ -9251,15 +9251,12 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, {
|
|
|
9251
9251
|
const innerWidth = largestOuterDimensionName === "width" ? largestInnerDimension : smallestInnerDimension;
|
|
9252
9252
|
const innerHeight = largestOuterDimensionName === "height" ? largestInnerDimension : smallestInnerDimension;
|
|
9253
9253
|
additionalPlatedHoleProps = {
|
|
9254
|
-
shape: "
|
|
9255
|
-
hole_shape: "pill",
|
|
9256
|
-
pad_shape: "rect",
|
|
9254
|
+
shape: "pill",
|
|
9257
9255
|
hole_width: innerWidth,
|
|
9258
9256
|
hole_height: innerHeight,
|
|
9259
|
-
|
|
9260
|
-
|
|
9261
|
-
|
|
9262
|
-
hole_offset_y: 0
|
|
9257
|
+
outer_width: mil2mm(pad.width),
|
|
9258
|
+
outer_height: mil2mm(pad.height),
|
|
9259
|
+
ccw_rotation: pad.rotation || 0
|
|
9263
9260
|
};
|
|
9264
9261
|
} else if (pad.shape === "RECT") {
|
|
9265
9262
|
const padWidth = mil2mm(pad.width);
|
|
@@ -10385,7 +10382,13 @@ var getRotatedOffsetMm = ({
|
|
|
10385
10382
|
};
|
|
10386
10383
|
var getCadModelOffsetMm = (easyEdaJson) => {
|
|
10387
10384
|
const svgNode = getCadSvgNode(easyEdaJson);
|
|
10388
|
-
|
|
10385
|
+
return getCadModelOffsetMmFromBounds(
|
|
10386
|
+
easyEdaJson,
|
|
10387
|
+
easyEdaJson._objMetadata?.bounds
|
|
10388
|
+
);
|
|
10389
|
+
};
|
|
10390
|
+
var getCadModelOffsetMmFromBounds = (easyEdaJson, bounds) => {
|
|
10391
|
+
const svgNode = getCadSvgNode(easyEdaJson);
|
|
10389
10392
|
if (!svgNode || !bounds) return null;
|
|
10390
10393
|
const [originX, originY] = String(svgNode.svgData.attrs?.c_origin ?? "0,0").split(",").map((value) => Number(value.trim()));
|
|
10391
10394
|
if (!Number.isFinite(originX) || !Number.isFinite(originY)) return null;
|
|
@@ -10479,9 +10482,8 @@ var getPositionZMmFromBounds = (bounds, svgNodeZOffsetMm) => {
|
|
|
10479
10482
|
var getEasyEdaCadModelPlacement = async (easyEdaJson, { fetch: fetch2 = globalThis.fetch } = {}) => {
|
|
10480
10483
|
const modelUuid = getCadSvgNodeModelUuid(easyEdaJson);
|
|
10481
10484
|
const partNumber = easyEdaJson.lcsc.number;
|
|
10482
|
-
const derivedOffsetMm = getCadModelOffsetMm(easyEdaJson);
|
|
10483
10485
|
const svgNodeZOffsetMm = getCadSvgNodeZOffsetMm(easyEdaJson);
|
|
10484
|
-
if (!modelUuid || !partNumber || svgNodeZOffsetMm == null || !
|
|
10486
|
+
if (!modelUuid || !partNumber || svgNodeZOffsetMm == null || !fetch2) {
|
|
10485
10487
|
return null;
|
|
10486
10488
|
}
|
|
10487
10489
|
const modelObjUrl = getModelObjCdnUrl({
|
|
@@ -10494,6 +10496,8 @@ var getEasyEdaCadModelPlacement = async (easyEdaJson, { fetch: fetch2 = globalTh
|
|
|
10494
10496
|
});
|
|
10495
10497
|
const metadataBounds = easyEdaJson._objMetadata?.bounds;
|
|
10496
10498
|
if (metadataBounds) {
|
|
10499
|
+
const derivedOffsetMm = getCadModelOffsetMm(easyEdaJson);
|
|
10500
|
+
if (!derivedOffsetMm) return null;
|
|
10497
10501
|
return {
|
|
10498
10502
|
modelObjUrl,
|
|
10499
10503
|
positionXMm: derivedOffsetMm.x,
|
|
@@ -10513,6 +10517,8 @@ var getEasyEdaCadModelPlacement = async (easyEdaJson, { fetch: fetch2 = globalTh
|
|
|
10513
10517
|
const objText = await response.text();
|
|
10514
10518
|
const bounds = parseObjBounds(objText);
|
|
10515
10519
|
if (!bounds) return null;
|
|
10520
|
+
const derivedOffsetMm = getCadModelOffsetMmFromBounds(easyEdaJson, bounds);
|
|
10521
|
+
if (!derivedOffsetMm) return null;
|
|
10516
10522
|
return {
|
|
10517
10523
|
modelObjUrl,
|
|
10518
10524
|
positionXMm: derivedOffsetMm.x,
|
|
@@ -10554,7 +10560,13 @@ var generateFootprintTsx = (circuitJson) => {
|
|
|
10554
10560
|
}
|
|
10555
10561
|
}
|
|
10556
10562
|
for (const platedHole of platedHoles) {
|
|
10557
|
-
if (platedHole.shape === "
|
|
10563
|
+
if (platedHole.shape === "pill" || platedHole.shape === "oval") {
|
|
10564
|
+
const cccwRotationDegree = platedHole.ccw_rotation || 0;
|
|
10565
|
+
const rotation2 = cccwRotationDegree ? ` pcbRotation="${cccwRotationDegree}deg"` : "";
|
|
10566
|
+
elementStrings.push(
|
|
10567
|
+
`<platedhole portHints={${JSON.stringify(platedHole.port_hints)}} pcbX="${mmStr(platedHole.x)}" pcbY="${mmStr(platedHole.y)}" holeWidth="${mmStr(platedHole.hole_width)}" holeHeight="${mmStr(platedHole.hole_height)}" outerWidth="${mmStr(platedHole.outer_width)}" outerHeight="${mmStr(platedHole.outer_height)}"${rotation2} shape="${platedHole.shape}" />`
|
|
10568
|
+
);
|
|
10569
|
+
} else if (platedHole.shape === "pill_hole_with_rect_pad") {
|
|
10558
10570
|
elementStrings.push(
|
|
10559
10571
|
`<platedhole portHints={${JSON.stringify(platedHole.port_hints)}} pcbX="${mmStr(platedHole.x)}" pcbY="${mmStr(platedHole.y)}" holeWidth="${mmStr(platedHole.hole_width)}" holeHeight="${mmStr(platedHole.hole_height)}" outerWidth="${mmStr(platedHole.rect_pad_width)}" outerHeight="${mmStr(platedHole.rect_pad_height)}" shape="pill" />`
|
|
10560
10572
|
);
|