@lucablockltd/ultimate-packaging 1.2.0 → 1.4.0
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/AGENTS_README.md +79 -5
- package/dist/index.d.mts +270 -25
- package/dist/index.d.ts +270 -25
- package/dist/index.js +3830 -555
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3820 -556
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -444,12 +444,14 @@ var BaseCanvas = forwardRef(
|
|
|
444
444
|
const svgRef = useRef(null);
|
|
445
445
|
const dragRef = useRef(null);
|
|
446
446
|
const hasInitialFit = useRef(false);
|
|
447
|
+
const frozenViewBox = useRef(null);
|
|
447
448
|
const [zoom, setZoom] = useState(1);
|
|
448
449
|
const [panX, setPanX] = useState(0);
|
|
449
450
|
const [panY, setPanY] = useState(0);
|
|
450
451
|
const [dragging, setDragging] = useState(false);
|
|
451
|
-
const
|
|
452
|
-
const
|
|
452
|
+
const refVB = frozenViewBox.current ?? initialViewBox;
|
|
453
|
+
const vbWidth = refVB.width / zoom;
|
|
454
|
+
const vbHeight = refVB.height / zoom;
|
|
453
455
|
const centerX = initialViewBox.x + initialViewBox.width / 2;
|
|
454
456
|
const centerY = initialViewBox.y + initialViewBox.height / 2;
|
|
455
457
|
const vbX = centerX - vbWidth / 2 - panX;
|
|
@@ -457,10 +459,11 @@ var BaseCanvas = forwardRef(
|
|
|
457
459
|
const fitView = useCallback(() => {
|
|
458
460
|
const container = containerRef.current;
|
|
459
461
|
if (!container) return;
|
|
462
|
+
frozenViewBox.current = { ...initialViewBox };
|
|
460
463
|
setZoom(clamp(fitPadding, minZoom, maxZoom));
|
|
461
464
|
setPanX(0);
|
|
462
465
|
setPanY(0);
|
|
463
|
-
}, [initialViewBox.width, initialViewBox.height, fitPadding, minZoom, maxZoom]);
|
|
466
|
+
}, [initialViewBox.x, initialViewBox.y, initialViewBox.width, initialViewBox.height, fitPadding, minZoom, maxZoom]);
|
|
464
467
|
const resetView = useCallback(() => {
|
|
465
468
|
fitView();
|
|
466
469
|
}, [fitView]);
|
|
@@ -474,10 +477,6 @@ var BaseCanvas = forwardRef(
|
|
|
474
477
|
hasInitialFit.current = true;
|
|
475
478
|
fitView();
|
|
476
479
|
}, [fitView]);
|
|
477
|
-
useEffect(() => {
|
|
478
|
-
if (!hasInitialFit.current) return;
|
|
479
|
-
fitView();
|
|
480
|
-
}, [initialViewBox.width, initialViewBox.height, fitView]);
|
|
481
480
|
useEffect(() => {
|
|
482
481
|
const container = containerRef.current;
|
|
483
482
|
if (!container) return;
|
|
@@ -489,12 +488,13 @@ var BaseCanvas = forwardRef(
|
|
|
489
488
|
const cursorXRatio = (e.clientX - rect.left) / rect.width;
|
|
490
489
|
const cursorYRatio = (e.clientY - rect.top) / rect.height;
|
|
491
490
|
const zoomFactor = Math.exp(-e.deltaY * 2e-3);
|
|
491
|
+
const currentRefVB = frozenViewBox.current ?? initialViewBox;
|
|
492
492
|
setZoom((prevZoom) => {
|
|
493
493
|
const nextZoom = clamp(prevZoom * zoomFactor, minZoom, maxZoom);
|
|
494
|
-
const prevW =
|
|
495
|
-
const prevH =
|
|
496
|
-
const nextW =
|
|
497
|
-
const nextH =
|
|
494
|
+
const prevW = currentRefVB.width / prevZoom;
|
|
495
|
+
const prevH = currentRefVB.height / prevZoom;
|
|
496
|
+
const nextW = currentRefVB.width / nextZoom;
|
|
497
|
+
const nextH = currentRefVB.height / nextZoom;
|
|
498
498
|
const dx = (prevW - nextW) * (cursorXRatio - 0.5);
|
|
499
499
|
const dy = (prevH - nextH) * (cursorYRatio - 0.5);
|
|
500
500
|
setPanX((prev) => prev + dx);
|
|
@@ -504,7 +504,7 @@ var BaseCanvas = forwardRef(
|
|
|
504
504
|
};
|
|
505
505
|
container.addEventListener("wheel", handleWheel, { passive: false });
|
|
506
506
|
return () => container.removeEventListener("wheel", handleWheel);
|
|
507
|
-
}, [initialViewBox
|
|
507
|
+
}, [initialViewBox, minZoom, maxZoom]);
|
|
508
508
|
const onPointerDown = (e) => {
|
|
509
509
|
dragRef.current = { pointerId: e.pointerId, x: e.clientX, y: e.clientY };
|
|
510
510
|
setDragging(true);
|
|
@@ -3759,13 +3759,48 @@ function generateOuterContour6(attr) {
|
|
|
3759
3759
|
const { length: A, width: B, height: C, glueArea } = attr;
|
|
3760
3760
|
const D = calcD2(C, B);
|
|
3761
3761
|
const kulak = glueArea ?? calcKulak2(B);
|
|
3762
|
-
const
|
|
3763
|
-
const
|
|
3762
|
+
const xFront = kulak;
|
|
3763
|
+
const xSide1 = kulak + A;
|
|
3764
|
+
const xBack = kulak + A + B;
|
|
3765
|
+
const xSide2 = kulak + 2 * A + B;
|
|
3766
|
+
const xEnd = kulak + 2 * A + 2 * B - 2;
|
|
3767
|
+
const yFoldBottom = D + C;
|
|
3768
|
+
const yNotchStart = yFoldBottom + NOTCH_Y;
|
|
3769
|
+
const yEnd = D + C + B / 2 + DIP2;
|
|
3764
3770
|
return [
|
|
3771
|
+
// Top edge
|
|
3765
3772
|
{ x: 0, y: 0 },
|
|
3766
|
-
{ x:
|
|
3767
|
-
|
|
3768
|
-
{ x:
|
|
3773
|
+
{ x: xEnd, y: 0 },
|
|
3774
|
+
// Right edge (stops at yFoldBottom)
|
|
3775
|
+
{ x: xEnd, y: yFoldBottom },
|
|
3776
|
+
// xEnd V-notch (left side only — last boundary)
|
|
3777
|
+
{ x: xEnd - NOTCH_X, y: yNotchStart },
|
|
3778
|
+
{ x: xEnd - NOTCH_X, y: yEnd },
|
|
3779
|
+
// Bottom segment → xSide2 notch
|
|
3780
|
+
{ x: xSide2 + NOTCH_X, y: yEnd },
|
|
3781
|
+
{ x: xSide2 + NOTCH_X, y: yNotchStart },
|
|
3782
|
+
{ x: xSide2, y: yFoldBottom },
|
|
3783
|
+
{ x: xSide2 - NOTCH_X, y: yNotchStart },
|
|
3784
|
+
{ x: xSide2 - NOTCH_X, y: yEnd },
|
|
3785
|
+
// Bottom segment → xBack notch
|
|
3786
|
+
{ x: xBack + NOTCH_X, y: yEnd },
|
|
3787
|
+
{ x: xBack + NOTCH_X, y: yNotchStart },
|
|
3788
|
+
{ x: xBack, y: yFoldBottom },
|
|
3789
|
+
{ x: xBack - NOTCH_X, y: yNotchStart },
|
|
3790
|
+
{ x: xBack - NOTCH_X, y: yEnd },
|
|
3791
|
+
// Bottom segment → xSide1 notch
|
|
3792
|
+
{ x: xSide1 + NOTCH_X, y: yEnd },
|
|
3793
|
+
{ x: xSide1 + NOTCH_X, y: yNotchStart },
|
|
3794
|
+
{ x: xSide1, y: yFoldBottom },
|
|
3795
|
+
{ x: xSide1 - NOTCH_X, y: yNotchStart },
|
|
3796
|
+
{ x: xSide1 - NOTCH_X, y: yEnd },
|
|
3797
|
+
// Bottom segment → xFront notch (right side only — first boundary)
|
|
3798
|
+
{ x: xFront + NOTCH_X, y: yEnd },
|
|
3799
|
+
{ x: xFront + NOTCH_X, y: yNotchStart },
|
|
3800
|
+
{ x: xFront, y: yFoldBottom },
|
|
3801
|
+
// Glue flap diagonal
|
|
3802
|
+
{ x: 0, y: yFoldBottom - kulak }
|
|
3803
|
+
// Left edge back to top
|
|
3769
3804
|
];
|
|
3770
3805
|
}
|
|
3771
3806
|
function offsetContour6(points, distance) {
|
|
@@ -4185,192 +4220,2575 @@ var MODEL_BECF_12109 = forwardRef(
|
|
|
4185
4220
|
}
|
|
4186
4221
|
);
|
|
4187
4222
|
|
|
4188
|
-
// src/
|
|
4189
|
-
|
|
4190
|
-
|
|
4191
|
-
|
|
4192
|
-
|
|
4193
|
-
|
|
4194
|
-
|
|
4195
|
-
|
|
4196
|
-
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
|
|
4201
|
-
|
|
4202
|
-
|
|
4203
|
-
const worldY = (offsetY + gy) * resolution + resolution / 2;
|
|
4204
|
-
const crossings = [];
|
|
4205
|
-
for (let i = 0, j = points.length - 1; i < points.length; j = i++) {
|
|
4206
|
-
const yi = points[i].y, yj = points[j].y;
|
|
4207
|
-
if (yi <= worldY && yj > worldY || yj <= worldY && yi > worldY) {
|
|
4208
|
-
const t = (worldY - yi) / (yj - yi);
|
|
4209
|
-
crossings.push(points[i].x + t * (points[j].x - points[i].x));
|
|
4210
|
-
}
|
|
4211
|
-
}
|
|
4212
|
-
crossings.sort((a, b) => a - b);
|
|
4213
|
-
for (let c = 0; c < crossings.length - 1; c += 2) {
|
|
4214
|
-
const startGx = Math.max(0, Math.floor((crossings[c] - offsetX * resolution) / resolution));
|
|
4215
|
-
const endGx = Math.min(w - 1, Math.ceil((crossings[c + 1] - offsetX * resolution) / resolution));
|
|
4216
|
-
for (let gx = startGx; gx <= endGx; gx++) {
|
|
4217
|
-
data[gy * w + gx] = 1;
|
|
4218
|
-
}
|
|
4219
|
-
}
|
|
4220
|
-
}
|
|
4221
|
-
return { data, width: w, height: h, offsetX, offsetY };
|
|
4222
|
-
}
|
|
4223
|
-
function canPlace(paperGrid, paperW, paperH, piece, px, py) {
|
|
4224
|
-
for (let y = 0; y < piece.height; y++) {
|
|
4225
|
-
const paperY = py + y;
|
|
4226
|
-
if (paperY < 0 || paperY >= paperH) {
|
|
4227
|
-
for (let x = 0; x < piece.width; x++) {
|
|
4228
|
-
if (piece.data[y * piece.width + x]) return false;
|
|
4229
|
-
}
|
|
4230
|
-
continue;
|
|
4231
|
-
}
|
|
4232
|
-
for (let x = 0; x < piece.width; x++) {
|
|
4233
|
-
if (!piece.data[y * piece.width + x]) continue;
|
|
4234
|
-
const paperX = px + x;
|
|
4235
|
-
if (paperX < 0 || paperX >= paperW) return false;
|
|
4236
|
-
if (paperGrid[paperY * paperW + paperX]) return false;
|
|
4237
|
-
}
|
|
4238
|
-
}
|
|
4239
|
-
return true;
|
|
4223
|
+
// src/components/dieline/bags-pillows/becf-c-12101/generate.ts
|
|
4224
|
+
var DIP3 = 15;
|
|
4225
|
+
var RIBBON_HALF_W = 9;
|
|
4226
|
+
var RIBBON_DX = 2;
|
|
4227
|
+
var RIBBON_DY = 2;
|
|
4228
|
+
var D_MAX3 = 40;
|
|
4229
|
+
function calcD3(c, b) {
|
|
4230
|
+
return Math.min(c - 2 - b / 2, D_MAX3);
|
|
4231
|
+
}
|
|
4232
|
+
function calcKulak3(b) {
|
|
4233
|
+
if (b <= 13) return b - 1;
|
|
4234
|
+
if (b <= 99) return 13;
|
|
4235
|
+
if (b <= 249) return 20;
|
|
4236
|
+
if (b <= 499) return 25;
|
|
4237
|
+
return 30;
|
|
4240
4238
|
}
|
|
4241
|
-
function
|
|
4242
|
-
|
|
4243
|
-
for (let x = 0; x < piece.width; x++) {
|
|
4244
|
-
if (piece.data[y * piece.width + x]) {
|
|
4245
|
-
paperGrid[(py + y) * paperW + (px + x)] = 1;
|
|
4246
|
-
}
|
|
4247
|
-
}
|
|
4248
|
-
}
|
|
4239
|
+
function calcX3(a) {
|
|
4240
|
+
return Math.min(a / 2, 110);
|
|
4249
4241
|
}
|
|
4250
|
-
|
|
4251
|
-
|
|
4252
|
-
|
|
4253
|
-
|
|
4254
|
-
|
|
4255
|
-
return
|
|
4242
|
+
function getAutoCalcValues3(attr) {
|
|
4243
|
+
const { length: A, width: B, height: C, glueArea } = attr;
|
|
4244
|
+
const D = calcD3(C, B);
|
|
4245
|
+
const kulak = glueArea ?? calcKulak3(B);
|
|
4246
|
+
const X = calcX3(A);
|
|
4247
|
+
return { d: D, kulak, dip: DIP3, ribbonHW: RIBBON_HALF_W, ribbonDX: RIBBON_DX, ribbonDY: RIBBON_DY, ribbonX: X };
|
|
4256
4248
|
}
|
|
4257
|
-
function
|
|
4258
|
-
|
|
4259
|
-
case "bottom":
|
|
4260
|
-
return {
|
|
4261
|
-
top: colorbarDepth + spacing,
|
|
4262
|
-
bottom: paperHeight - griper,
|
|
4263
|
-
left: spacing,
|
|
4264
|
-
right: paperWidth - spacing
|
|
4265
|
-
};
|
|
4266
|
-
case "top":
|
|
4267
|
-
return {
|
|
4268
|
-
top: griper,
|
|
4269
|
-
bottom: paperHeight - colorbarDepth - spacing,
|
|
4270
|
-
left: spacing,
|
|
4271
|
-
right: paperWidth - spacing
|
|
4272
|
-
};
|
|
4273
|
-
case "left":
|
|
4274
|
-
return {
|
|
4275
|
-
top: spacing,
|
|
4276
|
-
bottom: paperHeight - spacing,
|
|
4277
|
-
left: griper,
|
|
4278
|
-
right: paperWidth - colorbarDepth - spacing
|
|
4279
|
-
};
|
|
4280
|
-
case "right":
|
|
4281
|
-
return {
|
|
4282
|
-
top: spacing,
|
|
4283
|
-
bottom: paperHeight - spacing,
|
|
4284
|
-
left: colorbarDepth + spacing,
|
|
4285
|
-
right: paperWidth - griper
|
|
4286
|
-
};
|
|
4287
|
-
}
|
|
4249
|
+
function line7(x1, y1, x2, y2) {
|
|
4250
|
+
return `M${x1} ${y1} L${x2} ${y2}`;
|
|
4288
4251
|
}
|
|
4289
|
-
function
|
|
4290
|
-
const
|
|
4291
|
-
const
|
|
4292
|
-
const
|
|
4293
|
-
const
|
|
4294
|
-
|
|
4295
|
-
|
|
4296
|
-
|
|
4297
|
-
|
|
4298
|
-
|
|
4299
|
-
|
|
4300
|
-
|
|
4301
|
-
|
|
4302
|
-
|
|
4252
|
+
function generateBecfC12101(attr) {
|
|
4253
|
+
const { length: A, width: B, height: C, glueArea } = attr;
|
|
4254
|
+
const D = calcD3(C, B);
|
|
4255
|
+
const kulak = glueArea ?? calcKulak3(B);
|
|
4256
|
+
const X = calcX3(A);
|
|
4257
|
+
const xFront = kulak;
|
|
4258
|
+
const xSide1 = kulak + A;
|
|
4259
|
+
const xSide1Mid = kulak + A + B / 2;
|
|
4260
|
+
const xBack = kulak + A + B;
|
|
4261
|
+
const xSide2 = kulak + 2 * A + B;
|
|
4262
|
+
const xSide2Mid = kulak + 2 * A + B + B / 2;
|
|
4263
|
+
const xEnd = kulak + 2 * A + 2 * B - 2;
|
|
4264
|
+
const yFoldTop = D;
|
|
4265
|
+
const yFoldBottomStart = D + C - B / 2;
|
|
4266
|
+
const yFoldBottom = D + C;
|
|
4267
|
+
const yBottomFlap = D + C + B / 2;
|
|
4268
|
+
const yEnd = D + C + B / 2 + DIP3;
|
|
4269
|
+
const totalWidth = xEnd;
|
|
4270
|
+
const totalHeight = yEnd;
|
|
4271
|
+
const cut = [];
|
|
4272
|
+
const crease = [];
|
|
4273
|
+
cut.push(line7(0, 0, totalWidth, 0));
|
|
4274
|
+
cut.push(line7(totalWidth, 0, totalWidth, totalHeight));
|
|
4275
|
+
cut.push(line7(totalWidth, totalHeight, 0, totalHeight));
|
|
4276
|
+
cut.push(line7(0, totalHeight, 0, 0));
|
|
4277
|
+
cut.push(line7(kulak + B / 2, yBottomFlap, kulak + B / 2, yEnd));
|
|
4278
|
+
cut.push(line7(kulak + A - B / 2, yBottomFlap, kulak + A - B / 2, yEnd));
|
|
4279
|
+
cut.push(line7(kulak + A + B + B / 2, yBottomFlap, kulak + A + B + B / 2, yEnd));
|
|
4280
|
+
cut.push(line7(kulak + 2 * A + B - B / 2, yBottomFlap, kulak + 2 * A + B - B / 2, yEnd));
|
|
4281
|
+
const frontCx = kulak + A / 2;
|
|
4282
|
+
const backCx = kulak + A + B + A / 2;
|
|
4283
|
+
const yNotchTop = yFoldTop - RIBBON_DY / 2;
|
|
4284
|
+
const yNotchBot = yFoldTop + RIBBON_DY / 2;
|
|
4285
|
+
function addRibbonNotch(cx) {
|
|
4286
|
+
cut.push(line7(cx - RIBBON_HALF_W, yNotchBot, cx + RIBBON_HALF_W, yNotchBot));
|
|
4287
|
+
cut.push(line7(cx - RIBBON_HALF_W - RIBBON_DX, yNotchTop, cx - RIBBON_HALF_W, yNotchBot));
|
|
4288
|
+
cut.push(line7(cx + RIBBON_HALF_W + RIBBON_DX, yNotchTop, cx + RIBBON_HALF_W, yNotchBot));
|
|
4289
|
+
}
|
|
4290
|
+
addRibbonNotch(frontCx - X / 2);
|
|
4291
|
+
addRibbonNotch(frontCx + X / 2);
|
|
4292
|
+
addRibbonNotch(backCx - X / 2);
|
|
4293
|
+
addRibbonNotch(backCx + X / 2);
|
|
4294
|
+
crease.push(line7(0, yFoldTop, totalWidth, yFoldTop));
|
|
4295
|
+
crease.push(line7(0, yFoldBottomStart, totalWidth, yFoldBottomStart));
|
|
4296
|
+
crease.push(line7(0, yFoldBottom, totalWidth, yFoldBottom));
|
|
4297
|
+
crease.push(line7(xFront, 0, xFront, totalHeight));
|
|
4298
|
+
crease.push(line7(xSide1, 0, xSide1, totalHeight));
|
|
4299
|
+
crease.push(line7(xSide1Mid, 0, xSide1Mid, totalHeight));
|
|
4300
|
+
crease.push(line7(xBack, 0, xBack, totalHeight));
|
|
4301
|
+
crease.push(line7(xSide2, 0, xSide2, totalHeight));
|
|
4302
|
+
crease.push(line7(xSide2Mid, 0, xSide2Mid, totalHeight));
|
|
4303
|
+
crease.push(line7(0, yFoldBottom - kulak, kulak + B / 2, yBottomFlap));
|
|
4304
|
+
crease.push(line7(kulak + A - B / 2, yBottomFlap, xSide1Mid, yFoldBottomStart));
|
|
4305
|
+
crease.push(line7(xSide1Mid, yFoldBottomStart, kulak + A + B + B / 2, yBottomFlap));
|
|
4306
|
+
crease.push(line7(kulak + 2 * A + B - B / 2, yBottomFlap, xSide2Mid, yFoldBottomStart));
|
|
4307
|
+
crease.push(line7(xSide2Mid, yFoldBottomStart, xEnd, D + C - 2));
|
|
4308
|
+
return { cut, crease, viewBox: { width: totalWidth, height: totalHeight } };
|
|
4303
4309
|
}
|
|
4304
|
-
function
|
|
4305
|
-
const
|
|
4306
|
-
const
|
|
4307
|
-
const
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
let dlMinX = Infinity, dlMinY = Infinity;
|
|
4317
|
-
for (const [cx, cy] of corners) {
|
|
4318
|
-
const rx = cx * cos - cy * sin;
|
|
4319
|
-
const ry = cx * sin + cy * cos;
|
|
4320
|
-
if (rx < dlMinX) dlMinX = rx;
|
|
4321
|
-
if (ry < dlMinY) dlMinY = ry;
|
|
4322
|
-
}
|
|
4323
|
-
return { dx: dlMinX - ocMinX, dy: dlMinY - ocMinY };
|
|
4310
|
+
function generateOuterContour7(attr) {
|
|
4311
|
+
const { length: A, width: B, height: C, glueArea } = attr;
|
|
4312
|
+
const D = calcD3(C, B);
|
|
4313
|
+
const kulak = glueArea ?? calcKulak3(B);
|
|
4314
|
+
const totalWidth = kulak + 2 * A + 2 * B - 2;
|
|
4315
|
+
const totalHeight = D + C + B / 2 + DIP3;
|
|
4316
|
+
return [
|
|
4317
|
+
{ x: 0, y: 0 },
|
|
4318
|
+
{ x: totalWidth, y: 0 },
|
|
4319
|
+
{ x: totalWidth, y: totalHeight },
|
|
4320
|
+
{ x: 0, y: totalHeight }
|
|
4321
|
+
];
|
|
4324
4322
|
}
|
|
4325
|
-
function
|
|
4326
|
-
const
|
|
4327
|
-
const
|
|
4328
|
-
|
|
4329
|
-
|
|
4330
|
-
|
|
4331
|
-
|
|
4332
|
-
|
|
4333
|
-
|
|
4334
|
-
|
|
4335
|
-
|
|
4336
|
-
|
|
4337
|
-
const
|
|
4338
|
-
|
|
4339
|
-
|
|
4340
|
-
|
|
4341
|
-
const placements = [];
|
|
4342
|
-
const gridPositions = [];
|
|
4343
|
-
for (let py = usableTop; py <= usableBottom - pieceBitmap.height; py++) {
|
|
4344
|
-
for (let px = usableLeft; px <= usableRight - pieceBitmap.width; px++) {
|
|
4345
|
-
if (canPlace(paperGrid, paperW, paperH, pieceBitmap, px, py)) {
|
|
4346
|
-
placePiece(paperGrid, paperW, pieceBitmap, px, py);
|
|
4347
|
-
gridPositions.push({ px, py });
|
|
4348
|
-
placements.push({
|
|
4349
|
-
x: px * RESOLUTION + bbOffset.dx,
|
|
4350
|
-
y: py * RESOLUTION + bbOffset.dy,
|
|
4351
|
-
rotation: deg
|
|
4352
|
-
});
|
|
4353
|
-
}
|
|
4354
|
-
}
|
|
4323
|
+
function offsetContour7(points, distance) {
|
|
4324
|
+
const n = points.length;
|
|
4325
|
+
const result = [];
|
|
4326
|
+
for (let i = 0; i < n; i++) {
|
|
4327
|
+
const prev = points[(i - 1 + n) % n];
|
|
4328
|
+
const curr = points[i];
|
|
4329
|
+
const next = points[(i + 1) % n];
|
|
4330
|
+
const e1x = curr.x - prev.x;
|
|
4331
|
+
const e1y = curr.y - prev.y;
|
|
4332
|
+
const e2x = next.x - curr.x;
|
|
4333
|
+
const e2y = next.y - curr.y;
|
|
4334
|
+
const len1 = Math.sqrt(e1x * e1x + e1y * e1y);
|
|
4335
|
+
const len2 = Math.sqrt(e2x * e2x + e2y * e2y);
|
|
4336
|
+
if (len1 === 0 || len2 === 0) {
|
|
4337
|
+
result.push(curr);
|
|
4338
|
+
continue;
|
|
4355
4339
|
}
|
|
4356
|
-
|
|
4357
|
-
|
|
4358
|
-
|
|
4359
|
-
|
|
4360
|
-
|
|
4340
|
+
const n1x = e1y / len1;
|
|
4341
|
+
const n1y = -e1x / len1;
|
|
4342
|
+
const n2x = e2y / len2;
|
|
4343
|
+
const n2y = -e2x / len2;
|
|
4344
|
+
const ax = n1x + n2x;
|
|
4345
|
+
const ay = n1y + n2y;
|
|
4346
|
+
const aLen = Math.sqrt(ax * ax + ay * ay);
|
|
4347
|
+
if (aLen < 1e-3) {
|
|
4348
|
+
result.push({ x: curr.x + n1x * distance, y: curr.y + n1y * distance });
|
|
4349
|
+
continue;
|
|
4361
4350
|
}
|
|
4351
|
+
const nx = ax / aLen;
|
|
4352
|
+
const ny = ay / aLen;
|
|
4353
|
+
const dot = n1x * nx + n1y * ny;
|
|
4354
|
+
const d = distance / Math.max(dot, 0.1);
|
|
4355
|
+
result.push({ x: curr.x + nx * d, y: curr.y + ny * d });
|
|
4362
4356
|
}
|
|
4363
|
-
|
|
4364
|
-
|
|
4365
|
-
|
|
4366
|
-
|
|
4367
|
-
|
|
4368
|
-
|
|
4369
|
-
|
|
4370
|
-
|
|
4371
|
-
|
|
4372
|
-
|
|
4373
|
-
|
|
4357
|
+
return result;
|
|
4358
|
+
}
|
|
4359
|
+
function contourToPath7(points) {
|
|
4360
|
+
if (points.length === 0) return "";
|
|
4361
|
+
let d = `M${points[0].x} ${points[0].y}`;
|
|
4362
|
+
for (let i = 1; i < points.length; i++) {
|
|
4363
|
+
d += ` L${points[i].x} ${points[i].y}`;
|
|
4364
|
+
}
|
|
4365
|
+
d += " Z";
|
|
4366
|
+
return d;
|
|
4367
|
+
}
|
|
4368
|
+
function generateDimensions7(attr, unit) {
|
|
4369
|
+
const { length: A, width: B, height: C, glueArea } = attr;
|
|
4370
|
+
const D = calcD3(C, B);
|
|
4371
|
+
const kulak = glueArea ?? calcKulak3(B);
|
|
4372
|
+
const factor = unit === "cm" ? 0.1 : unit === "in" ? 1 / 25.4 : 1;
|
|
4373
|
+
const suffix = unit;
|
|
4374
|
+
const fmt = (v) => `${(v * factor).toFixed(2)} ${suffix}`;
|
|
4375
|
+
const xFront = kulak;
|
|
4376
|
+
const xSide1 = kulak + A;
|
|
4377
|
+
const xBack = kulak + A + B;
|
|
4378
|
+
const yFoldTop = D;
|
|
4379
|
+
const yFoldBottom = D + C;
|
|
4380
|
+
const yEnd = D + C + B / 2 + DIP3;
|
|
4381
|
+
const totalWidth = kulak + 2 * A + 2 * B - 2;
|
|
4382
|
+
const totalHeight = yEnd;
|
|
4383
|
+
const bottomSection = B / 2 + DIP3;
|
|
4384
|
+
return [
|
|
4385
|
+
{
|
|
4386
|
+
x1: 0,
|
|
4387
|
+
y1: 0,
|
|
4388
|
+
x2: totalWidth,
|
|
4389
|
+
y2: 0,
|
|
4390
|
+
label: `Overall Width : ${fmt(totalWidth)}`,
|
|
4391
|
+
orientation: "horizontal",
|
|
4392
|
+
offset: -12
|
|
4393
|
+
},
|
|
4394
|
+
{
|
|
4395
|
+
x1: 0,
|
|
4396
|
+
y1: 0,
|
|
4397
|
+
x2: 0,
|
|
4398
|
+
y2: totalHeight,
|
|
4399
|
+
label: `Overall Height : ${fmt(totalHeight)}`,
|
|
4400
|
+
orientation: "vertical",
|
|
4401
|
+
offset: -12
|
|
4402
|
+
},
|
|
4403
|
+
{
|
|
4404
|
+
x1: xBack + A * 0.6,
|
|
4405
|
+
y1: yFoldTop,
|
|
4406
|
+
x2: xBack + A * 0.6,
|
|
4407
|
+
y2: yFoldBottom,
|
|
4408
|
+
label: fmt(C),
|
|
4409
|
+
orientation: "vertical",
|
|
4410
|
+
offset: -10
|
|
4411
|
+
},
|
|
4412
|
+
{
|
|
4413
|
+
x1: xBack + A * 0.6,
|
|
4414
|
+
y1: 0,
|
|
4415
|
+
x2: xBack + A * 0.6,
|
|
4416
|
+
y2: yFoldTop,
|
|
4417
|
+
label: fmt(D),
|
|
4418
|
+
orientation: "vertical",
|
|
4419
|
+
offset: -10
|
|
4420
|
+
},
|
|
4421
|
+
{
|
|
4422
|
+
x1: xBack + A * 0.6,
|
|
4423
|
+
y1: yFoldBottom,
|
|
4424
|
+
x2: xBack + A * 0.6,
|
|
4425
|
+
y2: yEnd,
|
|
4426
|
+
label: fmt(bottomSection),
|
|
4427
|
+
orientation: "vertical",
|
|
4428
|
+
offset: -10
|
|
4429
|
+
},
|
|
4430
|
+
{
|
|
4431
|
+
x1: xFront,
|
|
4432
|
+
y1: yFoldTop + C * 0.65,
|
|
4433
|
+
x2: xSide1,
|
|
4434
|
+
y2: yFoldTop + C * 0.65,
|
|
4435
|
+
label: fmt(A),
|
|
4436
|
+
orientation: "horizontal",
|
|
4437
|
+
offset: -20
|
|
4438
|
+
},
|
|
4439
|
+
{
|
|
4440
|
+
x1: xSide1,
|
|
4441
|
+
y1: yFoldTop + C * 0.65,
|
|
4442
|
+
x2: xBack,
|
|
4443
|
+
y2: yFoldTop + C * 0.65,
|
|
4444
|
+
label: fmt(B),
|
|
4445
|
+
orientation: "horizontal",
|
|
4446
|
+
offset: -20
|
|
4447
|
+
},
|
|
4448
|
+
{
|
|
4449
|
+
x1: 0,
|
|
4450
|
+
y1: yFoldTop + C * 0.65,
|
|
4451
|
+
x2: xFront,
|
|
4452
|
+
y2: yFoldTop + C * 0.65,
|
|
4453
|
+
label: fmt(kulak),
|
|
4454
|
+
orientation: "horizontal",
|
|
4455
|
+
offset: -20
|
|
4456
|
+
}
|
|
4457
|
+
];
|
|
4458
|
+
}
|
|
4459
|
+
var MODEL_ID7 = "BECF-C-12101";
|
|
4460
|
+
var UNIT_FACTOR7 = {
|
|
4461
|
+
mm: 1,
|
|
4462
|
+
cm: 0.1,
|
|
4463
|
+
in: 1 / 25.4
|
|
4464
|
+
};
|
|
4465
|
+
var PX_PER_MM7 = 96 / 25.4;
|
|
4466
|
+
function renderDimension7(dim, i, fs) {
|
|
4467
|
+
const { x1, y1, x2, y2, label, orientation, offset } = dim;
|
|
4468
|
+
const tick = 1.5;
|
|
4469
|
+
if (orientation === "horizontal") {
|
|
4470
|
+
const y = y1 + offset;
|
|
4471
|
+
const midX = (x1 + x2) / 2;
|
|
4472
|
+
return /* @__PURE__ */ jsxs("g", { children: [
|
|
4473
|
+
/* @__PURE__ */ jsx("line", { x1, y1: y, x2, y2: y, stroke: "#000", strokeWidth: 0.2 }),
|
|
4474
|
+
/* @__PURE__ */ jsx("line", { x1, y1: y - tick, x2: x1, y2: y + tick, stroke: "#000", strokeWidth: 0.3 }),
|
|
4475
|
+
/* @__PURE__ */ jsx("line", { x1: x2, y1: y - tick, x2, y2: y + tick, stroke: "#000", strokeWidth: 0.3 }),
|
|
4476
|
+
/* @__PURE__ */ jsx(
|
|
4477
|
+
"text",
|
|
4478
|
+
{
|
|
4479
|
+
x: midX,
|
|
4480
|
+
y: y - 1.5,
|
|
4481
|
+
textAnchor: "middle",
|
|
4482
|
+
fontSize: fs,
|
|
4483
|
+
fontFamily: "sans-serif",
|
|
4484
|
+
fill: "#000",
|
|
4485
|
+
children: label
|
|
4486
|
+
}
|
|
4487
|
+
)
|
|
4488
|
+
] }, `dim-${i}`);
|
|
4489
|
+
}
|
|
4490
|
+
const x = x1 + offset;
|
|
4491
|
+
const midY = (y1 + y2) / 2;
|
|
4492
|
+
return /* @__PURE__ */ jsxs("g", { children: [
|
|
4493
|
+
/* @__PURE__ */ jsx("line", { x1: x, y1, x2: x, y2, stroke: "#000", strokeWidth: 0.2 }),
|
|
4494
|
+
/* @__PURE__ */ jsx("line", { x1: x - tick, y1, x2: x + tick, y2: y1, stroke: "#000", strokeWidth: 0.3 }),
|
|
4495
|
+
/* @__PURE__ */ jsx("line", { x1: x - tick, y1: y2, x2: x + tick, y2, stroke: "#000", strokeWidth: 0.3 }),
|
|
4496
|
+
/* @__PURE__ */ jsx(
|
|
4497
|
+
"text",
|
|
4498
|
+
{
|
|
4499
|
+
x: x - 1.5,
|
|
4500
|
+
y: midY - 1,
|
|
4501
|
+
textAnchor: "middle",
|
|
4502
|
+
dominantBaseline: "central",
|
|
4503
|
+
fontSize: fs,
|
|
4504
|
+
fontFamily: "sans-serif",
|
|
4505
|
+
fill: "#000",
|
|
4506
|
+
transform: `rotate(-90, ${x - 1.5}, ${midY})`,
|
|
4507
|
+
children: label
|
|
4508
|
+
}
|
|
4509
|
+
)
|
|
4510
|
+
] }, `dim-${i}`);
|
|
4511
|
+
}
|
|
4512
|
+
var DIE_LINE_BECF_C_12101 = forwardRef(
|
|
4513
|
+
({
|
|
4514
|
+
attributes,
|
|
4515
|
+
unit = "mm",
|
|
4516
|
+
isShowDimensions = false,
|
|
4517
|
+
renderAs = "svg"
|
|
4518
|
+
}, ref) => {
|
|
4519
|
+
const theme = useMemo(
|
|
4520
|
+
() => getModelTheme(),
|
|
4521
|
+
[]
|
|
4522
|
+
);
|
|
4523
|
+
const svgRef = useRef(null);
|
|
4524
|
+
const dieline = useMemo(() => generateBecfC12101(attributes), [attributes]);
|
|
4525
|
+
const dimensions = useMemo(
|
|
4526
|
+
() => generateDimensions7(attributes, unit),
|
|
4527
|
+
[attributes, unit]
|
|
4528
|
+
);
|
|
4529
|
+
const factor = UNIT_FACTOR7[unit] ?? 1;
|
|
4530
|
+
const serializeSvg = useCallback(
|
|
4531
|
+
(showDimensions) => {
|
|
4532
|
+
const svg = svgRef.current;
|
|
4533
|
+
if (!svg) throw new Error("SVG not mounted");
|
|
4534
|
+
const clone = svg.cloneNode(true);
|
|
4535
|
+
if (!showDimensions) {
|
|
4536
|
+
const dimGroup = clone.querySelector("#dimensions");
|
|
4537
|
+
dimGroup?.remove();
|
|
4538
|
+
}
|
|
4539
|
+
return new XMLSerializer().serializeToString(clone);
|
|
4540
|
+
},
|
|
4541
|
+
[]
|
|
4542
|
+
);
|
|
4543
|
+
useImperativeHandle(
|
|
4544
|
+
ref,
|
|
4545
|
+
() => {
|
|
4546
|
+
const auto = getAutoCalcValues3(attributes);
|
|
4547
|
+
return {
|
|
4548
|
+
getAttributes: () => ({
|
|
4549
|
+
modelId: MODEL_ID7,
|
|
4550
|
+
overallWidth: dieline.viewBox.width * factor,
|
|
4551
|
+
overallHeight: dieline.viewBox.height * factor,
|
|
4552
|
+
length: attributes.length * factor,
|
|
4553
|
+
width: attributes.width * factor,
|
|
4554
|
+
height: attributes.height * factor,
|
|
4555
|
+
glueArea: auto.kulak * factor,
|
|
4556
|
+
d: auto.d * factor,
|
|
4557
|
+
kulak: auto.kulak * factor,
|
|
4558
|
+
dip: auto.dip * factor,
|
|
4559
|
+
ribbonHW: auto.ribbonHW * factor,
|
|
4560
|
+
ribbonDX: auto.ribbonDX * factor,
|
|
4561
|
+
ribbonDY: auto.ribbonDY * factor,
|
|
4562
|
+
ribbonX: auto.ribbonX * factor
|
|
4563
|
+
}),
|
|
4564
|
+
exportImage: async (options) => {
|
|
4565
|
+
const svgStr = serializeSvg(options.isShowDimension);
|
|
4566
|
+
const blob = new Blob([svgStr], {
|
|
4567
|
+
type: "image/svg+xml;charset=utf-8"
|
|
4568
|
+
});
|
|
4569
|
+
const url = URL.createObjectURL(blob);
|
|
4570
|
+
const img = new Image();
|
|
4571
|
+
await new Promise((resolve, reject) => {
|
|
4572
|
+
img.onload = () => resolve();
|
|
4573
|
+
img.onerror = reject;
|
|
4574
|
+
img.src = url;
|
|
4575
|
+
});
|
|
4576
|
+
const canvas = document.createElement("canvas");
|
|
4577
|
+
if (options.originalSize) {
|
|
4578
|
+
canvas.width = Math.round(dieline.viewBox.width * PX_PER_MM7);
|
|
4579
|
+
canvas.height = Math.round(dieline.viewBox.height * PX_PER_MM7);
|
|
4580
|
+
} else {
|
|
4581
|
+
canvas.width = 1920;
|
|
4582
|
+
canvas.height = 1080;
|
|
4583
|
+
}
|
|
4584
|
+
const ctx = canvas.getContext("2d");
|
|
4585
|
+
ctx.fillStyle = "#ffffff";
|
|
4586
|
+
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
|
4587
|
+
ctx.drawImage(img, 0, 0, canvas.width, canvas.height);
|
|
4588
|
+
URL.revokeObjectURL(url);
|
|
4589
|
+
return new Promise((resolve, reject) => {
|
|
4590
|
+
canvas.toBlob(
|
|
4591
|
+
(b) => b ? resolve(b) : reject(new Error("Export failed")),
|
|
4592
|
+
"image/png"
|
|
4593
|
+
);
|
|
4594
|
+
});
|
|
4595
|
+
},
|
|
4596
|
+
exportDimension: async () => {
|
|
4597
|
+
const dimData = generateDimensions7(attributes, unit);
|
|
4598
|
+
return exportDimensionPdf({
|
|
4599
|
+
modelId: MODEL_ID7,
|
|
4600
|
+
dieline,
|
|
4601
|
+
dimensions: dimData,
|
|
4602
|
+
attributes,
|
|
4603
|
+
unit,
|
|
4604
|
+
factor,
|
|
4605
|
+
theme
|
|
4606
|
+
});
|
|
4607
|
+
}
|
|
4608
|
+
};
|
|
4609
|
+
},
|
|
4610
|
+
[attributes, dieline, factor, unit, serializeSvg, theme]
|
|
4611
|
+
);
|
|
4612
|
+
const padding = isShowDimensions ? 15 : 0;
|
|
4613
|
+
const vbX = -padding;
|
|
4614
|
+
const vbY = -padding;
|
|
4615
|
+
const vbW = dieline.viewBox.width + padding * 2;
|
|
4616
|
+
const vbH = dieline.viewBox.height + padding * 2;
|
|
4617
|
+
const svgChildren = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4618
|
+
/* @__PURE__ */ jsx("g", { id: "crease", children: dieline.crease.map((d, i) => /* @__PURE__ */ jsx("path", { d, fill: "none", stroke: theme.colorFoldLine, strokeWidth: 0.5, strokeDasharray: "2,1" }, `c-${i}`)) }),
|
|
4619
|
+
/* @__PURE__ */ jsx("g", { id: "cut", children: dieline.cut.map((d, i) => /* @__PURE__ */ jsx("path", { d, fill: "none", stroke: theme.colorDieLine, strokeWidth: 0.5 }, `t-${i}`)) }),
|
|
4620
|
+
isShowDimensions && /* @__PURE__ */ jsx("g", { id: "dimensions", children: dimensions.map((d, i) => renderDimension7(d, i, getFontDimensionSize())) })
|
|
4621
|
+
] });
|
|
4622
|
+
if (renderAs === "group") {
|
|
4623
|
+
return /* @__PURE__ */ jsx("g", { children: svgChildren });
|
|
4624
|
+
}
|
|
4625
|
+
return /* @__PURE__ */ jsx(
|
|
4626
|
+
"svg",
|
|
4627
|
+
{
|
|
4628
|
+
ref: svgRef,
|
|
4629
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
4630
|
+
viewBox: `${vbX} ${vbY} ${vbW} ${vbH}`,
|
|
4631
|
+
preserveAspectRatio: "xMidYMid meet",
|
|
4632
|
+
style: { backgroundColor: theme.colorBackground },
|
|
4633
|
+
children: svgChildren
|
|
4634
|
+
}
|
|
4635
|
+
);
|
|
4636
|
+
}
|
|
4637
|
+
);
|
|
4638
|
+
var CANVAS_BECF_C_12101 = forwardRef(
|
|
4639
|
+
(props, ref) => {
|
|
4640
|
+
const dieLineRef = useRef(null);
|
|
4641
|
+
const canvasRef = useRef(null);
|
|
4642
|
+
const {
|
|
4643
|
+
attributes
|
|
4644
|
+
} = props;
|
|
4645
|
+
const theme = useMemo(
|
|
4646
|
+
() => getModelTheme(),
|
|
4647
|
+
[]
|
|
4648
|
+
);
|
|
4649
|
+
const dieline = useMemo(() => generateBecfC12101(attributes), [attributes]);
|
|
4650
|
+
const stablePadding = 15;
|
|
4651
|
+
const viewBox = useMemo(
|
|
4652
|
+
() => ({
|
|
4653
|
+
x: -stablePadding,
|
|
4654
|
+
y: -stablePadding,
|
|
4655
|
+
width: dieline.viewBox.width + stablePadding * 2,
|
|
4656
|
+
height: dieline.viewBox.height + stablePadding * 2
|
|
4657
|
+
}),
|
|
4658
|
+
[dieline.viewBox.width, dieline.viewBox.height]
|
|
4659
|
+
);
|
|
4660
|
+
const serializeCanvasSvg = useCallback((showDimensions) => {
|
|
4661
|
+
const svg = canvasRef.current?.getSvgElement();
|
|
4662
|
+
if (!svg) throw new Error("SVG not mounted");
|
|
4663
|
+
const clone = svg.cloneNode(true);
|
|
4664
|
+
if (!showDimensions) {
|
|
4665
|
+
const dimGroup = clone.querySelector("#dimensions");
|
|
4666
|
+
dimGroup?.remove();
|
|
4667
|
+
}
|
|
4668
|
+
return new XMLSerializer().serializeToString(clone);
|
|
4669
|
+
}, []);
|
|
4670
|
+
useImperativeHandle(ref, () => ({
|
|
4671
|
+
getAttributes: () => dieLineRef.current.getAttributes(),
|
|
4672
|
+
exportImage: async (options) => {
|
|
4673
|
+
const svgStr = serializeCanvasSvg(options.isShowDimension);
|
|
4674
|
+
const blob = new Blob([svgStr], { type: "image/svg+xml;charset=utf-8" });
|
|
4675
|
+
const url = URL.createObjectURL(blob);
|
|
4676
|
+
const img = new Image();
|
|
4677
|
+
await new Promise((resolve, reject) => {
|
|
4678
|
+
img.onload = () => resolve();
|
|
4679
|
+
img.onerror = reject;
|
|
4680
|
+
img.src = url;
|
|
4681
|
+
});
|
|
4682
|
+
const canvas = document.createElement("canvas");
|
|
4683
|
+
if (options.originalSize) {
|
|
4684
|
+
canvas.width = Math.round(dieline.viewBox.width * PX_PER_MM7);
|
|
4685
|
+
canvas.height = Math.round(dieline.viewBox.height * PX_PER_MM7);
|
|
4686
|
+
} else {
|
|
4687
|
+
canvas.width = 1920;
|
|
4688
|
+
canvas.height = 1080;
|
|
4689
|
+
}
|
|
4690
|
+
const ctx = canvas.getContext("2d");
|
|
4691
|
+
ctx.fillStyle = "#ffffff";
|
|
4692
|
+
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
|
4693
|
+
ctx.drawImage(img, 0, 0, canvas.width, canvas.height);
|
|
4694
|
+
URL.revokeObjectURL(url);
|
|
4695
|
+
return new Promise((resolve, reject) => {
|
|
4696
|
+
canvas.toBlob(
|
|
4697
|
+
(b) => b ? resolve(b) : reject(new Error("Export failed")),
|
|
4698
|
+
"image/png"
|
|
4699
|
+
);
|
|
4700
|
+
});
|
|
4701
|
+
},
|
|
4702
|
+
exportDimension: () => dieLineRef.current.exportDimension(),
|
|
4703
|
+
resetView: () => canvasRef.current?.resetView(),
|
|
4704
|
+
fitView: () => canvasRef.current?.fitView()
|
|
4705
|
+
}), [serializeCanvasSvg, dieline.viewBox.width, dieline.viewBox.height]);
|
|
4706
|
+
return /* @__PURE__ */ jsx(
|
|
4707
|
+
BaseCanvas,
|
|
4708
|
+
{
|
|
4709
|
+
ref: canvasRef,
|
|
4710
|
+
viewBox,
|
|
4711
|
+
backgroundColor: theme.colorBackground,
|
|
4712
|
+
children: /* @__PURE__ */ jsx(DIE_LINE_BECF_C_12101, { ref: dieLineRef, ...props, renderAs: "group" })
|
|
4713
|
+
}
|
|
4714
|
+
);
|
|
4715
|
+
}
|
|
4716
|
+
);
|
|
4717
|
+
var MODEL_BECF_C_12101 = forwardRef(
|
|
4718
|
+
({ mode = "DIE_LINE", ...props }, ref) => {
|
|
4719
|
+
return /* @__PURE__ */ jsx(Fragment, { children: (() => {
|
|
4720
|
+
switch (mode) {
|
|
4721
|
+
case "DIE_LINE":
|
|
4722
|
+
return /* @__PURE__ */ jsx(CANVAS_BECF_C_12101, { ref, ...props });
|
|
4723
|
+
case "3D":
|
|
4724
|
+
return null;
|
|
4725
|
+
case "AUTO_LAYOUT":
|
|
4726
|
+
return /* @__PURE__ */ jsx(DIE_LINE_BECF_C_12101, { ref, ...props });
|
|
4727
|
+
default:
|
|
4728
|
+
return null;
|
|
4729
|
+
}
|
|
4730
|
+
})() });
|
|
4731
|
+
}
|
|
4732
|
+
);
|
|
4733
|
+
|
|
4734
|
+
// src/components/dieline/bags-pillows/becf-c-12109/generate.ts
|
|
4735
|
+
var DIP4 = 13;
|
|
4736
|
+
var RIBBON_HALF_W2 = 9;
|
|
4737
|
+
var RIBBON_DX2 = 2;
|
|
4738
|
+
var RIBBON_DY2 = 2;
|
|
4739
|
+
var D_MAX4 = 40;
|
|
4740
|
+
var NOTCH_X2 = 3;
|
|
4741
|
+
var NOTCH_Y2 = 5;
|
|
4742
|
+
function calcD4(c, b) {
|
|
4743
|
+
return Math.min(c - 2 - b / 2, D_MAX4);
|
|
4744
|
+
}
|
|
4745
|
+
function calcKulak4(b) {
|
|
4746
|
+
if (b <= 13) return b - 1;
|
|
4747
|
+
if (b <= 99) return 13;
|
|
4748
|
+
if (b <= 249) return 20;
|
|
4749
|
+
if (b <= 499) return 25;
|
|
4750
|
+
return 30;
|
|
4751
|
+
}
|
|
4752
|
+
function calcX4(a) {
|
|
4753
|
+
return a / 2;
|
|
4754
|
+
}
|
|
4755
|
+
function getAutoCalcValues4(attr) {
|
|
4756
|
+
const { length: A, width: B, height: C, glueArea } = attr;
|
|
4757
|
+
const D = calcD4(C, B);
|
|
4758
|
+
const kulak = glueArea ?? calcKulak4(B);
|
|
4759
|
+
const X = calcX4(A);
|
|
4760
|
+
return { d: D, kulak, dip: DIP4, ribbonHW: RIBBON_HALF_W2, ribbonDX: RIBBON_DX2, ribbonDY: RIBBON_DY2, ribbonX: X };
|
|
4761
|
+
}
|
|
4762
|
+
function line8(x1, y1, x2, y2) {
|
|
4763
|
+
return `M${x1} ${y1} L${x2} ${y2}`;
|
|
4764
|
+
}
|
|
4765
|
+
function generateBecfC12109(attr) {
|
|
4766
|
+
const { length: A, width: B, height: C, glueArea } = attr;
|
|
4767
|
+
const D = calcD4(C, B);
|
|
4768
|
+
const kulak = glueArea ?? calcKulak4(B);
|
|
4769
|
+
const X = calcX4(A);
|
|
4770
|
+
const xFront = kulak;
|
|
4771
|
+
const xSide1 = kulak + A;
|
|
4772
|
+
const xSide1Mid = kulak + A + B / 2;
|
|
4773
|
+
const xBack = kulak + A + B;
|
|
4774
|
+
const xSide2 = kulak + 2 * A + B;
|
|
4775
|
+
const xSide2Mid = kulak + 2 * A + B + B / 2;
|
|
4776
|
+
const xEnd = kulak + 2 * A + 2 * B - 2;
|
|
4777
|
+
const yFoldTop = D;
|
|
4778
|
+
const yFoldBottomStart = D + C - B / 2;
|
|
4779
|
+
const yFoldBottom = D + C;
|
|
4780
|
+
const yNotchStart = yFoldBottom + NOTCH_Y2;
|
|
4781
|
+
const yEnd = D + C + B / 2 + DIP4;
|
|
4782
|
+
const totalWidth = xEnd;
|
|
4783
|
+
const totalHeight = yEnd;
|
|
4784
|
+
const cut = [];
|
|
4785
|
+
const crease = [];
|
|
4786
|
+
cut.push(line8(0, 0, 0, yFoldBottom - kulak));
|
|
4787
|
+
cut.push(line8(0, 0, totalWidth, 0));
|
|
4788
|
+
cut.push(line8(totalWidth, 0, totalWidth, yFoldBottom));
|
|
4789
|
+
cut.push(line8(0, yFoldBottom - kulak, kulak, yFoldBottom));
|
|
4790
|
+
const boundaries = [xFront, xSide1, xBack, xSide2, xEnd];
|
|
4791
|
+
for (let i = 0; i < boundaries.length; i++) {
|
|
4792
|
+
const xb = boundaries[i];
|
|
4793
|
+
const isFirst = i === 0;
|
|
4794
|
+
const isLast = i === boundaries.length - 1;
|
|
4795
|
+
if (!isFirst) {
|
|
4796
|
+
cut.push(line8(xb - NOTCH_X2, yNotchStart, xb - NOTCH_X2, totalHeight));
|
|
4797
|
+
cut.push(line8(xb - NOTCH_X2, yNotchStart, xb, yFoldBottom));
|
|
4798
|
+
}
|
|
4799
|
+
if (!isLast) {
|
|
4800
|
+
cut.push(line8(xb + NOTCH_X2, yNotchStart, xb + NOTCH_X2, totalHeight));
|
|
4801
|
+
cut.push(line8(xb + NOTCH_X2, yNotchStart, xb, yFoldBottom));
|
|
4802
|
+
}
|
|
4803
|
+
}
|
|
4804
|
+
cut.push(line8(xFront + NOTCH_X2, totalHeight, xSide1 - NOTCH_X2, totalHeight));
|
|
4805
|
+
cut.push(line8(xSide1 + NOTCH_X2, totalHeight, xBack - NOTCH_X2, totalHeight));
|
|
4806
|
+
cut.push(line8(xBack + NOTCH_X2, totalHeight, xSide2 - NOTCH_X2, totalHeight));
|
|
4807
|
+
cut.push(line8(xSide2 + NOTCH_X2, totalHeight, xEnd - NOTCH_X2, totalHeight));
|
|
4808
|
+
const frontCx = kulak + A / 2;
|
|
4809
|
+
const backCx = kulak + A + B + A / 2;
|
|
4810
|
+
const yRibbonTop = yFoldTop - RIBBON_DY2 / 2;
|
|
4811
|
+
const yRibbonBot = yFoldTop + RIBBON_DY2 / 2;
|
|
4812
|
+
function addRibbonNotch(cx) {
|
|
4813
|
+
cut.push(line8(cx - RIBBON_HALF_W2, yRibbonBot, cx + RIBBON_HALF_W2, yRibbonBot));
|
|
4814
|
+
cut.push(line8(cx - RIBBON_HALF_W2 - RIBBON_DX2, yRibbonTop, cx - RIBBON_HALF_W2, yRibbonBot));
|
|
4815
|
+
cut.push(line8(cx + RIBBON_HALF_W2 + RIBBON_DX2, yRibbonTop, cx + RIBBON_HALF_W2, yRibbonBot));
|
|
4816
|
+
}
|
|
4817
|
+
addRibbonNotch(frontCx - X / 2);
|
|
4818
|
+
addRibbonNotch(frontCx + X / 2);
|
|
4819
|
+
addRibbonNotch(backCx - X / 2);
|
|
4820
|
+
addRibbonNotch(backCx + X / 2);
|
|
4821
|
+
crease.push(line8(0, yFoldTop, totalWidth, yFoldTop));
|
|
4822
|
+
crease.push(line8(0, yFoldBottomStart, totalWidth, yFoldBottomStart));
|
|
4823
|
+
crease.push(line8(kulak, yFoldBottom, xEnd, yFoldBottom));
|
|
4824
|
+
crease.push(line8(xFront, 0, xFront, yFoldBottom));
|
|
4825
|
+
crease.push(line8(xSide1, 0, xSide1, yFoldBottom));
|
|
4826
|
+
crease.push(line8(xBack, 0, xBack, yFoldBottom));
|
|
4827
|
+
crease.push(line8(xSide2, 0, xSide2, yFoldBottom));
|
|
4828
|
+
crease.push(line8(xSide1Mid, 0, xSide1Mid, totalHeight));
|
|
4829
|
+
crease.push(line8(xSide2Mid, 0, xSide2Mid, totalHeight));
|
|
4830
|
+
crease.push(line8(xBack, yFoldBottom, xSide1Mid, yFoldBottomStart));
|
|
4831
|
+
crease.push(line8(xSide1Mid, yFoldBottomStart, xSide1, yFoldBottom));
|
|
4832
|
+
crease.push(line8(xSide2Mid, yFoldBottomStart, xSide2, yFoldBottom));
|
|
4833
|
+
crease.push(line8(xSide2Mid, yFoldBottomStart, xEnd, D + C - 2));
|
|
4834
|
+
return { cut, crease, viewBox: { width: totalWidth, height: totalHeight } };
|
|
4835
|
+
}
|
|
4836
|
+
function generateOuterContour8(attr) {
|
|
4837
|
+
const { length: A, width: B, height: C, glueArea } = attr;
|
|
4838
|
+
const D = calcD4(C, B);
|
|
4839
|
+
const kulak = glueArea ?? calcKulak4(B);
|
|
4840
|
+
const xFront = kulak;
|
|
4841
|
+
const xSide1 = kulak + A;
|
|
4842
|
+
const xBack = kulak + A + B;
|
|
4843
|
+
const xSide2 = kulak + 2 * A + B;
|
|
4844
|
+
const xEnd = kulak + 2 * A + 2 * B - 2;
|
|
4845
|
+
const yFoldBottom = D + C;
|
|
4846
|
+
const yNotchStart = yFoldBottom + NOTCH_Y2;
|
|
4847
|
+
const yEnd = D + C + B / 2 + DIP4;
|
|
4848
|
+
return [
|
|
4849
|
+
{ x: 0, y: 0 },
|
|
4850
|
+
{ x: xEnd, y: 0 },
|
|
4851
|
+
{ x: xEnd, y: yFoldBottom },
|
|
4852
|
+
{ x: xEnd - NOTCH_X2, y: yNotchStart },
|
|
4853
|
+
{ x: xEnd - NOTCH_X2, y: yEnd },
|
|
4854
|
+
{ x: xSide2 + NOTCH_X2, y: yEnd },
|
|
4855
|
+
{ x: xSide2 + NOTCH_X2, y: yNotchStart },
|
|
4856
|
+
{ x: xSide2, y: yFoldBottom },
|
|
4857
|
+
{ x: xSide2 - NOTCH_X2, y: yNotchStart },
|
|
4858
|
+
{ x: xSide2 - NOTCH_X2, y: yEnd },
|
|
4859
|
+
{ x: xBack + NOTCH_X2, y: yEnd },
|
|
4860
|
+
{ x: xBack + NOTCH_X2, y: yNotchStart },
|
|
4861
|
+
{ x: xBack, y: yFoldBottom },
|
|
4862
|
+
{ x: xBack - NOTCH_X2, y: yNotchStart },
|
|
4863
|
+
{ x: xBack - NOTCH_X2, y: yEnd },
|
|
4864
|
+
{ x: xSide1 + NOTCH_X2, y: yEnd },
|
|
4865
|
+
{ x: xSide1 + NOTCH_X2, y: yNotchStart },
|
|
4866
|
+
{ x: xSide1, y: yFoldBottom },
|
|
4867
|
+
{ x: xSide1 - NOTCH_X2, y: yNotchStart },
|
|
4868
|
+
{ x: xSide1 - NOTCH_X2, y: yEnd },
|
|
4869
|
+
{ x: xFront + NOTCH_X2, y: yEnd },
|
|
4870
|
+
{ x: xFront + NOTCH_X2, y: yNotchStart },
|
|
4871
|
+
{ x: xFront, y: yFoldBottom },
|
|
4872
|
+
{ x: 0, y: yFoldBottom - kulak }
|
|
4873
|
+
];
|
|
4874
|
+
}
|
|
4875
|
+
function offsetContour8(points, distance) {
|
|
4876
|
+
const n = points.length;
|
|
4877
|
+
const result = [];
|
|
4878
|
+
for (let i = 0; i < n; i++) {
|
|
4879
|
+
const prev = points[(i - 1 + n) % n];
|
|
4880
|
+
const curr = points[i];
|
|
4881
|
+
const next = points[(i + 1) % n];
|
|
4882
|
+
const e1x = curr.x - prev.x;
|
|
4883
|
+
const e1y = curr.y - prev.y;
|
|
4884
|
+
const e2x = next.x - curr.x;
|
|
4885
|
+
const e2y = next.y - curr.y;
|
|
4886
|
+
const len1 = Math.sqrt(e1x * e1x + e1y * e1y);
|
|
4887
|
+
const len2 = Math.sqrt(e2x * e2x + e2y * e2y);
|
|
4888
|
+
if (len1 === 0 || len2 === 0) {
|
|
4889
|
+
result.push(curr);
|
|
4890
|
+
continue;
|
|
4891
|
+
}
|
|
4892
|
+
const n1x = e1y / len1;
|
|
4893
|
+
const n1y = -e1x / len1;
|
|
4894
|
+
const n2x = e2y / len2;
|
|
4895
|
+
const n2y = -e2x / len2;
|
|
4896
|
+
const ax = n1x + n2x;
|
|
4897
|
+
const ay = n1y + n2y;
|
|
4898
|
+
const aLen = Math.sqrt(ax * ax + ay * ay);
|
|
4899
|
+
if (aLen < 1e-3) {
|
|
4900
|
+
result.push({ x: curr.x + n1x * distance, y: curr.y + n1y * distance });
|
|
4901
|
+
continue;
|
|
4902
|
+
}
|
|
4903
|
+
const nx = ax / aLen;
|
|
4904
|
+
const ny = ay / aLen;
|
|
4905
|
+
const dot = n1x * nx + n1y * ny;
|
|
4906
|
+
const d = distance / Math.max(dot, 0.1);
|
|
4907
|
+
result.push({ x: curr.x + nx * d, y: curr.y + ny * d });
|
|
4908
|
+
}
|
|
4909
|
+
return result;
|
|
4910
|
+
}
|
|
4911
|
+
function contourToPath8(points) {
|
|
4912
|
+
if (points.length === 0) return "";
|
|
4913
|
+
let d = `M${points[0].x} ${points[0].y}`;
|
|
4914
|
+
for (let i = 1; i < points.length; i++) {
|
|
4915
|
+
d += ` L${points[i].x} ${points[i].y}`;
|
|
4916
|
+
}
|
|
4917
|
+
d += " Z";
|
|
4918
|
+
return d;
|
|
4919
|
+
}
|
|
4920
|
+
function generateDimensions8(attr, unit) {
|
|
4921
|
+
const { length: A, width: B, height: C, glueArea } = attr;
|
|
4922
|
+
const D = calcD4(C, B);
|
|
4923
|
+
const kulak = glueArea ?? calcKulak4(B);
|
|
4924
|
+
const factor = unit === "cm" ? 0.1 : unit === "in" ? 1 / 25.4 : 1;
|
|
4925
|
+
const suffix = unit;
|
|
4926
|
+
const fmt = (v) => `${(v * factor).toFixed(2)} ${suffix}`;
|
|
4927
|
+
const xFront = kulak;
|
|
4928
|
+
const xSide1 = kulak + A;
|
|
4929
|
+
const xBack = kulak + A + B;
|
|
4930
|
+
const yFoldTop = D;
|
|
4931
|
+
const yFoldBottom = D + C;
|
|
4932
|
+
const yEnd = D + C + B / 2 + DIP4;
|
|
4933
|
+
const totalWidth = kulak + 2 * A + 2 * B - 2;
|
|
4934
|
+
const totalHeight = yEnd;
|
|
4935
|
+
const bottomSection = B / 2 + DIP4;
|
|
4936
|
+
return [
|
|
4937
|
+
{
|
|
4938
|
+
x1: 0,
|
|
4939
|
+
y1: 0,
|
|
4940
|
+
x2: totalWidth,
|
|
4941
|
+
y2: 0,
|
|
4942
|
+
label: `Overall Width : ${fmt(totalWidth)}`,
|
|
4943
|
+
orientation: "horizontal",
|
|
4944
|
+
offset: -12
|
|
4945
|
+
},
|
|
4946
|
+
{
|
|
4947
|
+
x1: 0,
|
|
4948
|
+
y1: 0,
|
|
4949
|
+
x2: 0,
|
|
4950
|
+
y2: totalHeight,
|
|
4951
|
+
label: `Overall Height : ${fmt(totalHeight)}`,
|
|
4952
|
+
orientation: "vertical",
|
|
4953
|
+
offset: -12
|
|
4954
|
+
},
|
|
4955
|
+
{
|
|
4956
|
+
x1: xBack + A * 0.6,
|
|
4957
|
+
y1: yFoldTop,
|
|
4958
|
+
x2: xBack + A * 0.6,
|
|
4959
|
+
y2: yFoldBottom,
|
|
4960
|
+
label: fmt(C),
|
|
4961
|
+
orientation: "vertical",
|
|
4962
|
+
offset: -10
|
|
4963
|
+
},
|
|
4964
|
+
{
|
|
4965
|
+
x1: xBack + A * 0.6,
|
|
4966
|
+
y1: 0,
|
|
4967
|
+
x2: xBack + A * 0.6,
|
|
4968
|
+
y2: yFoldTop,
|
|
4969
|
+
label: fmt(D),
|
|
4970
|
+
orientation: "vertical",
|
|
4971
|
+
offset: -10
|
|
4972
|
+
},
|
|
4973
|
+
{
|
|
4974
|
+
x1: xBack + A * 0.6,
|
|
4975
|
+
y1: yFoldBottom,
|
|
4976
|
+
x2: xBack + A * 0.6,
|
|
4977
|
+
y2: yEnd,
|
|
4978
|
+
label: fmt(bottomSection),
|
|
4979
|
+
orientation: "vertical",
|
|
4980
|
+
offset: -10
|
|
4981
|
+
},
|
|
4982
|
+
{
|
|
4983
|
+
x1: xFront,
|
|
4984
|
+
y1: yFoldTop + C * 0.65,
|
|
4985
|
+
x2: xSide1,
|
|
4986
|
+
y2: yFoldTop + C * 0.65,
|
|
4987
|
+
label: fmt(A),
|
|
4988
|
+
orientation: "horizontal",
|
|
4989
|
+
offset: -20
|
|
4990
|
+
},
|
|
4991
|
+
{
|
|
4992
|
+
x1: xSide1,
|
|
4993
|
+
y1: yFoldTop + C * 0.65,
|
|
4994
|
+
x2: xBack,
|
|
4995
|
+
y2: yFoldTop + C * 0.65,
|
|
4996
|
+
label: fmt(B),
|
|
4997
|
+
orientation: "horizontal",
|
|
4998
|
+
offset: -20
|
|
4999
|
+
},
|
|
5000
|
+
{
|
|
5001
|
+
x1: 0,
|
|
5002
|
+
y1: yFoldTop + C * 0.65,
|
|
5003
|
+
x2: xFront,
|
|
5004
|
+
y2: yFoldTop + C * 0.65,
|
|
5005
|
+
label: fmt(kulak),
|
|
5006
|
+
orientation: "horizontal",
|
|
5007
|
+
offset: -20
|
|
5008
|
+
}
|
|
5009
|
+
];
|
|
5010
|
+
}
|
|
5011
|
+
var MODEL_ID8 = "BECF-C-12109";
|
|
5012
|
+
var UNIT_FACTOR8 = {
|
|
5013
|
+
mm: 1,
|
|
5014
|
+
cm: 0.1,
|
|
5015
|
+
in: 1 / 25.4
|
|
5016
|
+
};
|
|
5017
|
+
var PX_PER_MM8 = 96 / 25.4;
|
|
5018
|
+
function renderDimension8(dim, i, fs) {
|
|
5019
|
+
const { x1, y1, x2, y2, label, orientation, offset } = dim;
|
|
5020
|
+
const tick = 1.5;
|
|
5021
|
+
if (orientation === "horizontal") {
|
|
5022
|
+
const y = y1 + offset;
|
|
5023
|
+
const midX = (x1 + x2) / 2;
|
|
5024
|
+
return /* @__PURE__ */ jsxs("g", { children: [
|
|
5025
|
+
/* @__PURE__ */ jsx("line", { x1, y1: y, x2, y2: y, stroke: "#000", strokeWidth: 0.2 }),
|
|
5026
|
+
/* @__PURE__ */ jsx("line", { x1, y1: y - tick, x2: x1, y2: y + tick, stroke: "#000", strokeWidth: 0.3 }),
|
|
5027
|
+
/* @__PURE__ */ jsx("line", { x1: x2, y1: y - tick, x2, y2: y + tick, stroke: "#000", strokeWidth: 0.3 }),
|
|
5028
|
+
/* @__PURE__ */ jsx(
|
|
5029
|
+
"text",
|
|
5030
|
+
{
|
|
5031
|
+
x: midX,
|
|
5032
|
+
y: y - 1.5,
|
|
5033
|
+
textAnchor: "middle",
|
|
5034
|
+
fontSize: fs,
|
|
5035
|
+
fontFamily: "sans-serif",
|
|
5036
|
+
fill: "#000",
|
|
5037
|
+
children: label
|
|
5038
|
+
}
|
|
5039
|
+
)
|
|
5040
|
+
] }, `dim-${i}`);
|
|
5041
|
+
}
|
|
5042
|
+
const x = x1 + offset;
|
|
5043
|
+
const midY = (y1 + y2) / 2;
|
|
5044
|
+
return /* @__PURE__ */ jsxs("g", { children: [
|
|
5045
|
+
/* @__PURE__ */ jsx("line", { x1: x, y1, x2: x, y2, stroke: "#000", strokeWidth: 0.2 }),
|
|
5046
|
+
/* @__PURE__ */ jsx("line", { x1: x - tick, y1, x2: x + tick, y2: y1, stroke: "#000", strokeWidth: 0.3 }),
|
|
5047
|
+
/* @__PURE__ */ jsx("line", { x1: x - tick, y1: y2, x2: x + tick, y2, stroke: "#000", strokeWidth: 0.3 }),
|
|
5048
|
+
/* @__PURE__ */ jsx(
|
|
5049
|
+
"text",
|
|
5050
|
+
{
|
|
5051
|
+
x: x - 1.5,
|
|
5052
|
+
y: midY - 1,
|
|
5053
|
+
textAnchor: "middle",
|
|
5054
|
+
dominantBaseline: "central",
|
|
5055
|
+
fontSize: fs,
|
|
5056
|
+
fontFamily: "sans-serif",
|
|
5057
|
+
fill: "#000",
|
|
5058
|
+
transform: `rotate(-90, ${x - 1.5}, ${midY})`,
|
|
5059
|
+
children: label
|
|
5060
|
+
}
|
|
5061
|
+
)
|
|
5062
|
+
] }, `dim-${i}`);
|
|
5063
|
+
}
|
|
5064
|
+
var DIE_LINE_BECF_C_12109 = forwardRef(
|
|
5065
|
+
({
|
|
5066
|
+
attributes,
|
|
5067
|
+
unit = "mm",
|
|
5068
|
+
isShowDimensions = false,
|
|
5069
|
+
renderAs = "svg"
|
|
5070
|
+
}, ref) => {
|
|
5071
|
+
const theme = useMemo(
|
|
5072
|
+
() => getModelTheme(),
|
|
5073
|
+
[]
|
|
5074
|
+
);
|
|
5075
|
+
const svgRef = useRef(null);
|
|
5076
|
+
const dieline = useMemo(() => generateBecfC12109(attributes), [attributes]);
|
|
5077
|
+
const dimensions = useMemo(
|
|
5078
|
+
() => generateDimensions8(attributes, unit),
|
|
5079
|
+
[attributes, unit]
|
|
5080
|
+
);
|
|
5081
|
+
const factor = UNIT_FACTOR8[unit] ?? 1;
|
|
5082
|
+
const serializeSvg = useCallback(
|
|
5083
|
+
(showDimensions) => {
|
|
5084
|
+
const svg = svgRef.current;
|
|
5085
|
+
if (!svg) throw new Error("SVG not mounted");
|
|
5086
|
+
const clone = svg.cloneNode(true);
|
|
5087
|
+
if (!showDimensions) {
|
|
5088
|
+
const dimGroup = clone.querySelector("#dimensions");
|
|
5089
|
+
dimGroup?.remove();
|
|
5090
|
+
}
|
|
5091
|
+
return new XMLSerializer().serializeToString(clone);
|
|
5092
|
+
},
|
|
5093
|
+
[]
|
|
5094
|
+
);
|
|
5095
|
+
useImperativeHandle(
|
|
5096
|
+
ref,
|
|
5097
|
+
() => {
|
|
5098
|
+
const auto = getAutoCalcValues4(attributes);
|
|
5099
|
+
return {
|
|
5100
|
+
getAttributes: () => ({
|
|
5101
|
+
modelId: MODEL_ID8,
|
|
5102
|
+
overallWidth: dieline.viewBox.width * factor,
|
|
5103
|
+
overallHeight: dieline.viewBox.height * factor,
|
|
5104
|
+
length: attributes.length * factor,
|
|
5105
|
+
width: attributes.width * factor,
|
|
5106
|
+
height: attributes.height * factor,
|
|
5107
|
+
glueArea: auto.kulak * factor,
|
|
5108
|
+
d: auto.d * factor,
|
|
5109
|
+
kulak: auto.kulak * factor,
|
|
5110
|
+
dip: auto.dip * factor,
|
|
5111
|
+
ribbonHW: auto.ribbonHW * factor,
|
|
5112
|
+
ribbonDX: auto.ribbonDX * factor,
|
|
5113
|
+
ribbonDY: auto.ribbonDY * factor,
|
|
5114
|
+
ribbonX: auto.ribbonX * factor
|
|
5115
|
+
}),
|
|
5116
|
+
exportImage: async (options) => {
|
|
5117
|
+
const svgStr = serializeSvg(options.isShowDimension);
|
|
5118
|
+
const blob = new Blob([svgStr], {
|
|
5119
|
+
type: "image/svg+xml;charset=utf-8"
|
|
5120
|
+
});
|
|
5121
|
+
const url = URL.createObjectURL(blob);
|
|
5122
|
+
const img = new Image();
|
|
5123
|
+
await new Promise((resolve, reject) => {
|
|
5124
|
+
img.onload = () => resolve();
|
|
5125
|
+
img.onerror = reject;
|
|
5126
|
+
img.src = url;
|
|
5127
|
+
});
|
|
5128
|
+
const canvas = document.createElement("canvas");
|
|
5129
|
+
if (options.originalSize) {
|
|
5130
|
+
canvas.width = Math.round(dieline.viewBox.width * PX_PER_MM8);
|
|
5131
|
+
canvas.height = Math.round(dieline.viewBox.height * PX_PER_MM8);
|
|
5132
|
+
} else {
|
|
5133
|
+
canvas.width = 1920;
|
|
5134
|
+
canvas.height = 1080;
|
|
5135
|
+
}
|
|
5136
|
+
const ctx = canvas.getContext("2d");
|
|
5137
|
+
ctx.fillStyle = "#ffffff";
|
|
5138
|
+
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
|
5139
|
+
ctx.drawImage(img, 0, 0, canvas.width, canvas.height);
|
|
5140
|
+
URL.revokeObjectURL(url);
|
|
5141
|
+
return new Promise((resolve, reject) => {
|
|
5142
|
+
canvas.toBlob(
|
|
5143
|
+
(b) => b ? resolve(b) : reject(new Error("Export failed")),
|
|
5144
|
+
"image/png"
|
|
5145
|
+
);
|
|
5146
|
+
});
|
|
5147
|
+
},
|
|
5148
|
+
exportDimension: async () => {
|
|
5149
|
+
const dimData = generateDimensions8(attributes, unit);
|
|
5150
|
+
return exportDimensionPdf({
|
|
5151
|
+
modelId: MODEL_ID8,
|
|
5152
|
+
dieline,
|
|
5153
|
+
dimensions: dimData,
|
|
5154
|
+
attributes,
|
|
5155
|
+
unit,
|
|
5156
|
+
factor,
|
|
5157
|
+
theme
|
|
5158
|
+
});
|
|
5159
|
+
}
|
|
5160
|
+
};
|
|
5161
|
+
},
|
|
5162
|
+
[attributes, dieline, factor, unit, serializeSvg, theme]
|
|
5163
|
+
);
|
|
5164
|
+
const padding = isShowDimensions ? 15 : 0;
|
|
5165
|
+
const vbX = -padding;
|
|
5166
|
+
const vbY = -padding;
|
|
5167
|
+
const vbW = dieline.viewBox.width + padding * 2;
|
|
5168
|
+
const vbH = dieline.viewBox.height + padding * 2;
|
|
5169
|
+
const svgChildren = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
5170
|
+
/* @__PURE__ */ jsx("g", { id: "crease", children: dieline.crease.map((d, i) => /* @__PURE__ */ jsx("path", { d, fill: "none", stroke: theme.colorFoldLine, strokeWidth: 0.5, strokeDasharray: "2,1" }, `c-${i}`)) }),
|
|
5171
|
+
/* @__PURE__ */ jsx("g", { id: "cut", children: dieline.cut.map((d, i) => /* @__PURE__ */ jsx("path", { d, fill: "none", stroke: theme.colorDieLine, strokeWidth: 0.5 }, `t-${i}`)) }),
|
|
5172
|
+
isShowDimensions && /* @__PURE__ */ jsx("g", { id: "dimensions", children: dimensions.map((d, i) => renderDimension8(d, i, getFontDimensionSize())) })
|
|
5173
|
+
] });
|
|
5174
|
+
if (renderAs === "group") {
|
|
5175
|
+
return /* @__PURE__ */ jsx("g", { children: svgChildren });
|
|
5176
|
+
}
|
|
5177
|
+
return /* @__PURE__ */ jsx(
|
|
5178
|
+
"svg",
|
|
5179
|
+
{
|
|
5180
|
+
ref: svgRef,
|
|
5181
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
5182
|
+
viewBox: `${vbX} ${vbY} ${vbW} ${vbH}`,
|
|
5183
|
+
preserveAspectRatio: "xMidYMid meet",
|
|
5184
|
+
style: { backgroundColor: theme.colorBackground },
|
|
5185
|
+
children: svgChildren
|
|
5186
|
+
}
|
|
5187
|
+
);
|
|
5188
|
+
}
|
|
5189
|
+
);
|
|
5190
|
+
var CANVAS_BECF_C_12109 = forwardRef(
|
|
5191
|
+
(props, ref) => {
|
|
5192
|
+
const dieLineRef = useRef(null);
|
|
5193
|
+
const canvasRef = useRef(null);
|
|
5194
|
+
const {
|
|
5195
|
+
attributes
|
|
5196
|
+
} = props;
|
|
5197
|
+
const theme = useMemo(
|
|
5198
|
+
() => getModelTheme(),
|
|
5199
|
+
[]
|
|
5200
|
+
);
|
|
5201
|
+
const dieline = useMemo(() => generateBecfC12109(attributes), [attributes]);
|
|
5202
|
+
const stablePadding = 15;
|
|
5203
|
+
const viewBox = useMemo(
|
|
5204
|
+
() => ({
|
|
5205
|
+
x: -stablePadding,
|
|
5206
|
+
y: -stablePadding,
|
|
5207
|
+
width: dieline.viewBox.width + stablePadding * 2,
|
|
5208
|
+
height: dieline.viewBox.height + stablePadding * 2
|
|
5209
|
+
}),
|
|
5210
|
+
[dieline.viewBox.width, dieline.viewBox.height]
|
|
5211
|
+
);
|
|
5212
|
+
const serializeCanvasSvg = useCallback((showDimensions) => {
|
|
5213
|
+
const svg = canvasRef.current?.getSvgElement();
|
|
5214
|
+
if (!svg) throw new Error("SVG not mounted");
|
|
5215
|
+
const clone = svg.cloneNode(true);
|
|
5216
|
+
if (!showDimensions) {
|
|
5217
|
+
const dimGroup = clone.querySelector("#dimensions");
|
|
5218
|
+
dimGroup?.remove();
|
|
5219
|
+
}
|
|
5220
|
+
return new XMLSerializer().serializeToString(clone);
|
|
5221
|
+
}, []);
|
|
5222
|
+
useImperativeHandle(ref, () => ({
|
|
5223
|
+
getAttributes: () => dieLineRef.current.getAttributes(),
|
|
5224
|
+
exportImage: async (options) => {
|
|
5225
|
+
const svgStr = serializeCanvasSvg(options.isShowDimension);
|
|
5226
|
+
const blob = new Blob([svgStr], { type: "image/svg+xml;charset=utf-8" });
|
|
5227
|
+
const url = URL.createObjectURL(blob);
|
|
5228
|
+
const img = new Image();
|
|
5229
|
+
await new Promise((resolve, reject) => {
|
|
5230
|
+
img.onload = () => resolve();
|
|
5231
|
+
img.onerror = reject;
|
|
5232
|
+
img.src = url;
|
|
5233
|
+
});
|
|
5234
|
+
const canvas = document.createElement("canvas");
|
|
5235
|
+
if (options.originalSize) {
|
|
5236
|
+
canvas.width = Math.round(dieline.viewBox.width * PX_PER_MM8);
|
|
5237
|
+
canvas.height = Math.round(dieline.viewBox.height * PX_PER_MM8);
|
|
5238
|
+
} else {
|
|
5239
|
+
canvas.width = 1920;
|
|
5240
|
+
canvas.height = 1080;
|
|
5241
|
+
}
|
|
5242
|
+
const ctx = canvas.getContext("2d");
|
|
5243
|
+
ctx.fillStyle = "#ffffff";
|
|
5244
|
+
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
|
5245
|
+
ctx.drawImage(img, 0, 0, canvas.width, canvas.height);
|
|
5246
|
+
URL.revokeObjectURL(url);
|
|
5247
|
+
return new Promise((resolve, reject) => {
|
|
5248
|
+
canvas.toBlob(
|
|
5249
|
+
(b) => b ? resolve(b) : reject(new Error("Export failed")),
|
|
5250
|
+
"image/png"
|
|
5251
|
+
);
|
|
5252
|
+
});
|
|
5253
|
+
},
|
|
5254
|
+
exportDimension: () => dieLineRef.current.exportDimension(),
|
|
5255
|
+
resetView: () => canvasRef.current?.resetView(),
|
|
5256
|
+
fitView: () => canvasRef.current?.fitView()
|
|
5257
|
+
}), [serializeCanvasSvg, dieline.viewBox.width, dieline.viewBox.height]);
|
|
5258
|
+
return /* @__PURE__ */ jsx(
|
|
5259
|
+
BaseCanvas,
|
|
5260
|
+
{
|
|
5261
|
+
ref: canvasRef,
|
|
5262
|
+
viewBox,
|
|
5263
|
+
backgroundColor: theme.colorBackground,
|
|
5264
|
+
children: /* @__PURE__ */ jsx(DIE_LINE_BECF_C_12109, { ref: dieLineRef, ...props, renderAs: "group" })
|
|
5265
|
+
}
|
|
5266
|
+
);
|
|
5267
|
+
}
|
|
5268
|
+
);
|
|
5269
|
+
var MODEL_BECF_C_12109 = forwardRef(
|
|
5270
|
+
({ mode = "DIE_LINE", ...props }, ref) => {
|
|
5271
|
+
return /* @__PURE__ */ jsx(Fragment, { children: (() => {
|
|
5272
|
+
switch (mode) {
|
|
5273
|
+
case "DIE_LINE":
|
|
5274
|
+
return /* @__PURE__ */ jsx(CANVAS_BECF_C_12109, { ref, ...props });
|
|
5275
|
+
case "3D":
|
|
5276
|
+
return null;
|
|
5277
|
+
case "AUTO_LAYOUT":
|
|
5278
|
+
return /* @__PURE__ */ jsx(DIE_LINE_BECF_C_12109, { ref, ...props });
|
|
5279
|
+
default:
|
|
5280
|
+
return null;
|
|
5281
|
+
}
|
|
5282
|
+
})() });
|
|
5283
|
+
}
|
|
5284
|
+
);
|
|
5285
|
+
|
|
5286
|
+
// src/components/dieline/bags-pillows/becf-b-12101/generate.ts
|
|
5287
|
+
var DIP5 = 15;
|
|
5288
|
+
function calcKulak5(b) {
|
|
5289
|
+
if (b <= 13) return b - 1;
|
|
5290
|
+
if (b <= 99) return 13;
|
|
5291
|
+
if (b <= 249) return 20;
|
|
5292
|
+
if (b <= 499) return 25;
|
|
5293
|
+
return 30;
|
|
5294
|
+
}
|
|
5295
|
+
function getAutoCalcValues5(attr) {
|
|
5296
|
+
const { width: B, glueArea } = attr;
|
|
5297
|
+
const kulak = glueArea ?? calcKulak5(B);
|
|
5298
|
+
return { kulak, dip: DIP5 };
|
|
5299
|
+
}
|
|
5300
|
+
function line9(x1, y1, x2, y2) {
|
|
5301
|
+
return `M${x1} ${y1} L${x2} ${y2}`;
|
|
5302
|
+
}
|
|
5303
|
+
function generateBecfB12101(attr) {
|
|
5304
|
+
const { length: A, width: B, height: C, glueArea } = attr;
|
|
5305
|
+
const kulak = glueArea ?? calcKulak5(B);
|
|
5306
|
+
const xFront = kulak;
|
|
5307
|
+
const xSide1 = kulak + A;
|
|
5308
|
+
const xSide1Mid = kulak + A + B / 2;
|
|
5309
|
+
const xBack = kulak + A + B;
|
|
5310
|
+
const xSide2 = kulak + 2 * A + B;
|
|
5311
|
+
const xSide2Mid = kulak + 2 * A + B + B / 2;
|
|
5312
|
+
const xEnd = kulak + 2 * A + 2 * B - 2;
|
|
5313
|
+
const yFoldBottomStart = C - B / 2;
|
|
5314
|
+
const yFoldBottom = C;
|
|
5315
|
+
const yBottomFlap = C + B / 2;
|
|
5316
|
+
const yEnd = C + B / 2 + DIP5;
|
|
5317
|
+
const totalWidth = xEnd;
|
|
5318
|
+
const totalHeight = yEnd;
|
|
5319
|
+
const cut = [];
|
|
5320
|
+
const crease = [];
|
|
5321
|
+
cut.push(line9(0, 0, totalWidth, 0));
|
|
5322
|
+
cut.push(line9(totalWidth, 0, totalWidth, totalHeight));
|
|
5323
|
+
cut.push(line9(totalWidth, totalHeight, 0, totalHeight));
|
|
5324
|
+
cut.push(line9(0, totalHeight, 0, 0));
|
|
5325
|
+
cut.push(line9(kulak + B / 2, yBottomFlap, kulak + B / 2, yEnd));
|
|
5326
|
+
cut.push(line9(kulak + A - B / 2, yBottomFlap, kulak + A - B / 2, yEnd));
|
|
5327
|
+
cut.push(line9(kulak + A + B + B / 2, yBottomFlap, kulak + A + B + B / 2, yEnd));
|
|
5328
|
+
cut.push(line9(kulak + 2 * A + B - B / 2, yBottomFlap, kulak + 2 * A + B - B / 2, yEnd));
|
|
5329
|
+
crease.push(line9(0, yFoldBottomStart, totalWidth, yFoldBottomStart));
|
|
5330
|
+
crease.push(line9(0, yFoldBottom, totalWidth, yFoldBottom));
|
|
5331
|
+
crease.push(line9(xFront, 0, xFront, totalHeight));
|
|
5332
|
+
crease.push(line9(xSide1, 0, xSide1, totalHeight));
|
|
5333
|
+
crease.push(line9(xSide1Mid, 0, xSide1Mid, totalHeight));
|
|
5334
|
+
crease.push(line9(xBack, 0, xBack, totalHeight));
|
|
5335
|
+
crease.push(line9(xSide2, 0, xSide2, totalHeight));
|
|
5336
|
+
crease.push(line9(xSide2Mid, 0, xSide2Mid, totalHeight));
|
|
5337
|
+
crease.push(line9(0, yFoldBottom - kulak, kulak + B / 2, yBottomFlap));
|
|
5338
|
+
crease.push(line9(kulak + A - B / 2, yBottomFlap, xSide1Mid, yFoldBottomStart));
|
|
5339
|
+
crease.push(line9(xSide1Mid, yFoldBottomStart, kulak + A + B + B / 2, yBottomFlap));
|
|
5340
|
+
crease.push(line9(kulak + 2 * A + B - B / 2, yBottomFlap, xSide2Mid, yFoldBottomStart));
|
|
5341
|
+
crease.push(line9(xSide2Mid, yFoldBottomStart, xEnd, C - 2));
|
|
5342
|
+
return { cut, crease, viewBox: { width: totalWidth, height: totalHeight } };
|
|
5343
|
+
}
|
|
5344
|
+
function generateOuterContour9(attr) {
|
|
5345
|
+
const { length: A, width: B, height: C, glueArea } = attr;
|
|
5346
|
+
const kulak = glueArea ?? calcKulak5(B);
|
|
5347
|
+
const totalWidth = kulak + 2 * A + 2 * B - 2;
|
|
5348
|
+
const totalHeight = C + B / 2 + DIP5;
|
|
5349
|
+
return [
|
|
5350
|
+
{ x: 0, y: 0 },
|
|
5351
|
+
{ x: totalWidth, y: 0 },
|
|
5352
|
+
{ x: totalWidth, y: totalHeight },
|
|
5353
|
+
{ x: 0, y: totalHeight }
|
|
5354
|
+
];
|
|
5355
|
+
}
|
|
5356
|
+
function offsetContour9(points, distance) {
|
|
5357
|
+
const n = points.length;
|
|
5358
|
+
const result = [];
|
|
5359
|
+
for (let i = 0; i < n; i++) {
|
|
5360
|
+
const prev = points[(i - 1 + n) % n];
|
|
5361
|
+
const curr = points[i];
|
|
5362
|
+
const next = points[(i + 1) % n];
|
|
5363
|
+
const e1x = curr.x - prev.x;
|
|
5364
|
+
const e1y = curr.y - prev.y;
|
|
5365
|
+
const e2x = next.x - curr.x;
|
|
5366
|
+
const e2y = next.y - curr.y;
|
|
5367
|
+
const len1 = Math.sqrt(e1x * e1x + e1y * e1y);
|
|
5368
|
+
const len2 = Math.sqrt(e2x * e2x + e2y * e2y);
|
|
5369
|
+
if (len1 === 0 || len2 === 0) {
|
|
5370
|
+
result.push(curr);
|
|
5371
|
+
continue;
|
|
5372
|
+
}
|
|
5373
|
+
const n1x = e1y / len1;
|
|
5374
|
+
const n1y = -e1x / len1;
|
|
5375
|
+
const n2x = e2y / len2;
|
|
5376
|
+
const n2y = -e2x / len2;
|
|
5377
|
+
const ax = n1x + n2x;
|
|
5378
|
+
const ay = n1y + n2y;
|
|
5379
|
+
const aLen = Math.sqrt(ax * ax + ay * ay);
|
|
5380
|
+
if (aLen < 1e-3) {
|
|
5381
|
+
result.push({ x: curr.x + n1x * distance, y: curr.y + n1y * distance });
|
|
5382
|
+
continue;
|
|
5383
|
+
}
|
|
5384
|
+
const nx = ax / aLen;
|
|
5385
|
+
const ny = ay / aLen;
|
|
5386
|
+
const dot = n1x * nx + n1y * ny;
|
|
5387
|
+
const d = distance / Math.max(dot, 0.1);
|
|
5388
|
+
result.push({ x: curr.x + nx * d, y: curr.y + ny * d });
|
|
5389
|
+
}
|
|
5390
|
+
return result;
|
|
5391
|
+
}
|
|
5392
|
+
function contourToPath9(points) {
|
|
5393
|
+
if (points.length === 0) return "";
|
|
5394
|
+
let d = `M${points[0].x} ${points[0].y}`;
|
|
5395
|
+
for (let i = 1; i < points.length; i++) {
|
|
5396
|
+
d += ` L${points[i].x} ${points[i].y}`;
|
|
5397
|
+
}
|
|
5398
|
+
d += " Z";
|
|
5399
|
+
return d;
|
|
5400
|
+
}
|
|
5401
|
+
function generateDimensions9(attr, unit) {
|
|
5402
|
+
const { length: A, width: B, height: C, glueArea } = attr;
|
|
5403
|
+
const kulak = glueArea ?? calcKulak5(B);
|
|
5404
|
+
const factor = unit === "cm" ? 0.1 : unit === "in" ? 1 / 25.4 : 1;
|
|
5405
|
+
const suffix = unit;
|
|
5406
|
+
const fmt = (v) => `${(v * factor).toFixed(2)} ${suffix}`;
|
|
5407
|
+
const xFront = kulak;
|
|
5408
|
+
const xSide1 = kulak + A;
|
|
5409
|
+
const xBack = kulak + A + B;
|
|
5410
|
+
const yFoldBottom = C;
|
|
5411
|
+
const yEnd = C + B / 2 + DIP5;
|
|
5412
|
+
const totalWidth = kulak + 2 * A + 2 * B - 2;
|
|
5413
|
+
const totalHeight = yEnd;
|
|
5414
|
+
const bottomSection = B / 2 + DIP5;
|
|
5415
|
+
return [
|
|
5416
|
+
{
|
|
5417
|
+
x1: 0,
|
|
5418
|
+
y1: 0,
|
|
5419
|
+
x2: totalWidth,
|
|
5420
|
+
y2: 0,
|
|
5421
|
+
label: `Overall Width : ${fmt(totalWidth)}`,
|
|
5422
|
+
orientation: "horizontal",
|
|
5423
|
+
offset: -12
|
|
5424
|
+
},
|
|
5425
|
+
{
|
|
5426
|
+
x1: 0,
|
|
5427
|
+
y1: 0,
|
|
5428
|
+
x2: 0,
|
|
5429
|
+
y2: totalHeight,
|
|
5430
|
+
label: `Overall Height : ${fmt(totalHeight)}`,
|
|
5431
|
+
orientation: "vertical",
|
|
5432
|
+
offset: -12
|
|
5433
|
+
},
|
|
5434
|
+
// Height (C) — body area
|
|
5435
|
+
{
|
|
5436
|
+
x1: xBack + A * 0.6,
|
|
5437
|
+
y1: 0,
|
|
5438
|
+
x2: xBack + A * 0.6,
|
|
5439
|
+
y2: yFoldBottom,
|
|
5440
|
+
label: fmt(C),
|
|
5441
|
+
orientation: "vertical",
|
|
5442
|
+
offset: -10
|
|
5443
|
+
},
|
|
5444
|
+
// Bottom section (B/2 + DIP)
|
|
5445
|
+
{
|
|
5446
|
+
x1: xBack + A * 0.6,
|
|
5447
|
+
y1: yFoldBottom,
|
|
5448
|
+
x2: xBack + A * 0.6,
|
|
5449
|
+
y2: yEnd,
|
|
5450
|
+
label: fmt(bottomSection),
|
|
5451
|
+
orientation: "vertical",
|
|
5452
|
+
offset: -10
|
|
5453
|
+
},
|
|
5454
|
+
// Length (A)
|
|
5455
|
+
{
|
|
5456
|
+
x1: xFront,
|
|
5457
|
+
y1: C * 0.65,
|
|
5458
|
+
x2: xSide1,
|
|
5459
|
+
y2: C * 0.65,
|
|
5460
|
+
label: fmt(A),
|
|
5461
|
+
orientation: "horizontal",
|
|
5462
|
+
offset: -20
|
|
5463
|
+
},
|
|
5464
|
+
// Width (B)
|
|
5465
|
+
{
|
|
5466
|
+
x1: xSide1,
|
|
5467
|
+
y1: C * 0.65,
|
|
5468
|
+
x2: xBack,
|
|
5469
|
+
y2: C * 0.65,
|
|
5470
|
+
label: fmt(B),
|
|
5471
|
+
orientation: "horizontal",
|
|
5472
|
+
offset: -20
|
|
5473
|
+
},
|
|
5474
|
+
// Glue Area (kulak)
|
|
5475
|
+
{
|
|
5476
|
+
x1: 0,
|
|
5477
|
+
y1: C * 0.65,
|
|
5478
|
+
x2: xFront,
|
|
5479
|
+
y2: C * 0.65,
|
|
5480
|
+
label: fmt(kulak),
|
|
5481
|
+
orientation: "horizontal",
|
|
5482
|
+
offset: -20
|
|
5483
|
+
}
|
|
5484
|
+
];
|
|
5485
|
+
}
|
|
5486
|
+
var MODEL_ID9 = "BECF-B-12101";
|
|
5487
|
+
var UNIT_FACTOR9 = {
|
|
5488
|
+
mm: 1,
|
|
5489
|
+
cm: 0.1,
|
|
5490
|
+
in: 1 / 25.4
|
|
5491
|
+
};
|
|
5492
|
+
var PX_PER_MM9 = 96 / 25.4;
|
|
5493
|
+
function renderDimension9(dim, i, fs) {
|
|
5494
|
+
const { x1, y1, x2, y2, label, orientation, offset } = dim;
|
|
5495
|
+
const tick = 1.5;
|
|
5496
|
+
if (orientation === "horizontal") {
|
|
5497
|
+
const y = y1 + offset;
|
|
5498
|
+
const midX = (x1 + x2) / 2;
|
|
5499
|
+
return /* @__PURE__ */ jsxs("g", { children: [
|
|
5500
|
+
/* @__PURE__ */ jsx("line", { x1, y1: y, x2, y2: y, stroke: "#000", strokeWidth: 0.2 }),
|
|
5501
|
+
/* @__PURE__ */ jsx("line", { x1, y1: y - tick, x2: x1, y2: y + tick, stroke: "#000", strokeWidth: 0.3 }),
|
|
5502
|
+
/* @__PURE__ */ jsx("line", { x1: x2, y1: y - tick, x2, y2: y + tick, stroke: "#000", strokeWidth: 0.3 }),
|
|
5503
|
+
/* @__PURE__ */ jsx("text", { x: midX, y: y - 1.5, textAnchor: "middle", fontSize: fs, fontFamily: "sans-serif", fill: "#000", children: label })
|
|
5504
|
+
] }, `dim-${i}`);
|
|
5505
|
+
}
|
|
5506
|
+
const x = x1 + offset;
|
|
5507
|
+
const midY = (y1 + y2) / 2;
|
|
5508
|
+
return /* @__PURE__ */ jsxs("g", { children: [
|
|
5509
|
+
/* @__PURE__ */ jsx("line", { x1: x, y1, x2: x, y2, stroke: "#000", strokeWidth: 0.2 }),
|
|
5510
|
+
/* @__PURE__ */ jsx("line", { x1: x - tick, y1, x2: x + tick, y2: y1, stroke: "#000", strokeWidth: 0.3 }),
|
|
5511
|
+
/* @__PURE__ */ jsx("line", { x1: x - tick, y1: y2, x2: x + tick, y2, stroke: "#000", strokeWidth: 0.3 }),
|
|
5512
|
+
/* @__PURE__ */ jsx("text", { x: x - 1.5, y: midY - 1, textAnchor: "middle", dominantBaseline: "central", fontSize: fs, fontFamily: "sans-serif", fill: "#000", transform: `rotate(-90, ${x - 1.5}, ${midY})`, children: label })
|
|
5513
|
+
] }, `dim-${i}`);
|
|
5514
|
+
}
|
|
5515
|
+
var DIE_LINE_BECF_B_12101 = forwardRef(
|
|
5516
|
+
({ attributes, unit = "mm", isShowDimensions = false, renderAs = "svg" }, ref) => {
|
|
5517
|
+
const theme = useMemo(() => getModelTheme(), []);
|
|
5518
|
+
const svgRef = useRef(null);
|
|
5519
|
+
const dieline = useMemo(() => generateBecfB12101(attributes), [attributes]);
|
|
5520
|
+
const dimensions = useMemo(() => generateDimensions9(attributes, unit), [attributes, unit]);
|
|
5521
|
+
const factor = UNIT_FACTOR9[unit] ?? 1;
|
|
5522
|
+
const serializeSvg = useCallback((showDimensions) => {
|
|
5523
|
+
const svg = svgRef.current;
|
|
5524
|
+
if (!svg) throw new Error("SVG not mounted");
|
|
5525
|
+
const clone = svg.cloneNode(true);
|
|
5526
|
+
if (!showDimensions) {
|
|
5527
|
+
clone.querySelector("#dimensions")?.remove();
|
|
5528
|
+
}
|
|
5529
|
+
return new XMLSerializer().serializeToString(clone);
|
|
5530
|
+
}, []);
|
|
5531
|
+
useImperativeHandle(ref, () => {
|
|
5532
|
+
const auto = getAutoCalcValues5(attributes);
|
|
5533
|
+
return {
|
|
5534
|
+
getAttributes: () => ({
|
|
5535
|
+
modelId: MODEL_ID9,
|
|
5536
|
+
overallWidth: dieline.viewBox.width * factor,
|
|
5537
|
+
overallHeight: dieline.viewBox.height * factor,
|
|
5538
|
+
length: attributes.length * factor,
|
|
5539
|
+
width: attributes.width * factor,
|
|
5540
|
+
height: attributes.height * factor,
|
|
5541
|
+
glueArea: auto.kulak * factor,
|
|
5542
|
+
kulak: auto.kulak * factor,
|
|
5543
|
+
dip: auto.dip * factor
|
|
5544
|
+
}),
|
|
5545
|
+
exportImage: async (options) => {
|
|
5546
|
+
const svgStr = serializeSvg(options.isShowDimension);
|
|
5547
|
+
const blob = new Blob([svgStr], { type: "image/svg+xml;charset=utf-8" });
|
|
5548
|
+
const url = URL.createObjectURL(blob);
|
|
5549
|
+
const img = new Image();
|
|
5550
|
+
await new Promise((resolve, reject) => {
|
|
5551
|
+
img.onload = () => resolve();
|
|
5552
|
+
img.onerror = reject;
|
|
5553
|
+
img.src = url;
|
|
5554
|
+
});
|
|
5555
|
+
const canvas = document.createElement("canvas");
|
|
5556
|
+
if (options.originalSize) {
|
|
5557
|
+
canvas.width = Math.round(dieline.viewBox.width * PX_PER_MM9);
|
|
5558
|
+
canvas.height = Math.round(dieline.viewBox.height * PX_PER_MM9);
|
|
5559
|
+
} else {
|
|
5560
|
+
canvas.width = 1920;
|
|
5561
|
+
canvas.height = 1080;
|
|
5562
|
+
}
|
|
5563
|
+
const ctx = canvas.getContext("2d");
|
|
5564
|
+
ctx.fillStyle = "#ffffff";
|
|
5565
|
+
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
|
5566
|
+
ctx.drawImage(img, 0, 0, canvas.width, canvas.height);
|
|
5567
|
+
URL.revokeObjectURL(url);
|
|
5568
|
+
return new Promise((resolve, reject) => {
|
|
5569
|
+
canvas.toBlob((b) => b ? resolve(b) : reject(new Error("Export failed")), "image/png");
|
|
5570
|
+
});
|
|
5571
|
+
},
|
|
5572
|
+
exportDimension: async () => {
|
|
5573
|
+
const dimData = generateDimensions9(attributes, unit);
|
|
5574
|
+
return exportDimensionPdf({ modelId: MODEL_ID9, dieline, dimensions: dimData, attributes, unit, factor, theme });
|
|
5575
|
+
}
|
|
5576
|
+
};
|
|
5577
|
+
}, [attributes, dieline, factor, unit, serializeSvg, theme]);
|
|
5578
|
+
const padding = isShowDimensions ? 15 : 0;
|
|
5579
|
+
const vbX = -padding;
|
|
5580
|
+
const vbY = -padding;
|
|
5581
|
+
const vbW = dieline.viewBox.width + padding * 2;
|
|
5582
|
+
const vbH = dieline.viewBox.height + padding * 2;
|
|
5583
|
+
const svgChildren = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
5584
|
+
/* @__PURE__ */ jsx("g", { id: "crease", children: dieline.crease.map((d, i) => /* @__PURE__ */ jsx("path", { d, fill: "none", stroke: theme.colorFoldLine, strokeWidth: 0.5, strokeDasharray: "2,1" }, `c-${i}`)) }),
|
|
5585
|
+
/* @__PURE__ */ jsx("g", { id: "cut", children: dieline.cut.map((d, i) => /* @__PURE__ */ jsx("path", { d, fill: "none", stroke: theme.colorDieLine, strokeWidth: 0.5 }, `t-${i}`)) }),
|
|
5586
|
+
isShowDimensions && /* @__PURE__ */ jsx("g", { id: "dimensions", children: dimensions.map((d, i) => renderDimension9(d, i, getFontDimensionSize())) })
|
|
5587
|
+
] });
|
|
5588
|
+
if (renderAs === "group") return /* @__PURE__ */ jsx("g", { children: svgChildren });
|
|
5589
|
+
return /* @__PURE__ */ jsx("svg", { ref: svgRef, xmlns: "http://www.w3.org/2000/svg", viewBox: `${vbX} ${vbY} ${vbW} ${vbH}`, preserveAspectRatio: "xMidYMid meet", style: { backgroundColor: theme.colorBackground }, children: svgChildren });
|
|
5590
|
+
}
|
|
5591
|
+
);
|
|
5592
|
+
var CANVAS_BECF_B_12101 = forwardRef(
|
|
5593
|
+
(props, ref) => {
|
|
5594
|
+
const dieLineRef = useRef(null);
|
|
5595
|
+
const canvasRef = useRef(null);
|
|
5596
|
+
const { attributes } = props;
|
|
5597
|
+
const theme = useMemo(() => getModelTheme(), []);
|
|
5598
|
+
const dieline = useMemo(() => generateBecfB12101(attributes), [attributes]);
|
|
5599
|
+
const stablePadding = 15;
|
|
5600
|
+
const viewBox = useMemo(() => ({ x: -stablePadding, y: -stablePadding, width: dieline.viewBox.width + stablePadding * 2, height: dieline.viewBox.height + stablePadding * 2 }), [dieline.viewBox.width, dieline.viewBox.height]);
|
|
5601
|
+
const serializeCanvasSvg = useCallback((showDimensions) => {
|
|
5602
|
+
const svg = canvasRef.current?.getSvgElement();
|
|
5603
|
+
if (!svg) throw new Error("SVG not mounted");
|
|
5604
|
+
const clone = svg.cloneNode(true);
|
|
5605
|
+
if (!showDimensions) {
|
|
5606
|
+
clone.querySelector("#dimensions")?.remove();
|
|
5607
|
+
}
|
|
5608
|
+
return new XMLSerializer().serializeToString(clone);
|
|
5609
|
+
}, []);
|
|
5610
|
+
useImperativeHandle(ref, () => ({
|
|
5611
|
+
getAttributes: () => dieLineRef.current.getAttributes(),
|
|
5612
|
+
exportImage: async (options) => {
|
|
5613
|
+
const svgStr = serializeCanvasSvg(options.isShowDimension);
|
|
5614
|
+
const blob = new Blob([svgStr], { type: "image/svg+xml;charset=utf-8" });
|
|
5615
|
+
const url = URL.createObjectURL(blob);
|
|
5616
|
+
const img = new Image();
|
|
5617
|
+
await new Promise((resolve, reject) => {
|
|
5618
|
+
img.onload = () => resolve();
|
|
5619
|
+
img.onerror = reject;
|
|
5620
|
+
img.src = url;
|
|
5621
|
+
});
|
|
5622
|
+
const canvas = document.createElement("canvas");
|
|
5623
|
+
if (options.originalSize) {
|
|
5624
|
+
canvas.width = Math.round(dieline.viewBox.width * PX_PER_MM9);
|
|
5625
|
+
canvas.height = Math.round(dieline.viewBox.height * PX_PER_MM9);
|
|
5626
|
+
} else {
|
|
5627
|
+
canvas.width = 1920;
|
|
5628
|
+
canvas.height = 1080;
|
|
5629
|
+
}
|
|
5630
|
+
const ctx = canvas.getContext("2d");
|
|
5631
|
+
ctx.fillStyle = "#ffffff";
|
|
5632
|
+
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
|
5633
|
+
ctx.drawImage(img, 0, 0, canvas.width, canvas.height);
|
|
5634
|
+
URL.revokeObjectURL(url);
|
|
5635
|
+
return new Promise((resolve, reject) => {
|
|
5636
|
+
canvas.toBlob((b) => b ? resolve(b) : reject(new Error("Export failed")), "image/png");
|
|
5637
|
+
});
|
|
5638
|
+
},
|
|
5639
|
+
exportDimension: () => dieLineRef.current.exportDimension(),
|
|
5640
|
+
resetView: () => canvasRef.current?.resetView(),
|
|
5641
|
+
fitView: () => canvasRef.current?.fitView()
|
|
5642
|
+
}), [serializeCanvasSvg, dieline.viewBox.width, dieline.viewBox.height]);
|
|
5643
|
+
return /* @__PURE__ */ jsx(BaseCanvas, { ref: canvasRef, viewBox, backgroundColor: theme.colorBackground, children: /* @__PURE__ */ jsx(DIE_LINE_BECF_B_12101, { ref: dieLineRef, ...props, renderAs: "group" }) });
|
|
5644
|
+
}
|
|
5645
|
+
);
|
|
5646
|
+
var MODEL_BECF_B_12101 = forwardRef(
|
|
5647
|
+
({ mode = "DIE_LINE", ...props }, ref) => {
|
|
5648
|
+
return /* @__PURE__ */ jsx(Fragment, { children: (() => {
|
|
5649
|
+
switch (mode) {
|
|
5650
|
+
case "DIE_LINE":
|
|
5651
|
+
return /* @__PURE__ */ jsx(CANVAS_BECF_B_12101, { ref, ...props });
|
|
5652
|
+
case "3D":
|
|
5653
|
+
return null;
|
|
5654
|
+
case "AUTO_LAYOUT":
|
|
5655
|
+
return /* @__PURE__ */ jsx(DIE_LINE_BECF_B_12101, { ref, ...props });
|
|
5656
|
+
default:
|
|
5657
|
+
return null;
|
|
5658
|
+
}
|
|
5659
|
+
})() });
|
|
5660
|
+
}
|
|
5661
|
+
);
|
|
5662
|
+
|
|
5663
|
+
// src/components/dieline/bags-pillows/becf-b-12109/generate.ts
|
|
5664
|
+
var DIP6 = 13;
|
|
5665
|
+
var NOTCH_X3 = 3;
|
|
5666
|
+
var NOTCH_Y3 = 5;
|
|
5667
|
+
function calcKulak6(b) {
|
|
5668
|
+
if (b <= 13) return b - 1;
|
|
5669
|
+
if (b <= 99) return 13;
|
|
5670
|
+
if (b <= 249) return 20;
|
|
5671
|
+
if (b <= 499) return 25;
|
|
5672
|
+
return 30;
|
|
5673
|
+
}
|
|
5674
|
+
function getAutoCalcValues6(attr) {
|
|
5675
|
+
const { width: B, glueArea } = attr;
|
|
5676
|
+
const kulak = glueArea ?? calcKulak6(B);
|
|
5677
|
+
return { kulak, dip: DIP6 };
|
|
5678
|
+
}
|
|
5679
|
+
function line10(x1, y1, x2, y2) {
|
|
5680
|
+
return `M${x1} ${y1} L${x2} ${y2}`;
|
|
5681
|
+
}
|
|
5682
|
+
function generateBecfB12109(attr) {
|
|
5683
|
+
const { length: A, width: B, height: C, glueArea } = attr;
|
|
5684
|
+
const kulak = glueArea ?? calcKulak6(B);
|
|
5685
|
+
const xFront = kulak;
|
|
5686
|
+
const xSide1 = kulak + A;
|
|
5687
|
+
const xSide1Mid = kulak + A + B / 2;
|
|
5688
|
+
const xBack = kulak + A + B;
|
|
5689
|
+
const xSide2 = kulak + 2 * A + B;
|
|
5690
|
+
const xSide2Mid = kulak + 2 * A + B + B / 2;
|
|
5691
|
+
const xEnd = kulak + 2 * A + 2 * B - 2;
|
|
5692
|
+
const yFoldBottomStart = C - B / 2;
|
|
5693
|
+
const yFoldBottom = C;
|
|
5694
|
+
const yNotchStart = yFoldBottom + NOTCH_Y3;
|
|
5695
|
+
const yEnd = C + B / 2 + DIP6;
|
|
5696
|
+
const totalWidth = xEnd;
|
|
5697
|
+
const totalHeight = yEnd;
|
|
5698
|
+
const cut = [];
|
|
5699
|
+
const crease = [];
|
|
5700
|
+
cut.push(line10(0, 0, 0, yFoldBottom - kulak));
|
|
5701
|
+
cut.push(line10(0, 0, totalWidth, 0));
|
|
5702
|
+
cut.push(line10(totalWidth, 0, totalWidth, yFoldBottom));
|
|
5703
|
+
cut.push(line10(0, yFoldBottom - kulak, kulak, yFoldBottom));
|
|
5704
|
+
const boundaries = [xFront, xSide1, xBack, xSide2, xEnd];
|
|
5705
|
+
for (let i = 0; i < boundaries.length; i++) {
|
|
5706
|
+
const xb = boundaries[i];
|
|
5707
|
+
const isFirst = i === 0;
|
|
5708
|
+
const isLast = i === boundaries.length - 1;
|
|
5709
|
+
if (!isFirst) {
|
|
5710
|
+
cut.push(line10(xb - NOTCH_X3, yNotchStart, xb - NOTCH_X3, totalHeight));
|
|
5711
|
+
cut.push(line10(xb - NOTCH_X3, yNotchStart, xb, yFoldBottom));
|
|
5712
|
+
}
|
|
5713
|
+
if (!isLast) {
|
|
5714
|
+
cut.push(line10(xb + NOTCH_X3, yNotchStart, xb + NOTCH_X3, totalHeight));
|
|
5715
|
+
cut.push(line10(xb + NOTCH_X3, yNotchStart, xb, yFoldBottom));
|
|
5716
|
+
}
|
|
5717
|
+
}
|
|
5718
|
+
cut.push(line10(xFront + NOTCH_X3, totalHeight, xSide1 - NOTCH_X3, totalHeight));
|
|
5719
|
+
cut.push(line10(xSide1 + NOTCH_X3, totalHeight, xBack - NOTCH_X3, totalHeight));
|
|
5720
|
+
cut.push(line10(xBack + NOTCH_X3, totalHeight, xSide2 - NOTCH_X3, totalHeight));
|
|
5721
|
+
cut.push(line10(xSide2 + NOTCH_X3, totalHeight, xEnd - NOTCH_X3, totalHeight));
|
|
5722
|
+
crease.push(line10(0, yFoldBottomStart, totalWidth, yFoldBottomStart));
|
|
5723
|
+
crease.push(line10(kulak, yFoldBottom, xEnd, yFoldBottom));
|
|
5724
|
+
crease.push(line10(xFront, 0, xFront, yFoldBottom));
|
|
5725
|
+
crease.push(line10(xSide1, 0, xSide1, yFoldBottom));
|
|
5726
|
+
crease.push(line10(xBack, 0, xBack, yFoldBottom));
|
|
5727
|
+
crease.push(line10(xSide2, 0, xSide2, yFoldBottom));
|
|
5728
|
+
crease.push(line10(xSide1Mid, 0, xSide1Mid, totalHeight));
|
|
5729
|
+
crease.push(line10(xSide2Mid, 0, xSide2Mid, totalHeight));
|
|
5730
|
+
crease.push(line10(xBack, yFoldBottom, xSide1Mid, yFoldBottomStart));
|
|
5731
|
+
crease.push(line10(xSide1Mid, yFoldBottomStart, xSide1, yFoldBottom));
|
|
5732
|
+
crease.push(line10(xSide2Mid, yFoldBottomStart, xSide2, yFoldBottom));
|
|
5733
|
+
crease.push(line10(xSide2Mid, yFoldBottomStart, xEnd, C - 2));
|
|
5734
|
+
return { cut, crease, viewBox: { width: totalWidth, height: totalHeight } };
|
|
5735
|
+
}
|
|
5736
|
+
function generateOuterContour10(attr) {
|
|
5737
|
+
const { length: A, width: B, height: C, glueArea } = attr;
|
|
5738
|
+
const kulak = glueArea ?? calcKulak6(B);
|
|
5739
|
+
const xFront = kulak;
|
|
5740
|
+
const xSide1 = kulak + A;
|
|
5741
|
+
const xBack = kulak + A + B;
|
|
5742
|
+
const xSide2 = kulak + 2 * A + B;
|
|
5743
|
+
const xEnd = kulak + 2 * A + 2 * B - 2;
|
|
5744
|
+
const yFoldBottom = C;
|
|
5745
|
+
const yNotchStart = yFoldBottom + NOTCH_Y3;
|
|
5746
|
+
const yEnd = C + B / 2 + DIP6;
|
|
5747
|
+
return [
|
|
5748
|
+
{ x: 0, y: 0 },
|
|
5749
|
+
{ x: xEnd, y: 0 },
|
|
5750
|
+
{ x: xEnd, y: yFoldBottom },
|
|
5751
|
+
{ x: xEnd - NOTCH_X3, y: yNotchStart },
|
|
5752
|
+
{ x: xEnd - NOTCH_X3, y: yEnd },
|
|
5753
|
+
{ x: xSide2 + NOTCH_X3, y: yEnd },
|
|
5754
|
+
{ x: xSide2 + NOTCH_X3, y: yNotchStart },
|
|
5755
|
+
{ x: xSide2, y: yFoldBottom },
|
|
5756
|
+
{ x: xSide2 - NOTCH_X3, y: yNotchStart },
|
|
5757
|
+
{ x: xSide2 - NOTCH_X3, y: yEnd },
|
|
5758
|
+
{ x: xBack + NOTCH_X3, y: yEnd },
|
|
5759
|
+
{ x: xBack + NOTCH_X3, y: yNotchStart },
|
|
5760
|
+
{ x: xBack, y: yFoldBottom },
|
|
5761
|
+
{ x: xBack - NOTCH_X3, y: yNotchStart },
|
|
5762
|
+
{ x: xBack - NOTCH_X3, y: yEnd },
|
|
5763
|
+
{ x: xSide1 + NOTCH_X3, y: yEnd },
|
|
5764
|
+
{ x: xSide1 + NOTCH_X3, y: yNotchStart },
|
|
5765
|
+
{ x: xSide1, y: yFoldBottom },
|
|
5766
|
+
{ x: xSide1 - NOTCH_X3, y: yNotchStart },
|
|
5767
|
+
{ x: xSide1 - NOTCH_X3, y: yEnd },
|
|
5768
|
+
{ x: xFront + NOTCH_X3, y: yEnd },
|
|
5769
|
+
{ x: xFront + NOTCH_X3, y: yNotchStart },
|
|
5770
|
+
{ x: xFront, y: yFoldBottom },
|
|
5771
|
+
{ x: 0, y: yFoldBottom - kulak }
|
|
5772
|
+
];
|
|
5773
|
+
}
|
|
5774
|
+
function offsetContour10(points, distance) {
|
|
5775
|
+
const n = points.length;
|
|
5776
|
+
const result = [];
|
|
5777
|
+
for (let i = 0; i < n; i++) {
|
|
5778
|
+
const prev = points[(i - 1 + n) % n];
|
|
5779
|
+
const curr = points[i];
|
|
5780
|
+
const next = points[(i + 1) % n];
|
|
5781
|
+
const e1x = curr.x - prev.x;
|
|
5782
|
+
const e1y = curr.y - prev.y;
|
|
5783
|
+
const e2x = next.x - curr.x;
|
|
5784
|
+
const e2y = next.y - curr.y;
|
|
5785
|
+
const len1 = Math.sqrt(e1x * e1x + e1y * e1y);
|
|
5786
|
+
const len2 = Math.sqrt(e2x * e2x + e2y * e2y);
|
|
5787
|
+
if (len1 === 0 || len2 === 0) {
|
|
5788
|
+
result.push(curr);
|
|
5789
|
+
continue;
|
|
5790
|
+
}
|
|
5791
|
+
const n1x = e1y / len1;
|
|
5792
|
+
const n1y = -e1x / len1;
|
|
5793
|
+
const n2x = e2y / len2;
|
|
5794
|
+
const n2y = -e2x / len2;
|
|
5795
|
+
const ax = n1x + n2x;
|
|
5796
|
+
const ay = n1y + n2y;
|
|
5797
|
+
const aLen = Math.sqrt(ax * ax + ay * ay);
|
|
5798
|
+
if (aLen < 1e-3) {
|
|
5799
|
+
result.push({ x: curr.x + n1x * distance, y: curr.y + n1y * distance });
|
|
5800
|
+
continue;
|
|
5801
|
+
}
|
|
5802
|
+
const nx = ax / aLen;
|
|
5803
|
+
const ny = ay / aLen;
|
|
5804
|
+
const dot = n1x * nx + n1y * ny;
|
|
5805
|
+
const d = distance / Math.max(dot, 0.1);
|
|
5806
|
+
result.push({ x: curr.x + nx * d, y: curr.y + ny * d });
|
|
5807
|
+
}
|
|
5808
|
+
return result;
|
|
5809
|
+
}
|
|
5810
|
+
function contourToPath10(points) {
|
|
5811
|
+
if (points.length === 0) return "";
|
|
5812
|
+
let d = `M${points[0].x} ${points[0].y}`;
|
|
5813
|
+
for (let i = 1; i < points.length; i++) {
|
|
5814
|
+
d += ` L${points[i].x} ${points[i].y}`;
|
|
5815
|
+
}
|
|
5816
|
+
d += " Z";
|
|
5817
|
+
return d;
|
|
5818
|
+
}
|
|
5819
|
+
function generateDimensions10(attr, unit) {
|
|
5820
|
+
const { length: A, width: B, height: C, glueArea } = attr;
|
|
5821
|
+
const kulak = glueArea ?? calcKulak6(B);
|
|
5822
|
+
const factor = unit === "cm" ? 0.1 : unit === "in" ? 1 / 25.4 : 1;
|
|
5823
|
+
const suffix = unit;
|
|
5824
|
+
const fmt = (v) => `${(v * factor).toFixed(2)} ${suffix}`;
|
|
5825
|
+
const xFront = kulak;
|
|
5826
|
+
const xSide1 = kulak + A;
|
|
5827
|
+
const xBack = kulak + A + B;
|
|
5828
|
+
const yFoldBottom = C;
|
|
5829
|
+
const yEnd = C + B / 2 + DIP6;
|
|
5830
|
+
const totalWidth = kulak + 2 * A + 2 * B - 2;
|
|
5831
|
+
const totalHeight = yEnd;
|
|
5832
|
+
const bottomSection = B / 2 + DIP6;
|
|
5833
|
+
return [
|
|
5834
|
+
{
|
|
5835
|
+
x1: 0,
|
|
5836
|
+
y1: 0,
|
|
5837
|
+
x2: totalWidth,
|
|
5838
|
+
y2: 0,
|
|
5839
|
+
label: `Overall Width : ${fmt(totalWidth)}`,
|
|
5840
|
+
orientation: "horizontal",
|
|
5841
|
+
offset: -12
|
|
5842
|
+
},
|
|
5843
|
+
{
|
|
5844
|
+
x1: 0,
|
|
5845
|
+
y1: 0,
|
|
5846
|
+
x2: 0,
|
|
5847
|
+
y2: totalHeight,
|
|
5848
|
+
label: `Overall Height : ${fmt(totalHeight)}`,
|
|
5849
|
+
orientation: "vertical",
|
|
5850
|
+
offset: -12
|
|
5851
|
+
},
|
|
5852
|
+
{
|
|
5853
|
+
x1: xBack + A * 0.6,
|
|
5854
|
+
y1: 0,
|
|
5855
|
+
x2: xBack + A * 0.6,
|
|
5856
|
+
y2: yFoldBottom,
|
|
5857
|
+
label: fmt(C),
|
|
5858
|
+
orientation: "vertical",
|
|
5859
|
+
offset: -10
|
|
5860
|
+
},
|
|
5861
|
+
{
|
|
5862
|
+
x1: xBack + A * 0.6,
|
|
5863
|
+
y1: yFoldBottom,
|
|
5864
|
+
x2: xBack + A * 0.6,
|
|
5865
|
+
y2: yEnd,
|
|
5866
|
+
label: fmt(bottomSection),
|
|
5867
|
+
orientation: "vertical",
|
|
5868
|
+
offset: -10
|
|
5869
|
+
},
|
|
5870
|
+
{
|
|
5871
|
+
x1: xFront,
|
|
5872
|
+
y1: C * 0.65,
|
|
5873
|
+
x2: xSide1,
|
|
5874
|
+
y2: C * 0.65,
|
|
5875
|
+
label: fmt(A),
|
|
5876
|
+
orientation: "horizontal",
|
|
5877
|
+
offset: -20
|
|
5878
|
+
},
|
|
5879
|
+
{
|
|
5880
|
+
x1: xSide1,
|
|
5881
|
+
y1: C * 0.65,
|
|
5882
|
+
x2: xBack,
|
|
5883
|
+
y2: C * 0.65,
|
|
5884
|
+
label: fmt(B),
|
|
5885
|
+
orientation: "horizontal",
|
|
5886
|
+
offset: -20
|
|
5887
|
+
},
|
|
5888
|
+
{
|
|
5889
|
+
x1: 0,
|
|
5890
|
+
y1: C * 0.65,
|
|
5891
|
+
x2: xFront,
|
|
5892
|
+
y2: C * 0.65,
|
|
5893
|
+
label: fmt(kulak),
|
|
5894
|
+
orientation: "horizontal",
|
|
5895
|
+
offset: -20
|
|
5896
|
+
}
|
|
5897
|
+
];
|
|
5898
|
+
}
|
|
5899
|
+
var MODEL_ID10 = "BECF-B-12109";
|
|
5900
|
+
var UNIT_FACTOR10 = {
|
|
5901
|
+
mm: 1,
|
|
5902
|
+
cm: 0.1,
|
|
5903
|
+
in: 1 / 25.4
|
|
5904
|
+
};
|
|
5905
|
+
var PX_PER_MM10 = 96 / 25.4;
|
|
5906
|
+
function renderDimension10(dim, i, fs) {
|
|
5907
|
+
const { x1, y1, x2, y2, label, orientation, offset } = dim;
|
|
5908
|
+
const tick = 1.5;
|
|
5909
|
+
if (orientation === "horizontal") {
|
|
5910
|
+
const y = y1 + offset;
|
|
5911
|
+
const midX = (x1 + x2) / 2;
|
|
5912
|
+
return /* @__PURE__ */ jsxs("g", { children: [
|
|
5913
|
+
/* @__PURE__ */ jsx("line", { x1, y1: y, x2, y2: y, stroke: "#000", strokeWidth: 0.2 }),
|
|
5914
|
+
/* @__PURE__ */ jsx("line", { x1, y1: y - tick, x2: x1, y2: y + tick, stroke: "#000", strokeWidth: 0.3 }),
|
|
5915
|
+
/* @__PURE__ */ jsx("line", { x1: x2, y1: y - tick, x2, y2: y + tick, stroke: "#000", strokeWidth: 0.3 }),
|
|
5916
|
+
/* @__PURE__ */ jsx("text", { x: midX, y: y - 1.5, textAnchor: "middle", fontSize: fs, fontFamily: "sans-serif", fill: "#000", children: label })
|
|
5917
|
+
] }, `dim-${i}`);
|
|
5918
|
+
}
|
|
5919
|
+
const x = x1 + offset;
|
|
5920
|
+
const midY = (y1 + y2) / 2;
|
|
5921
|
+
return /* @__PURE__ */ jsxs("g", { children: [
|
|
5922
|
+
/* @__PURE__ */ jsx("line", { x1: x, y1, x2: x, y2, stroke: "#000", strokeWidth: 0.2 }),
|
|
5923
|
+
/* @__PURE__ */ jsx("line", { x1: x - tick, y1, x2: x + tick, y2: y1, stroke: "#000", strokeWidth: 0.3 }),
|
|
5924
|
+
/* @__PURE__ */ jsx("line", { x1: x - tick, y1: y2, x2: x + tick, y2, stroke: "#000", strokeWidth: 0.3 }),
|
|
5925
|
+
/* @__PURE__ */ jsx("text", { x: x - 1.5, y: midY - 1, textAnchor: "middle", dominantBaseline: "central", fontSize: fs, fontFamily: "sans-serif", fill: "#000", transform: `rotate(-90, ${x - 1.5}, ${midY})`, children: label })
|
|
5926
|
+
] }, `dim-${i}`);
|
|
5927
|
+
}
|
|
5928
|
+
var DIE_LINE_BECF_B_12109 = forwardRef(
|
|
5929
|
+
({ attributes, unit = "mm", isShowDimensions = false, renderAs = "svg" }, ref) => {
|
|
5930
|
+
const theme = useMemo(() => getModelTheme(), []);
|
|
5931
|
+
const svgRef = useRef(null);
|
|
5932
|
+
const dieline = useMemo(() => generateBecfB12109(attributes), [attributes]);
|
|
5933
|
+
const dimensions = useMemo(() => generateDimensions10(attributes, unit), [attributes, unit]);
|
|
5934
|
+
const factor = UNIT_FACTOR10[unit] ?? 1;
|
|
5935
|
+
const serializeSvg = useCallback((showDimensions) => {
|
|
5936
|
+
const svg = svgRef.current;
|
|
5937
|
+
if (!svg) throw new Error("SVG not mounted");
|
|
5938
|
+
const clone = svg.cloneNode(true);
|
|
5939
|
+
if (!showDimensions) {
|
|
5940
|
+
clone.querySelector("#dimensions")?.remove();
|
|
5941
|
+
}
|
|
5942
|
+
return new XMLSerializer().serializeToString(clone);
|
|
5943
|
+
}, []);
|
|
5944
|
+
useImperativeHandle(ref, () => {
|
|
5945
|
+
const auto = getAutoCalcValues6(attributes);
|
|
5946
|
+
return {
|
|
5947
|
+
getAttributes: () => ({
|
|
5948
|
+
modelId: MODEL_ID10,
|
|
5949
|
+
overallWidth: dieline.viewBox.width * factor,
|
|
5950
|
+
overallHeight: dieline.viewBox.height * factor,
|
|
5951
|
+
length: attributes.length * factor,
|
|
5952
|
+
width: attributes.width * factor,
|
|
5953
|
+
height: attributes.height * factor,
|
|
5954
|
+
glueArea: auto.kulak * factor,
|
|
5955
|
+
kulak: auto.kulak * factor,
|
|
5956
|
+
dip: auto.dip * factor
|
|
5957
|
+
}),
|
|
5958
|
+
exportImage: async (options) => {
|
|
5959
|
+
const svgStr = serializeSvg(options.isShowDimension);
|
|
5960
|
+
const blob = new Blob([svgStr], { type: "image/svg+xml;charset=utf-8" });
|
|
5961
|
+
const url = URL.createObjectURL(blob);
|
|
5962
|
+
const img = new Image();
|
|
5963
|
+
await new Promise((resolve, reject) => {
|
|
5964
|
+
img.onload = () => resolve();
|
|
5965
|
+
img.onerror = reject;
|
|
5966
|
+
img.src = url;
|
|
5967
|
+
});
|
|
5968
|
+
const canvas = document.createElement("canvas");
|
|
5969
|
+
if (options.originalSize) {
|
|
5970
|
+
canvas.width = Math.round(dieline.viewBox.width * PX_PER_MM10);
|
|
5971
|
+
canvas.height = Math.round(dieline.viewBox.height * PX_PER_MM10);
|
|
5972
|
+
} else {
|
|
5973
|
+
canvas.width = 1920;
|
|
5974
|
+
canvas.height = 1080;
|
|
5975
|
+
}
|
|
5976
|
+
const ctx = canvas.getContext("2d");
|
|
5977
|
+
ctx.fillStyle = "#ffffff";
|
|
5978
|
+
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
|
5979
|
+
ctx.drawImage(img, 0, 0, canvas.width, canvas.height);
|
|
5980
|
+
URL.revokeObjectURL(url);
|
|
5981
|
+
return new Promise((resolve, reject) => {
|
|
5982
|
+
canvas.toBlob((b) => b ? resolve(b) : reject(new Error("Export failed")), "image/png");
|
|
5983
|
+
});
|
|
5984
|
+
},
|
|
5985
|
+
exportDimension: async () => {
|
|
5986
|
+
const dimData = generateDimensions10(attributes, unit);
|
|
5987
|
+
return exportDimensionPdf({ modelId: MODEL_ID10, dieline, dimensions: dimData, attributes, unit, factor, theme });
|
|
5988
|
+
}
|
|
5989
|
+
};
|
|
5990
|
+
}, [attributes, dieline, factor, unit, serializeSvg, theme]);
|
|
5991
|
+
const padding = isShowDimensions ? 15 : 0;
|
|
5992
|
+
const vbX = -padding;
|
|
5993
|
+
const vbY = -padding;
|
|
5994
|
+
const vbW = dieline.viewBox.width + padding * 2;
|
|
5995
|
+
const vbH = dieline.viewBox.height + padding * 2;
|
|
5996
|
+
const svgChildren = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
5997
|
+
/* @__PURE__ */ jsx("g", { id: "crease", children: dieline.crease.map((d, i) => /* @__PURE__ */ jsx("path", { d, fill: "none", stroke: theme.colorFoldLine, strokeWidth: 0.5, strokeDasharray: "2,1" }, `c-${i}`)) }),
|
|
5998
|
+
/* @__PURE__ */ jsx("g", { id: "cut", children: dieline.cut.map((d, i) => /* @__PURE__ */ jsx("path", { d, fill: "none", stroke: theme.colorDieLine, strokeWidth: 0.5 }, `t-${i}`)) }),
|
|
5999
|
+
isShowDimensions && /* @__PURE__ */ jsx("g", { id: "dimensions", children: dimensions.map((d, i) => renderDimension10(d, i, getFontDimensionSize())) })
|
|
6000
|
+
] });
|
|
6001
|
+
if (renderAs === "group") return /* @__PURE__ */ jsx("g", { children: svgChildren });
|
|
6002
|
+
return /* @__PURE__ */ jsx("svg", { ref: svgRef, xmlns: "http://www.w3.org/2000/svg", viewBox: `${vbX} ${vbY} ${vbW} ${vbH}`, preserveAspectRatio: "xMidYMid meet", style: { backgroundColor: theme.colorBackground }, children: svgChildren });
|
|
6003
|
+
}
|
|
6004
|
+
);
|
|
6005
|
+
var CANVAS_BECF_B_12109 = forwardRef(
|
|
6006
|
+
(props, ref) => {
|
|
6007
|
+
const dieLineRef = useRef(null);
|
|
6008
|
+
const canvasRef = useRef(null);
|
|
6009
|
+
const { attributes } = props;
|
|
6010
|
+
const theme = useMemo(() => getModelTheme(), []);
|
|
6011
|
+
const dieline = useMemo(() => generateBecfB12109(attributes), [attributes]);
|
|
6012
|
+
const stablePadding = 15;
|
|
6013
|
+
const viewBox = useMemo(() => ({ x: -stablePadding, y: -stablePadding, width: dieline.viewBox.width + stablePadding * 2, height: dieline.viewBox.height + stablePadding * 2 }), [dieline.viewBox.width, dieline.viewBox.height]);
|
|
6014
|
+
const serializeCanvasSvg = useCallback((showDimensions) => {
|
|
6015
|
+
const svg = canvasRef.current?.getSvgElement();
|
|
6016
|
+
if (!svg) throw new Error("SVG not mounted");
|
|
6017
|
+
const clone = svg.cloneNode(true);
|
|
6018
|
+
if (!showDimensions) {
|
|
6019
|
+
clone.querySelector("#dimensions")?.remove();
|
|
6020
|
+
}
|
|
6021
|
+
return new XMLSerializer().serializeToString(clone);
|
|
6022
|
+
}, []);
|
|
6023
|
+
useImperativeHandle(ref, () => ({
|
|
6024
|
+
getAttributes: () => dieLineRef.current.getAttributes(),
|
|
6025
|
+
exportImage: async (options) => {
|
|
6026
|
+
const svgStr = serializeCanvasSvg(options.isShowDimension);
|
|
6027
|
+
const blob = new Blob([svgStr], { type: "image/svg+xml;charset=utf-8" });
|
|
6028
|
+
const url = URL.createObjectURL(blob);
|
|
6029
|
+
const img = new Image();
|
|
6030
|
+
await new Promise((resolve, reject) => {
|
|
6031
|
+
img.onload = () => resolve();
|
|
6032
|
+
img.onerror = reject;
|
|
6033
|
+
img.src = url;
|
|
6034
|
+
});
|
|
6035
|
+
const canvas = document.createElement("canvas");
|
|
6036
|
+
if (options.originalSize) {
|
|
6037
|
+
canvas.width = Math.round(dieline.viewBox.width * PX_PER_MM10);
|
|
6038
|
+
canvas.height = Math.round(dieline.viewBox.height * PX_PER_MM10);
|
|
6039
|
+
} else {
|
|
6040
|
+
canvas.width = 1920;
|
|
6041
|
+
canvas.height = 1080;
|
|
6042
|
+
}
|
|
6043
|
+
const ctx = canvas.getContext("2d");
|
|
6044
|
+
ctx.fillStyle = "#ffffff";
|
|
6045
|
+
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
|
6046
|
+
ctx.drawImage(img, 0, 0, canvas.width, canvas.height);
|
|
6047
|
+
URL.revokeObjectURL(url);
|
|
6048
|
+
return new Promise((resolve, reject) => {
|
|
6049
|
+
canvas.toBlob((b) => b ? resolve(b) : reject(new Error("Export failed")), "image/png");
|
|
6050
|
+
});
|
|
6051
|
+
},
|
|
6052
|
+
exportDimension: () => dieLineRef.current.exportDimension(),
|
|
6053
|
+
resetView: () => canvasRef.current?.resetView(),
|
|
6054
|
+
fitView: () => canvasRef.current?.fitView()
|
|
6055
|
+
}), [serializeCanvasSvg, dieline.viewBox.width, dieline.viewBox.height]);
|
|
6056
|
+
return /* @__PURE__ */ jsx(BaseCanvas, { ref: canvasRef, viewBox, backgroundColor: theme.colorBackground, children: /* @__PURE__ */ jsx(DIE_LINE_BECF_B_12109, { ref: dieLineRef, ...props, renderAs: "group" }) });
|
|
6057
|
+
}
|
|
6058
|
+
);
|
|
6059
|
+
var MODEL_BECF_B_12109 = forwardRef(
|
|
6060
|
+
({ mode = "DIE_LINE", ...props }, ref) => {
|
|
6061
|
+
return /* @__PURE__ */ jsx(Fragment, { children: (() => {
|
|
6062
|
+
switch (mode) {
|
|
6063
|
+
case "DIE_LINE":
|
|
6064
|
+
return /* @__PURE__ */ jsx(CANVAS_BECF_B_12109, { ref, ...props });
|
|
6065
|
+
case "3D":
|
|
6066
|
+
return null;
|
|
6067
|
+
case "AUTO_LAYOUT":
|
|
6068
|
+
return /* @__PURE__ */ jsx(DIE_LINE_BECF_B_12109, { ref, ...props });
|
|
6069
|
+
default:
|
|
6070
|
+
return null;
|
|
6071
|
+
}
|
|
6072
|
+
})() });
|
|
6073
|
+
}
|
|
6074
|
+
);
|
|
6075
|
+
|
|
6076
|
+
// src/components/dieline/snap-lock-boxes/becf-10a0a/generate.ts
|
|
6077
|
+
var MT5 = 0.5;
|
|
6078
|
+
var ARC_R4 = 5;
|
|
6079
|
+
var SNAP_R = 3;
|
|
6080
|
+
var TAPER = Math.tan(15 * Math.PI / 180);
|
|
6081
|
+
var TAB_W = 8;
|
|
6082
|
+
var CORNER = 3;
|
|
6083
|
+
var NOTCH = 10;
|
|
6084
|
+
function calcKulak7(b) {
|
|
6085
|
+
if (b < 100) return 13;
|
|
6086
|
+
if (b < 250) return 15;
|
|
6087
|
+
if (b < 500) return 20;
|
|
6088
|
+
return 25;
|
|
6089
|
+
}
|
|
6090
|
+
function calcDil(a, b, c) {
|
|
6091
|
+
const base = Math.max(15, Math.min(30, (a + b + 50) / 20));
|
|
6092
|
+
return Math.max(9, Math.min(a / 2, b - 1, c / 2, base));
|
|
6093
|
+
}
|
|
6094
|
+
function calcDip(b) {
|
|
6095
|
+
if (b <= 22) return 9;
|
|
6096
|
+
if (b <= 28) return Math.floor((b - 4) / 2);
|
|
6097
|
+
if (b <= 77) return 12;
|
|
6098
|
+
if (b <= 120) return Math.floor(b / 6);
|
|
6099
|
+
if (b <= 167) return 20;
|
|
6100
|
+
if (b <= 199) return Math.floor(b / 8);
|
|
6101
|
+
if (b < 300) return 30;
|
|
6102
|
+
if (b < 400) return 35;
|
|
6103
|
+
return 40;
|
|
6104
|
+
}
|
|
6105
|
+
function generateBecf10a0a(attr) {
|
|
6106
|
+
const { length: A, width: B, height: C } = attr;
|
|
6107
|
+
const kulak = calcKulak7(B);
|
|
6108
|
+
const dil = calcDil(A, B, C);
|
|
6109
|
+
const dip = calcDip(B);
|
|
6110
|
+
const glueTaper = kulak * TAPER;
|
|
6111
|
+
const tuckH = B / 2 + ARC_R4;
|
|
6112
|
+
const xFront = kulak;
|
|
6113
|
+
const xSide1 = kulak + A;
|
|
6114
|
+
const xBack = kulak + A + B;
|
|
6115
|
+
const xSide2 = kulak + 2 * A + B;
|
|
6116
|
+
const xEnd = kulak + 2 * A + 2 * B - 0.5;
|
|
6117
|
+
const yTop = 0;
|
|
6118
|
+
const yTuckTop = dil - 1;
|
|
6119
|
+
const yLockCrease = dil;
|
|
6120
|
+
const yTuckFlapTop = B + dil - 1 - tuckH;
|
|
6121
|
+
const yFoldTop = B + dil - 1;
|
|
6122
|
+
const yFoldBottom = yFoldTop + C;
|
|
6123
|
+
const yFoldBottomB2 = yFoldBottom + B / 2;
|
|
6124
|
+
const ySideBottom = yFoldBottom + A / 4 + dip + SNAP_R;
|
|
6125
|
+
const yBottom = yFoldBottom + B / 2 + dip + SNAP_R;
|
|
6126
|
+
const totalWidth = xEnd;
|
|
6127
|
+
const totalHeight = yBottom;
|
|
6128
|
+
const cut = [];
|
|
6129
|
+
const crease = [];
|
|
6130
|
+
crease.push(
|
|
6131
|
+
line11(xFront, yFoldTop, xFront, yFoldBottom),
|
|
6132
|
+
line11(xSide1, yFoldTop, xSide1, yFoldBottom),
|
|
6133
|
+
line11(xBack, yFoldTop, xBack, yFoldBottom),
|
|
6134
|
+
line11(xSide2, yFoldTop, xSide2, yFoldBottom)
|
|
6135
|
+
);
|
|
6136
|
+
crease.push(
|
|
6137
|
+
line11(xFront, yFoldBottom, xSide1, yFoldBottom),
|
|
6138
|
+
line11(xSide1, yFoldBottom, xBack, yFoldBottom),
|
|
6139
|
+
line11(xBack, yFoldBottom, xSide2, yFoldBottom),
|
|
6140
|
+
line11(xSide2, yFoldBottom, xEnd, yFoldBottom)
|
|
6141
|
+
);
|
|
6142
|
+
crease.push(
|
|
6143
|
+
line11(xBack, yFoldTop, xSide1 + MT5, yFoldTop),
|
|
6144
|
+
// Side1 panel
|
|
6145
|
+
line11(xBack, yFoldTop - MT5, xSide2, yFoldTop - MT5),
|
|
6146
|
+
// Back panel (MT offset)
|
|
6147
|
+
line11(xSide2, yFoldTop, xEnd, yFoldTop)
|
|
6148
|
+
// Side2 panel
|
|
6149
|
+
);
|
|
6150
|
+
crease.push(
|
|
6151
|
+
line11(xBack + NOTCH, yLockCrease, xSide2 - NOTCH, yLockCrease)
|
|
6152
|
+
);
|
|
6153
|
+
cut.push(
|
|
6154
|
+
line11(xSide1, yFoldTop, xFront, yFoldTop),
|
|
6155
|
+
line11(xSide1, yFoldTop, xSide1 + MT5, yFoldTop)
|
|
6156
|
+
);
|
|
6157
|
+
cut.push(
|
|
6158
|
+
`M${xFront} ${yFoldBottom} L${0} ${yFoldBottom - glueTaper} L${0} ${yFoldTop + glueTaper} L${xFront} ${yFoldTop}`
|
|
6159
|
+
);
|
|
6160
|
+
cut.push(line11(xEnd, yFoldTop, xEnd, yFoldBottom));
|
|
6161
|
+
cut.push(...lockTab(xBack, xSide2, yTop, yTuckTop, yLockCrease, yFoldTop));
|
|
6162
|
+
cut.push(...side1TuckFlap(xSide1, xBack, yFoldTop, yTuckFlapTop, tuckH));
|
|
6163
|
+
cut.push(...side2TuckFlap(xSide2, xEnd, yFoldTop, yTuckFlapTop, tuckH));
|
|
6164
|
+
cut.push(...frontPanelBottom(xFront, xSide1, A, yFoldBottom, yFoldBottomB2, yBottom, dip));
|
|
6165
|
+
cut.push(...backPanelBottom(xBack, xSide2, A, yFoldBottom, yFoldBottomB2, yBottom, ySideBottom, dip));
|
|
6166
|
+
cut.push(...side1Bottom(xSide1, xBack, B, A, yFoldBottom, ySideBottom, dip));
|
|
6167
|
+
cut.push(...side2Bottom(xSide2, xEnd, B, A, yFoldBottom, ySideBottom, dip));
|
|
6168
|
+
return { cut, crease, viewBox: { width: totalWidth, height: totalHeight } };
|
|
6169
|
+
}
|
|
6170
|
+
function line11(x1, y1, x2, y2) {
|
|
6171
|
+
return `M${x1} ${y1} L${x2} ${y2}`;
|
|
6172
|
+
}
|
|
6173
|
+
function lockTab(xBack, xSide2, yTop, yTuckTop, yLockCrease, yFoldTop) {
|
|
6174
|
+
const paths = [];
|
|
6175
|
+
paths.push(line11(xBack, yFoldTop, xBack, yTuckTop));
|
|
6176
|
+
paths.push(line11(xSide2, yTuckTop, xSide2, yFoldTop));
|
|
6177
|
+
paths.push(line11(xBack, yTuckTop, xBack + NOTCH, yTuckTop));
|
|
6178
|
+
paths.push(line11(xSide2 - NOTCH, yTuckTop, xSide2, yTuckTop));
|
|
6179
|
+
paths.push(line11(xBack + NOTCH, yTuckTop, xBack + NOTCH, yLockCrease));
|
|
6180
|
+
paths.push(line11(xSide2 - NOTCH, yLockCrease, xSide2 - NOTCH, yTuckTop));
|
|
6181
|
+
paths.push(line11(xBack + MT5, yTuckTop, xBack + MT5, ARC_R4));
|
|
6182
|
+
paths.push(line11(xSide2 - MT5, yTuckTop, xSide2 - MT5, ARC_R4));
|
|
6183
|
+
paths.push(line11(xBack + MT5 + ARC_R4, yTop, xSide2 - MT5 - ARC_R4, yTop));
|
|
6184
|
+
paths.push(
|
|
6185
|
+
`M${xBack + MT5 + ARC_R4} ${yTop} A${ARC_R4} ${ARC_R4} 0 0 0 ${xBack + MT5} ${ARC_R4}`
|
|
6186
|
+
);
|
|
6187
|
+
paths.push(
|
|
6188
|
+
`M${xSide2 - MT5} ${ARC_R4} A${ARC_R4} ${ARC_R4} 0 0 0 ${xSide2 - MT5 - ARC_R4} ${yTop}`
|
|
6189
|
+
);
|
|
6190
|
+
return paths;
|
|
6191
|
+
}
|
|
6192
|
+
function side1TuckFlap(xSide1, xBack, yFoldTop, yTuckFlapTop, tuckH) {
|
|
6193
|
+
const slopeV = tuckH - TAB_W - CORNER;
|
|
6194
|
+
const slopeH = slopeV * TAPER;
|
|
6195
|
+
const leftTargetX = xSide1 + MT5 + CORNER + slopeH;
|
|
6196
|
+
const rightTargetX = xBack - ARC_R4;
|
|
6197
|
+
const leftPath = `M${xSide1 + MT5} ${yFoldTop} L${xSide1 + MT5} ${yFoldTop - TAB_W} L${xSide1 + MT5 + CORNER} ${yFoldTop - TAB_W - CORNER} L${leftTargetX} ${yTuckFlapTop}`;
|
|
6198
|
+
const topRight = `M${leftTargetX} ${yTuckFlapTop} L${rightTargetX} ${yTuckFlapTop} L${xBack - CORNER} ${yFoldTop - CORNER} L${xBack} ${yFoldTop}`;
|
|
6199
|
+
return [leftPath, topRight];
|
|
6200
|
+
}
|
|
6201
|
+
function side2TuckFlap(xSide2, xEnd, yFoldTop, yTuckFlapTop, tuckH) {
|
|
6202
|
+
const slopeV = tuckH - TAB_W - CORNER;
|
|
6203
|
+
const slopeH = slopeV * TAPER;
|
|
6204
|
+
const leftTargetX = xSide2 + ARC_R4;
|
|
6205
|
+
const rightTargetX = xEnd - CORNER - slopeH;
|
|
6206
|
+
const leftTop = `M${xSide2} ${yFoldTop} L${xSide2 + CORNER} ${yFoldTop - CORNER} L${leftTargetX} ${yTuckFlapTop} L${rightTargetX} ${yTuckFlapTop}`;
|
|
6207
|
+
const rightPath = `M${rightTargetX} ${yTuckFlapTop} L${xEnd - CORNER} ${yFoldTop - TAB_W - CORNER} L${xEnd} ${yFoldTop - TAB_W} L${xEnd} ${yFoldTop}`;
|
|
6208
|
+
return [leftTop, rightPath];
|
|
6209
|
+
}
|
|
6210
|
+
function frontPanelBottom(xFront, xSide1, A, yFoldBottom, yFoldBottomB2, yBottom, dip) {
|
|
6211
|
+
const paths = [];
|
|
6212
|
+
paths.push(line11(xFront, yFoldBottom, xFront, yBottom));
|
|
6213
|
+
paths.push(line11(xSide1, yBottom, xSide1, yFoldBottom));
|
|
6214
|
+
const notchHalfTop = A / 4 + MT5;
|
|
6215
|
+
const notchTaperH = (dip + SNAP_R) * TAPER;
|
|
6216
|
+
const center = xFront + A / 2;
|
|
6217
|
+
const nlt = center - notchHalfTop;
|
|
6218
|
+
const nrt = center + notchHalfTop;
|
|
6219
|
+
const nlb = nlt + notchTaperH;
|
|
6220
|
+
const nrb = nrt - notchTaperH;
|
|
6221
|
+
paths.push(line11(xFront, yBottom, nlb, yBottom));
|
|
6222
|
+
paths.push(line11(nlb, yBottom, nlt, yFoldBottomB2));
|
|
6223
|
+
paths.push(line11(nlt, yFoldBottomB2, nrt, yFoldBottomB2));
|
|
6224
|
+
paths.push(line11(nrt, yFoldBottomB2, nrb, yBottom));
|
|
6225
|
+
paths.push(line11(nrb, yBottom, xSide1, yBottom));
|
|
6226
|
+
return paths;
|
|
6227
|
+
}
|
|
6228
|
+
function backPanelBottom(xBack, xSide2, A, yFoldBottom, yFoldBottomB2, yBottom, ySideBottom, dip) {
|
|
6229
|
+
const paths = [];
|
|
6230
|
+
const diagH = A / 4;
|
|
6231
|
+
paths.push(line11(xBack, yFoldBottom, xBack, ySideBottom));
|
|
6232
|
+
paths.push(line11(xSide2, ySideBottom, xSide2, yFoldBottom));
|
|
6233
|
+
paths.push(line11(xBack, yFoldBottom, xBack + diagH, yFoldBottomB2));
|
|
6234
|
+
paths.push(line11(xSide2, yFoldBottom, xSide2 - diagH, yFoldBottomB2));
|
|
6235
|
+
paths.push(line11(xBack + diagH, yFoldBottomB2, xBack + diagH, yFoldBottomB2 + dip));
|
|
6236
|
+
paths.push(line11(xSide2 - diagH, yFoldBottomB2 + dip, xSide2 - diagH, yFoldBottomB2));
|
|
6237
|
+
paths.push(
|
|
6238
|
+
`M${xBack + diagH} ${yFoldBottomB2 + dip} A${SNAP_R} ${SNAP_R} 0 0 0 ${xBack + diagH + SNAP_R} ${yBottom}`
|
|
6239
|
+
);
|
|
6240
|
+
paths.push(
|
|
6241
|
+
`M${xSide2 - diagH - SNAP_R} ${yBottom} A${SNAP_R} ${SNAP_R} 0 0 0 ${xSide2 - diagH} ${yFoldBottomB2 + dip}`
|
|
6242
|
+
);
|
|
6243
|
+
paths.push(line11(xBack + diagH + SNAP_R, yBottom, xSide2 - diagH - SNAP_R, yBottom));
|
|
6244
|
+
return paths;
|
|
6245
|
+
}
|
|
6246
|
+
function side1Bottom(xSide1, xBack, B, A, yFoldBottom, ySideBottom, dip) {
|
|
6247
|
+
const paths = [];
|
|
6248
|
+
const diagEndX = xSide1 + B / 2;
|
|
6249
|
+
const diagEndY = yFoldBottom + A / 4;
|
|
6250
|
+
const taperV = dip + SNAP_R;
|
|
6251
|
+
const taperH = taperV * TAPER;
|
|
6252
|
+
paths.push(line11(xSide1, yFoldBottom, diagEndX, diagEndY));
|
|
6253
|
+
paths.push(line11(diagEndX, diagEndY, diagEndX - taperH, ySideBottom));
|
|
6254
|
+
paths.push(line11(diagEndX - taperH, ySideBottom, xBack, ySideBottom));
|
|
6255
|
+
return paths;
|
|
6256
|
+
}
|
|
6257
|
+
function side2Bottom(xSide2, xEnd, B, A, yFoldBottom, ySideBottom, dip) {
|
|
6258
|
+
const paths = [];
|
|
6259
|
+
const diagEndX = xSide2 + B / 2;
|
|
6260
|
+
const diagEndY = yFoldBottom + A / 4;
|
|
6261
|
+
const taperV = dip + SNAP_R;
|
|
6262
|
+
const taperH = taperV * TAPER;
|
|
6263
|
+
paths.push(line11(xEnd, yFoldBottom, diagEndX, diagEndY));
|
|
6264
|
+
paths.push(line11(diagEndX, diagEndY, diagEndX + taperH, ySideBottom));
|
|
6265
|
+
paths.push(line11(diagEndX + taperH, ySideBottom, xSide2, ySideBottom));
|
|
6266
|
+
return paths;
|
|
6267
|
+
}
|
|
6268
|
+
function generateDimensions11(attr, unit) {
|
|
6269
|
+
const { length: A, width: B, height: C } = attr;
|
|
6270
|
+
const kulak = calcKulak7(B);
|
|
6271
|
+
const dil = calcDil(A, B, C);
|
|
6272
|
+
const dip = calcDip(B);
|
|
6273
|
+
const xFront = kulak;
|
|
6274
|
+
const xSide1 = kulak + A;
|
|
6275
|
+
const xSide2 = kulak + 2 * A + B;
|
|
6276
|
+
const xEnd = kulak + 2 * A + 2 * B - 0.5;
|
|
6277
|
+
const yFoldTop = B + dil - 1;
|
|
6278
|
+
const yFoldBottom = yFoldTop + C;
|
|
6279
|
+
const yBottom = yFoldBottom + B / 2 + dip + SNAP_R;
|
|
6280
|
+
const totalWidth = xEnd;
|
|
6281
|
+
const totalHeight = yBottom;
|
|
6282
|
+
const factor = unit === "cm" ? 0.1 : unit === "in" ? 1 / 25.4 : 1;
|
|
6283
|
+
const suffix = unit;
|
|
6284
|
+
const fmt = (v) => `${(v * factor).toFixed(2)} ${suffix}`;
|
|
6285
|
+
return [
|
|
6286
|
+
{
|
|
6287
|
+
x1: 0,
|
|
6288
|
+
y1: 0,
|
|
6289
|
+
x2: 0,
|
|
6290
|
+
y2: totalHeight,
|
|
6291
|
+
label: `Overall Height : ${fmt(totalHeight)}`,
|
|
6292
|
+
orientation: "vertical",
|
|
6293
|
+
offset: -12
|
|
6294
|
+
},
|
|
6295
|
+
{
|
|
6296
|
+
x1: 0,
|
|
6297
|
+
y1: 0,
|
|
6298
|
+
x2: totalWidth,
|
|
6299
|
+
y2: 0,
|
|
6300
|
+
label: `Overall Width : ${fmt(totalWidth)}`,
|
|
6301
|
+
orientation: "horizontal",
|
|
6302
|
+
offset: -12
|
|
6303
|
+
},
|
|
6304
|
+
{
|
|
6305
|
+
x1: xSide2,
|
|
6306
|
+
y1: yFoldTop,
|
|
6307
|
+
x2: xSide2,
|
|
6308
|
+
y2: yFoldBottom,
|
|
6309
|
+
label: fmt(C),
|
|
6310
|
+
orientation: "vertical",
|
|
6311
|
+
offset: -14
|
|
6312
|
+
},
|
|
6313
|
+
{
|
|
6314
|
+
x1: xFront,
|
|
6315
|
+
y1: yFoldBottom,
|
|
6316
|
+
x2: xSide1,
|
|
6317
|
+
y2: yFoldBottom,
|
|
6318
|
+
label: fmt(A),
|
|
6319
|
+
orientation: "horizontal",
|
|
6320
|
+
offset: -20
|
|
6321
|
+
},
|
|
6322
|
+
{
|
|
6323
|
+
x1: xSide1,
|
|
6324
|
+
y1: yFoldBottom,
|
|
6325
|
+
x2: xSide1 + B,
|
|
6326
|
+
y2: yFoldBottom,
|
|
6327
|
+
label: fmt(B),
|
|
6328
|
+
orientation: "horizontal",
|
|
6329
|
+
offset: -20
|
|
6330
|
+
}
|
|
6331
|
+
];
|
|
6332
|
+
}
|
|
6333
|
+
var MODEL_ID11 = "BECF-10A0A";
|
|
6334
|
+
var UNIT_FACTOR11 = {
|
|
6335
|
+
mm: 1,
|
|
6336
|
+
cm: 0.1,
|
|
6337
|
+
in: 1 / 25.4
|
|
6338
|
+
};
|
|
6339
|
+
var PX_PER_MM11 = 96 / 25.4;
|
|
6340
|
+
function renderDimension11(dim, i, fs) {
|
|
6341
|
+
const { x1, y1, x2, y2, label, orientation, offset } = dim;
|
|
6342
|
+
const tick = 1.5;
|
|
6343
|
+
if (orientation === "horizontal") {
|
|
6344
|
+
const y = y1 + offset;
|
|
6345
|
+
const midX = (x1 + x2) / 2;
|
|
6346
|
+
return /* @__PURE__ */ jsxs("g", { children: [
|
|
6347
|
+
/* @__PURE__ */ jsx("line", { x1, y1: y, x2, y2: y, stroke: "#000", strokeWidth: 0.2 }),
|
|
6348
|
+
/* @__PURE__ */ jsx("line", { x1, y1: y - tick, x2: x1, y2: y + tick, stroke: "#000", strokeWidth: 0.3 }),
|
|
6349
|
+
/* @__PURE__ */ jsx("line", { x1: x2, y1: y - tick, x2, y2: y + tick, stroke: "#000", strokeWidth: 0.3 }),
|
|
6350
|
+
/* @__PURE__ */ jsx(
|
|
6351
|
+
"text",
|
|
6352
|
+
{
|
|
6353
|
+
x: midX,
|
|
6354
|
+
y: y - 1.5,
|
|
6355
|
+
textAnchor: "middle",
|
|
6356
|
+
fontSize: fs,
|
|
6357
|
+
fontFamily: "sans-serif",
|
|
6358
|
+
fill: "#000",
|
|
6359
|
+
children: label
|
|
6360
|
+
}
|
|
6361
|
+
)
|
|
6362
|
+
] }, `dim-${i}`);
|
|
6363
|
+
}
|
|
6364
|
+
const x = x1 + offset;
|
|
6365
|
+
const midY = (y1 + y2) / 2;
|
|
6366
|
+
return /* @__PURE__ */ jsxs("g", { children: [
|
|
6367
|
+
/* @__PURE__ */ jsx("line", { x1: x, y1, x2: x, y2, stroke: "#000", strokeWidth: 0.2 }),
|
|
6368
|
+
/* @__PURE__ */ jsx("line", { x1: x - tick, y1, x2: x + tick, y2: y1, stroke: "#000", strokeWidth: 0.3 }),
|
|
6369
|
+
/* @__PURE__ */ jsx("line", { x1: x - tick, y1: y2, x2: x + tick, y2, stroke: "#000", strokeWidth: 0.3 }),
|
|
6370
|
+
/* @__PURE__ */ jsx(
|
|
6371
|
+
"text",
|
|
6372
|
+
{
|
|
6373
|
+
x: x - 1.5,
|
|
6374
|
+
y: midY - 1,
|
|
6375
|
+
textAnchor: "middle",
|
|
6376
|
+
dominantBaseline: "central",
|
|
6377
|
+
fontSize: fs,
|
|
6378
|
+
fontFamily: "sans-serif",
|
|
6379
|
+
fill: "#000",
|
|
6380
|
+
transform: `rotate(-90, ${x - 1.5}, ${midY})`,
|
|
6381
|
+
children: label
|
|
6382
|
+
}
|
|
6383
|
+
)
|
|
6384
|
+
] }, `dim-${i}`);
|
|
6385
|
+
}
|
|
6386
|
+
var DIE_LINE_BECF_10A0A = forwardRef(
|
|
6387
|
+
({
|
|
6388
|
+
attributes,
|
|
6389
|
+
unit = "mm",
|
|
6390
|
+
isShowDimensions = false,
|
|
6391
|
+
renderAs = "svg"
|
|
6392
|
+
}, ref) => {
|
|
6393
|
+
const theme = useMemo(
|
|
6394
|
+
() => getModelTheme(),
|
|
6395
|
+
[]
|
|
6396
|
+
);
|
|
6397
|
+
const svgRef = useRef(null);
|
|
6398
|
+
const dieline = useMemo(() => generateBecf10a0a(attributes), [attributes]);
|
|
6399
|
+
const dimensions = useMemo(
|
|
6400
|
+
() => generateDimensions11(attributes, unit),
|
|
6401
|
+
[attributes, unit]
|
|
6402
|
+
);
|
|
6403
|
+
const factor = UNIT_FACTOR11[unit] ?? 1;
|
|
6404
|
+
const serializeSvg = useCallback(
|
|
6405
|
+
(showDimensions) => {
|
|
6406
|
+
const svg = svgRef.current;
|
|
6407
|
+
if (!svg) throw new Error("SVG not mounted");
|
|
6408
|
+
const clone = svg.cloneNode(true);
|
|
6409
|
+
if (!showDimensions) {
|
|
6410
|
+
const dimGroup = clone.querySelector("#dimensions");
|
|
6411
|
+
dimGroup?.remove();
|
|
6412
|
+
}
|
|
6413
|
+
return new XMLSerializer().serializeToString(clone);
|
|
6414
|
+
},
|
|
6415
|
+
[]
|
|
6416
|
+
);
|
|
6417
|
+
useImperativeHandle(
|
|
6418
|
+
ref,
|
|
6419
|
+
() => {
|
|
6420
|
+
const { length: A, width: B, height: C } = attributes;
|
|
6421
|
+
const kulak = calcKulak7(B);
|
|
6422
|
+
const dil = calcDil(A, B, C);
|
|
6423
|
+
const dip = calcDip(B);
|
|
6424
|
+
const flap = Math.min(A / 2, B / 2 + dil / 2 - 0.5);
|
|
6425
|
+
return {
|
|
6426
|
+
getAttributes: () => ({
|
|
6427
|
+
modelId: MODEL_ID11,
|
|
6428
|
+
overallWidth: dieline.viewBox.width * factor,
|
|
6429
|
+
overallHeight: dieline.viewBox.height * factor,
|
|
6430
|
+
length: A * factor,
|
|
6431
|
+
width: B * factor,
|
|
6432
|
+
height: C * factor,
|
|
6433
|
+
kulak: kulak * factor,
|
|
6434
|
+
dil: dil * factor,
|
|
6435
|
+
flap: flap * factor,
|
|
6436
|
+
dip: dip * factor
|
|
6437
|
+
}),
|
|
6438
|
+
exportImage: async (options) => {
|
|
6439
|
+
const svgStr = serializeSvg(options.isShowDimension);
|
|
6440
|
+
const blob = new Blob([svgStr], {
|
|
6441
|
+
type: "image/svg+xml;charset=utf-8"
|
|
6442
|
+
});
|
|
6443
|
+
const url = URL.createObjectURL(blob);
|
|
6444
|
+
const img = new Image();
|
|
6445
|
+
await new Promise((resolve, reject) => {
|
|
6446
|
+
img.onload = () => resolve();
|
|
6447
|
+
img.onerror = reject;
|
|
6448
|
+
img.src = url;
|
|
6449
|
+
});
|
|
6450
|
+
const canvas = document.createElement("canvas");
|
|
6451
|
+
if (options.originalSize) {
|
|
6452
|
+
canvas.width = Math.round(dieline.viewBox.width * PX_PER_MM11);
|
|
6453
|
+
canvas.height = Math.round(dieline.viewBox.height * PX_PER_MM11);
|
|
6454
|
+
} else {
|
|
6455
|
+
canvas.width = 1920;
|
|
6456
|
+
canvas.height = 1080;
|
|
6457
|
+
}
|
|
6458
|
+
const ctx = canvas.getContext("2d");
|
|
6459
|
+
ctx.fillStyle = "#ffffff";
|
|
6460
|
+
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
|
6461
|
+
ctx.drawImage(img, 0, 0, canvas.width, canvas.height);
|
|
6462
|
+
URL.revokeObjectURL(url);
|
|
6463
|
+
return new Promise((resolve, reject) => {
|
|
6464
|
+
canvas.toBlob(
|
|
6465
|
+
(b) => b ? resolve(b) : reject(new Error("Export failed")),
|
|
6466
|
+
"image/png"
|
|
6467
|
+
);
|
|
6468
|
+
});
|
|
6469
|
+
},
|
|
6470
|
+
exportDimension: async () => {
|
|
6471
|
+
const dimData = generateDimensions11(attributes, unit);
|
|
6472
|
+
return exportDimensionPdf({
|
|
6473
|
+
modelId: MODEL_ID11,
|
|
6474
|
+
dieline,
|
|
6475
|
+
dimensions: dimData,
|
|
6476
|
+
attributes,
|
|
6477
|
+
unit,
|
|
6478
|
+
factor,
|
|
6479
|
+
theme
|
|
6480
|
+
});
|
|
6481
|
+
}
|
|
6482
|
+
};
|
|
6483
|
+
},
|
|
6484
|
+
[attributes, dieline, factor, unit, serializeSvg, theme]
|
|
6485
|
+
);
|
|
6486
|
+
const padding = isShowDimensions ? 15 : 0;
|
|
6487
|
+
const vbX = -padding;
|
|
6488
|
+
const vbY = -padding;
|
|
6489
|
+
const vbW = dieline.viewBox.width + padding * 2;
|
|
6490
|
+
const vbH = dieline.viewBox.height + padding * 2;
|
|
6491
|
+
const svgChildren = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
6492
|
+
/* @__PURE__ */ jsx("g", { id: "crease", children: dieline.crease.map((d, i) => /* @__PURE__ */ jsx("path", { d, fill: "none", stroke: theme.colorFoldLine, strokeWidth: 0.5, strokeDasharray: "2,1" }, `c-${i}`)) }),
|
|
6493
|
+
/* @__PURE__ */ jsx("g", { id: "cut", children: dieline.cut.map((d, i) => /* @__PURE__ */ jsx("path", { d, fill: "none", stroke: theme.colorDieLine, strokeWidth: 0.5 }, `t-${i}`)) }),
|
|
6494
|
+
isShowDimensions && /* @__PURE__ */ jsx("g", { id: "dimensions", children: dimensions.map((d, i) => renderDimension11(d, i, getFontDimensionSize())) })
|
|
6495
|
+
] });
|
|
6496
|
+
if (renderAs === "group") {
|
|
6497
|
+
return /* @__PURE__ */ jsx("g", { children: svgChildren });
|
|
6498
|
+
}
|
|
6499
|
+
return /* @__PURE__ */ jsx(
|
|
6500
|
+
"svg",
|
|
6501
|
+
{
|
|
6502
|
+
ref: svgRef,
|
|
6503
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
6504
|
+
viewBox: `${vbX} ${vbY} ${vbW} ${vbH}`,
|
|
6505
|
+
preserveAspectRatio: "xMidYMid meet",
|
|
6506
|
+
style: { backgroundColor: theme.colorBackground },
|
|
6507
|
+
children: svgChildren
|
|
6508
|
+
}
|
|
6509
|
+
);
|
|
6510
|
+
}
|
|
6511
|
+
);
|
|
6512
|
+
var CANVAS_BECF_10A0A = forwardRef(
|
|
6513
|
+
(props, ref) => {
|
|
6514
|
+
const dieLineRef = useRef(null);
|
|
6515
|
+
const canvasRef = useRef(null);
|
|
6516
|
+
const { attributes } = props;
|
|
6517
|
+
const theme = useMemo(
|
|
6518
|
+
() => getModelTheme(),
|
|
6519
|
+
[]
|
|
6520
|
+
);
|
|
6521
|
+
const dieline = useMemo(() => generateBecf10a0a(attributes), [attributes]);
|
|
6522
|
+
const stablePadding = 15;
|
|
6523
|
+
const viewBox = useMemo(
|
|
6524
|
+
() => ({
|
|
6525
|
+
x: -stablePadding,
|
|
6526
|
+
y: -stablePadding,
|
|
6527
|
+
width: dieline.viewBox.width + stablePadding * 2,
|
|
6528
|
+
height: dieline.viewBox.height + stablePadding * 2
|
|
6529
|
+
}),
|
|
6530
|
+
[dieline.viewBox.width, dieline.viewBox.height]
|
|
6531
|
+
);
|
|
6532
|
+
const serializeCanvasSvg = useCallback((showDimensions) => {
|
|
6533
|
+
const svg = canvasRef.current?.getSvgElement();
|
|
6534
|
+
if (!svg) throw new Error("SVG not mounted");
|
|
6535
|
+
const clone = svg.cloneNode(true);
|
|
6536
|
+
if (!showDimensions) {
|
|
6537
|
+
const dimGroup = clone.querySelector("#dimensions");
|
|
6538
|
+
dimGroup?.remove();
|
|
6539
|
+
}
|
|
6540
|
+
return new XMLSerializer().serializeToString(clone);
|
|
6541
|
+
}, []);
|
|
6542
|
+
useImperativeHandle(ref, () => ({
|
|
6543
|
+
getAttributes: () => dieLineRef.current.getAttributes(),
|
|
6544
|
+
exportImage: async (options) => {
|
|
6545
|
+
const svgStr = serializeCanvasSvg(options.isShowDimension);
|
|
6546
|
+
const blob = new Blob([svgStr], { type: "image/svg+xml;charset=utf-8" });
|
|
6547
|
+
const url = URL.createObjectURL(blob);
|
|
6548
|
+
const img = new Image();
|
|
6549
|
+
await new Promise((resolve, reject) => {
|
|
6550
|
+
img.onload = () => resolve();
|
|
6551
|
+
img.onerror = reject;
|
|
6552
|
+
img.src = url;
|
|
6553
|
+
});
|
|
6554
|
+
const canvas = document.createElement("canvas");
|
|
6555
|
+
if (options.originalSize) {
|
|
6556
|
+
canvas.width = Math.round(dieline.viewBox.width * PX_PER_MM11);
|
|
6557
|
+
canvas.height = Math.round(dieline.viewBox.height * PX_PER_MM11);
|
|
6558
|
+
} else {
|
|
6559
|
+
canvas.width = 1920;
|
|
6560
|
+
canvas.height = 1080;
|
|
6561
|
+
}
|
|
6562
|
+
const ctx = canvas.getContext("2d");
|
|
6563
|
+
ctx.fillStyle = "#ffffff";
|
|
6564
|
+
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
|
6565
|
+
ctx.drawImage(img, 0, 0, canvas.width, canvas.height);
|
|
6566
|
+
URL.revokeObjectURL(url);
|
|
6567
|
+
return new Promise((resolve, reject) => {
|
|
6568
|
+
canvas.toBlob(
|
|
6569
|
+
(b) => b ? resolve(b) : reject(new Error("Export failed")),
|
|
6570
|
+
"image/png"
|
|
6571
|
+
);
|
|
6572
|
+
});
|
|
6573
|
+
},
|
|
6574
|
+
exportDimension: () => dieLineRef.current.exportDimension(),
|
|
6575
|
+
resetView: () => canvasRef.current?.resetView(),
|
|
6576
|
+
fitView: () => canvasRef.current?.fitView()
|
|
6577
|
+
}), [serializeCanvasSvg, dieline.viewBox.width, dieline.viewBox.height]);
|
|
6578
|
+
return /* @__PURE__ */ jsx(
|
|
6579
|
+
BaseCanvas,
|
|
6580
|
+
{
|
|
6581
|
+
ref: canvasRef,
|
|
6582
|
+
viewBox,
|
|
6583
|
+
backgroundColor: theme.colorBackground,
|
|
6584
|
+
children: /* @__PURE__ */ jsx(DIE_LINE_BECF_10A0A, { ref: dieLineRef, ...props, renderAs: "group" })
|
|
6585
|
+
}
|
|
6586
|
+
);
|
|
6587
|
+
}
|
|
6588
|
+
);
|
|
6589
|
+
var MODEL_BECF_10A0A = forwardRef(
|
|
6590
|
+
({ mode = "DIE_LINE", ...props }, ref) => {
|
|
6591
|
+
return /* @__PURE__ */ jsx(Fragment, { children: (() => {
|
|
6592
|
+
switch (mode) {
|
|
6593
|
+
case "DIE_LINE":
|
|
6594
|
+
return /* @__PURE__ */ jsx(CANVAS_BECF_10A0A, { ref, ...props });
|
|
6595
|
+
case "3D":
|
|
6596
|
+
return null;
|
|
6597
|
+
case "AUTO_LAYOUT":
|
|
6598
|
+
return /* @__PURE__ */ jsx(DIE_LINE_BECF_10A0A, { ref, ...props });
|
|
6599
|
+
default:
|
|
6600
|
+
return null;
|
|
6601
|
+
}
|
|
6602
|
+
})() });
|
|
6603
|
+
}
|
|
6604
|
+
);
|
|
6605
|
+
|
|
6606
|
+
// src/utils/autoLayout/rasterize.ts
|
|
6607
|
+
function rasterizePolygon(points, resolution) {
|
|
6608
|
+
let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
|
|
6609
|
+
for (const p of points) {
|
|
6610
|
+
if (p.x < minX) minX = p.x;
|
|
6611
|
+
if (p.y < minY) minY = p.y;
|
|
6612
|
+
if (p.x > maxX) maxX = p.x;
|
|
6613
|
+
if (p.y > maxY) maxY = p.y;
|
|
6614
|
+
}
|
|
6615
|
+
const offsetX = Math.floor(minX / resolution);
|
|
6616
|
+
const offsetY = Math.floor(minY / resolution);
|
|
6617
|
+
const w = Math.ceil((maxX - offsetX * resolution) / resolution) + 1;
|
|
6618
|
+
const h = Math.ceil((maxY - offsetY * resolution) / resolution) + 1;
|
|
6619
|
+
const data = new Uint8Array(w * h);
|
|
6620
|
+
for (let gy = 0; gy < h; gy++) {
|
|
6621
|
+
const worldY = (offsetY + gy) * resolution + resolution / 2;
|
|
6622
|
+
const crossings = [];
|
|
6623
|
+
for (let i = 0, j = points.length - 1; i < points.length; j = i++) {
|
|
6624
|
+
const yi = points[i].y, yj = points[j].y;
|
|
6625
|
+
if (yi <= worldY && yj > worldY || yj <= worldY && yi > worldY) {
|
|
6626
|
+
const t = (worldY - yi) / (yj - yi);
|
|
6627
|
+
crossings.push(points[i].x + t * (points[j].x - points[i].x));
|
|
6628
|
+
}
|
|
6629
|
+
}
|
|
6630
|
+
crossings.sort((a, b) => a - b);
|
|
6631
|
+
for (let c = 0; c < crossings.length - 1; c += 2) {
|
|
6632
|
+
const startGx = Math.max(0, Math.floor((crossings[c] - offsetX * resolution) / resolution));
|
|
6633
|
+
const endGx = Math.min(w - 1, Math.ceil((crossings[c + 1] - offsetX * resolution) / resolution));
|
|
6634
|
+
for (let gx = startGx; gx <= endGx; gx++) {
|
|
6635
|
+
data[gy * w + gx] = 1;
|
|
6636
|
+
}
|
|
6637
|
+
}
|
|
6638
|
+
}
|
|
6639
|
+
return { data, width: w, height: h, offsetX, offsetY };
|
|
6640
|
+
}
|
|
6641
|
+
function canPlace(paperGrid, paperW, paperH, piece, px, py) {
|
|
6642
|
+
for (let y = 0; y < piece.height; y++) {
|
|
6643
|
+
const paperY = py + y;
|
|
6644
|
+
if (paperY < 0 || paperY >= paperH) {
|
|
6645
|
+
for (let x = 0; x < piece.width; x++) {
|
|
6646
|
+
if (piece.data[y * piece.width + x]) return false;
|
|
6647
|
+
}
|
|
6648
|
+
continue;
|
|
6649
|
+
}
|
|
6650
|
+
for (let x = 0; x < piece.width; x++) {
|
|
6651
|
+
if (!piece.data[y * piece.width + x]) continue;
|
|
6652
|
+
const paperX = px + x;
|
|
6653
|
+
if (paperX < 0 || paperX >= paperW) return false;
|
|
6654
|
+
if (paperGrid[paperY * paperW + paperX]) return false;
|
|
6655
|
+
}
|
|
6656
|
+
}
|
|
6657
|
+
return true;
|
|
6658
|
+
}
|
|
6659
|
+
function placePiece(paperGrid, paperW, piece, px, py) {
|
|
6660
|
+
for (let y = 0; y < piece.height; y++) {
|
|
6661
|
+
for (let x = 0; x < piece.width; x++) {
|
|
6662
|
+
if (piece.data[y * piece.width + x]) {
|
|
6663
|
+
paperGrid[(py + y) * paperW + (px + x)] = 1;
|
|
6664
|
+
}
|
|
6665
|
+
}
|
|
6666
|
+
}
|
|
6667
|
+
}
|
|
6668
|
+
|
|
6669
|
+
// src/utils/autoLayout/calculate/shared.ts
|
|
6670
|
+
var RESOLUTION = 1;
|
|
6671
|
+
function resolveGripperSide(paperWidth, paperHeight) {
|
|
6672
|
+
if (paperWidth >= paperHeight) return "bottom";
|
|
6673
|
+
return "left";
|
|
6674
|
+
}
|
|
6675
|
+
function computeUsableBounds(paperWidth, paperHeight, gripperSide, spacing, griper, colorbarDepth) {
|
|
6676
|
+
switch (gripperSide) {
|
|
6677
|
+
case "bottom":
|
|
6678
|
+
return {
|
|
6679
|
+
top: colorbarDepth + spacing,
|
|
6680
|
+
bottom: paperHeight - griper,
|
|
6681
|
+
left: spacing,
|
|
6682
|
+
right: paperWidth - spacing
|
|
6683
|
+
};
|
|
6684
|
+
case "top":
|
|
6685
|
+
return {
|
|
6686
|
+
top: griper,
|
|
6687
|
+
bottom: paperHeight - colorbarDepth - spacing,
|
|
6688
|
+
left: spacing,
|
|
6689
|
+
right: paperWidth - spacing
|
|
6690
|
+
};
|
|
6691
|
+
case "left":
|
|
6692
|
+
return {
|
|
6693
|
+
top: spacing,
|
|
6694
|
+
bottom: paperHeight - spacing,
|
|
6695
|
+
left: griper,
|
|
6696
|
+
right: paperWidth - colorbarDepth - spacing
|
|
6697
|
+
};
|
|
6698
|
+
case "right":
|
|
6699
|
+
return {
|
|
6700
|
+
top: spacing,
|
|
6701
|
+
bottom: paperHeight - spacing,
|
|
6702
|
+
left: colorbarDepth + spacing,
|
|
6703
|
+
right: paperWidth - griper
|
|
6704
|
+
};
|
|
6705
|
+
}
|
|
6706
|
+
}
|
|
6707
|
+
function normalizePoints(points, degrees) {
|
|
6708
|
+
const rad = degrees * Math.PI / 180;
|
|
6709
|
+
const cos = Math.cos(rad);
|
|
6710
|
+
const sin = Math.sin(rad);
|
|
6711
|
+
const rotated = points.map((p) => ({
|
|
6712
|
+
x: p.x * cos - p.y * sin,
|
|
6713
|
+
y: p.x * sin + p.y * cos
|
|
6714
|
+
}));
|
|
6715
|
+
let minX = Infinity, minY = Infinity;
|
|
6716
|
+
for (const p of rotated) {
|
|
6717
|
+
if (p.x < minX) minX = p.x;
|
|
6718
|
+
if (p.y < minY) minY = p.y;
|
|
6719
|
+
}
|
|
6720
|
+
return rotated.map((p) => ({ x: p.x - minX, y: p.y - minY }));
|
|
6721
|
+
}
|
|
6722
|
+
function computeDielineBBOffset(offsetContourPoints, dielineW, dielineH, degrees) {
|
|
6723
|
+
const rad = degrees * Math.PI / 180;
|
|
6724
|
+
const cos = Math.cos(rad);
|
|
6725
|
+
const sin = Math.sin(rad);
|
|
6726
|
+
let ocMinX = Infinity, ocMinY = Infinity;
|
|
6727
|
+
for (const p of offsetContourPoints) {
|
|
6728
|
+
const rx = p.x * cos - p.y * sin;
|
|
6729
|
+
const ry = p.x * sin + p.y * cos;
|
|
6730
|
+
if (rx < ocMinX) ocMinX = rx;
|
|
6731
|
+
if (ry < ocMinY) ocMinY = ry;
|
|
6732
|
+
}
|
|
6733
|
+
const corners = [[0, 0], [dielineW, 0], [0, dielineH], [dielineW, dielineH]];
|
|
6734
|
+
let dlMinX = Infinity, dlMinY = Infinity;
|
|
6735
|
+
for (const [cx, cy] of corners) {
|
|
6736
|
+
const rx = cx * cos - cy * sin;
|
|
6737
|
+
const ry = cx * sin + cy * cos;
|
|
6738
|
+
if (rx < dlMinX) dlMinX = rx;
|
|
6739
|
+
if (ry < dlMinY) dlMinY = ry;
|
|
6740
|
+
}
|
|
6741
|
+
return { dx: dlMinX - ocMinX, dy: dlMinY - ocMinY };
|
|
6742
|
+
}
|
|
6743
|
+
function computeLayoutForPaperDefault(contourPoints, dielineW, dielineH, paperWidth, paperHeight, bounds) {
|
|
6744
|
+
const usableLeft = Math.ceil(bounds.left / RESOLUTION);
|
|
6745
|
+
const usableTop = Math.ceil(bounds.top / RESOLUTION);
|
|
6746
|
+
const usableRight = Math.floor(bounds.right / RESOLUTION);
|
|
6747
|
+
const usableBottom = Math.floor(bounds.bottom / RESOLUTION);
|
|
6748
|
+
const paperW = Math.floor(paperWidth / RESOLUTION);
|
|
6749
|
+
const paperH = Math.floor(paperHeight / RESOLUTION);
|
|
6750
|
+
let bestCandidate = { rotation: 0, placements: [], producedPerSheet: 0 };
|
|
6751
|
+
let bestGridPositions = [];
|
|
6752
|
+
let bestBitmapW = 0;
|
|
6753
|
+
let bestBitmapH = 0;
|
|
6754
|
+
for (const deg of [0, 90, 180, 270]) {
|
|
6755
|
+
const rotatedContour = normalizePoints(contourPoints, deg);
|
|
6756
|
+
const pieceBitmap = rasterizePolygon(rotatedContour, RESOLUTION);
|
|
6757
|
+
const bbOffset = computeDielineBBOffset(contourPoints, dielineW, dielineH, deg);
|
|
6758
|
+
const paperGrid = new Uint8Array(paperW * paperH);
|
|
6759
|
+
const placements = [];
|
|
6760
|
+
const gridPositions = [];
|
|
6761
|
+
for (let py = usableTop; py <= usableBottom - pieceBitmap.height; py++) {
|
|
6762
|
+
for (let px = usableLeft; px <= usableRight - pieceBitmap.width; px++) {
|
|
6763
|
+
if (canPlace(paperGrid, paperW, paperH, pieceBitmap, px, py)) {
|
|
6764
|
+
placePiece(paperGrid, paperW, pieceBitmap, px, py);
|
|
6765
|
+
gridPositions.push({ px, py });
|
|
6766
|
+
placements.push({
|
|
6767
|
+
x: px * RESOLUTION + bbOffset.dx,
|
|
6768
|
+
y: py * RESOLUTION + bbOffset.dy,
|
|
6769
|
+
rotation: deg
|
|
6770
|
+
});
|
|
6771
|
+
}
|
|
6772
|
+
}
|
|
6773
|
+
}
|
|
6774
|
+
if (placements.length > bestCandidate.producedPerSheet) {
|
|
6775
|
+
bestCandidate = { rotation: deg, placements, producedPerSheet: placements.length };
|
|
6776
|
+
bestGridPositions = gridPositions;
|
|
6777
|
+
bestBitmapW = pieceBitmap.width;
|
|
6778
|
+
bestBitmapH = pieceBitmap.height;
|
|
6779
|
+
}
|
|
6780
|
+
}
|
|
6781
|
+
if (bestCandidate.placements.length > 0) {
|
|
6782
|
+
let gridMinX = Infinity;
|
|
6783
|
+
let gridMinY = Infinity;
|
|
6784
|
+
let gridMaxX = -Infinity;
|
|
6785
|
+
let gridMaxY = -Infinity;
|
|
6786
|
+
for (const { px, py } of bestGridPositions) {
|
|
6787
|
+
if (px < gridMinX) gridMinX = px;
|
|
6788
|
+
if (py < gridMinY) gridMinY = py;
|
|
6789
|
+
if (px + bestBitmapW > gridMaxX) gridMaxX = px + bestBitmapW;
|
|
6790
|
+
if (py + bestBitmapH > gridMaxY) gridMaxY = py + bestBitmapH;
|
|
6791
|
+
}
|
|
4374
6792
|
const groupW = gridMaxX - gridMinX;
|
|
4375
6793
|
const groupH = gridMaxY - gridMinY;
|
|
4376
6794
|
const usableW = usableRight - usableLeft;
|
|
@@ -4382,52 +6800,615 @@ function computeLayoutForPaperDefault(contourPoints, dielineW, dielineH, paperWi
|
|
|
4382
6800
|
p.y += offsetY;
|
|
4383
6801
|
}
|
|
4384
6802
|
}
|
|
4385
|
-
return bestCandidate;
|
|
6803
|
+
return bestCandidate;
|
|
6804
|
+
}
|
|
6805
|
+
|
|
6806
|
+
// src/utils/autoLayout/calculate/tuck-end-boxes/becf-1010a/index.ts
|
|
6807
|
+
var SAMPLE_STEP = 0.1;
|
|
6808
|
+
function buildProfile(points) {
|
|
6809
|
+
let maxX = 0, maxY = 0;
|
|
6810
|
+
for (const p of points) {
|
|
6811
|
+
if (p.x > maxX) maxX = p.x;
|
|
6812
|
+
if (p.y > maxY) maxY = p.y;
|
|
6813
|
+
}
|
|
6814
|
+
const width = maxX, height = maxY;
|
|
6815
|
+
const nY = Math.ceil(height / SAMPLE_STEP) + 1;
|
|
6816
|
+
const nX = Math.ceil(width / SAMPLE_STEP) + 1;
|
|
6817
|
+
const rightX = new Float64Array(nY).fill(-Infinity);
|
|
6818
|
+
const leftX = new Float64Array(nY).fill(Infinity);
|
|
6819
|
+
const bottomY = new Float64Array(nX).fill(-Infinity);
|
|
6820
|
+
const topY = new Float64Array(nX).fill(Infinity);
|
|
6821
|
+
const nPts = points.length;
|
|
6822
|
+
for (let iy = 0; iy < nY; iy++) {
|
|
6823
|
+
const y = iy * SAMPLE_STEP;
|
|
6824
|
+
for (let j = 0, k = nPts - 1; j < nPts; k = j++) {
|
|
6825
|
+
const yj = points[j].y, yk = points[k].y;
|
|
6826
|
+
if (yj <= y && yk > y || yk <= y && yj > y) {
|
|
6827
|
+
const t = (y - yj) / (yk - yj);
|
|
6828
|
+
const x = points[j].x + t * (points[k].x - points[j].x);
|
|
6829
|
+
if (x > rightX[iy]) rightX[iy] = x;
|
|
6830
|
+
if (x < leftX[iy]) leftX[iy] = x;
|
|
6831
|
+
}
|
|
6832
|
+
}
|
|
6833
|
+
}
|
|
6834
|
+
for (let ix = 0; ix < nX; ix++) {
|
|
6835
|
+
const x = ix * SAMPLE_STEP;
|
|
6836
|
+
for (let j = 0, k = nPts - 1; j < nPts; k = j++) {
|
|
6837
|
+
const xj = points[j].x, xk = points[k].x;
|
|
6838
|
+
if (xj <= x && xk > x || xk <= x && xj > x) {
|
|
6839
|
+
const t = (x - xj) / (xk - xj);
|
|
6840
|
+
const y = points[j].y + t * (points[k].y - points[j].y);
|
|
6841
|
+
if (y > bottomY[ix]) bottomY[ix] = y;
|
|
6842
|
+
if (y < topY[ix]) topY[ix] = y;
|
|
6843
|
+
}
|
|
6844
|
+
}
|
|
6845
|
+
}
|
|
6846
|
+
return { width, height, nY, nX, rightX, leftX, bottomY, topY };
|
|
6847
|
+
}
|
|
6848
|
+
function prepareRotation(contourPoints, dielineW, dielineH, deg) {
|
|
6849
|
+
const rotated = normalizePoints(contourPoints, deg);
|
|
6850
|
+
return {
|
|
6851
|
+
profile: buildProfile(rotated),
|
|
6852
|
+
bbOffset: computeDielineBBOffset(contourPoints, dielineW, dielineH, deg),
|
|
6853
|
+
deg
|
|
6854
|
+
};
|
|
6855
|
+
}
|
|
6856
|
+
function findMinStepX(a, b, dyMm) {
|
|
6857
|
+
const dySamples = Math.round(dyMm / SAMPLE_STEP);
|
|
6858
|
+
let maxOverlap = -Infinity;
|
|
6859
|
+
for (let ia = 0; ia < a.nY; ia++) {
|
|
6860
|
+
const ib = ia - dySamples;
|
|
6861
|
+
if (ib < 0 || ib >= b.nY) continue;
|
|
6862
|
+
if (a.rightX[ia] === -Infinity || b.leftX[ib] === Infinity) continue;
|
|
6863
|
+
const overlap = a.rightX[ia] - b.leftX[ib];
|
|
6864
|
+
if (overlap > maxOverlap) maxOverlap = overlap;
|
|
6865
|
+
}
|
|
6866
|
+
return maxOverlap <= -Infinity ? 0 : maxOverlap;
|
|
6867
|
+
}
|
|
6868
|
+
function findMinStepY(a, b, dxMm) {
|
|
6869
|
+
const dxSamples = Math.round(dxMm / SAMPLE_STEP);
|
|
6870
|
+
let maxOverlap = -Infinity;
|
|
6871
|
+
for (let ia = 0; ia < a.nX; ia++) {
|
|
6872
|
+
const ib = ia - dxSamples;
|
|
6873
|
+
if (ib < 0 || ib >= b.nX) continue;
|
|
6874
|
+
if (a.bottomY[ia] === -Infinity || b.topY[ib] === Infinity) continue;
|
|
6875
|
+
const overlap = a.bottomY[ia] - b.topY[ib];
|
|
6876
|
+
if (overlap > maxOverlap) maxOverlap = overlap;
|
|
6877
|
+
}
|
|
6878
|
+
return maxOverlap <= -Infinity ? 0 : maxOverlap;
|
|
6879
|
+
}
|
|
6880
|
+
function findMinStepY_multi(profA, stepX_A, profB, offsetX) {
|
|
6881
|
+
const reach = Math.max(profA.width, profB.width);
|
|
6882
|
+
let maxStep = 0;
|
|
6883
|
+
const nMin = Math.floor((offsetX - reach) / stepX_A);
|
|
6884
|
+
const nMax = Math.ceil((offsetX + reach) / stepX_A);
|
|
6885
|
+
for (let n = nMin; n <= nMax; n++) {
|
|
6886
|
+
const s = findMinStepY(profA, profB, offsetX - n * stepX_A);
|
|
6887
|
+
if (s > maxStep) maxStep = s;
|
|
6888
|
+
}
|
|
6889
|
+
return maxStep;
|
|
6890
|
+
}
|
|
6891
|
+
function emptyResult() {
|
|
6892
|
+
return { placements: [], count: 0, minX: 0, minY: 0, maxX: 0, maxY: 0 };
|
|
6893
|
+
}
|
|
6894
|
+
function singleRotGrid(rd, bounds) {
|
|
6895
|
+
const p = rd.profile;
|
|
6896
|
+
const stepX = findMinStepX(p, p, 0);
|
|
6897
|
+
const stepY = findMinStepY(p, p, 0);
|
|
6898
|
+
if (stepX <= 0 || stepY <= 0) return emptyResult();
|
|
6899
|
+
const cols = Math.max(0, Math.floor((bounds.right - bounds.left - p.width) / stepX) + 1);
|
|
6900
|
+
const rows = Math.max(0, Math.floor((bounds.bottom - bounds.top - p.height) / stepY) + 1);
|
|
6901
|
+
if (cols === 0 || rows === 0) return emptyResult();
|
|
6902
|
+
const placements = [];
|
|
6903
|
+
let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
|
|
6904
|
+
for (let r = 0; r < rows; r++) {
|
|
6905
|
+
for (let c = 0; c < cols; c++) {
|
|
6906
|
+
const ox = bounds.left + c * stepX;
|
|
6907
|
+
const oy = bounds.top + r * stepY;
|
|
6908
|
+
placements.push({ x: ox + rd.bbOffset.dx, y: oy + rd.bbOffset.dy, rotation: rd.deg });
|
|
6909
|
+
if (ox < minX) minX = ox;
|
|
6910
|
+
if (oy < minY) minY = oy;
|
|
6911
|
+
if (ox + p.width > maxX) maxX = ox + p.width;
|
|
6912
|
+
if (oy + p.height > maxY) maxY = oy + p.height;
|
|
6913
|
+
}
|
|
6914
|
+
}
|
|
6915
|
+
return { placements, count: placements.length, minX, minY, maxX, maxY };
|
|
6916
|
+
}
|
|
6917
|
+
function dualRotGrid(rdA, rdB, offsetX, bounds) {
|
|
6918
|
+
const pA = rdA.profile, pB = rdB.profile;
|
|
6919
|
+
const stepX_A = findMinStepX(pA, pA, 0);
|
|
6920
|
+
const stepX_B = findMinStepX(pB, pB, 0);
|
|
6921
|
+
if (stepX_A <= 0 || stepX_B <= 0) return emptyResult();
|
|
6922
|
+
let stepY_AB = findMinStepY_multi(pA, stepX_A, pB, offsetX);
|
|
6923
|
+
let stepY_BA = findMinStepY_multi(pB, stepX_B, pA, -offsetX);
|
|
6924
|
+
if (stepY_AB + stepY_BA <= 0) return emptyResult();
|
|
6925
|
+
const minAA = findMinStepY_multi(pA, stepX_A, pA, 0);
|
|
6926
|
+
const minBB = findMinStepY_multi(pB, stepX_B, pB, 0);
|
|
6927
|
+
const cycle = stepY_AB + stepY_BA;
|
|
6928
|
+
const neededCycle = Math.max(cycle, minAA, minBB);
|
|
6929
|
+
if (neededCycle > cycle) {
|
|
6930
|
+
const scale = neededCycle / cycle;
|
|
6931
|
+
stepY_AB *= scale;
|
|
6932
|
+
stepY_BA *= scale;
|
|
6933
|
+
}
|
|
6934
|
+
const placements = [];
|
|
6935
|
+
let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
|
|
6936
|
+
let oy = bounds.top;
|
|
6937
|
+
let isRowA = true;
|
|
6938
|
+
while (true) {
|
|
6939
|
+
const rd = isRowA ? rdA : rdB;
|
|
6940
|
+
const p = rd.profile;
|
|
6941
|
+
const stepX = isRowA ? stepX_A : stepX_B;
|
|
6942
|
+
if (oy + p.height > bounds.bottom) break;
|
|
6943
|
+
let sx = isRowA ? bounds.left : bounds.left + offsetX;
|
|
6944
|
+
if (sx < bounds.left) sx += stepX * Math.ceil((bounds.left - sx) / stepX);
|
|
6945
|
+
for (let ox = sx; ox + p.width <= bounds.right; ox += stepX) {
|
|
6946
|
+
placements.push({ x: ox + rd.bbOffset.dx, y: oy + rd.bbOffset.dy, rotation: rd.deg });
|
|
6947
|
+
if (ox < minX) minX = ox;
|
|
6948
|
+
if (oy < minY) minY = oy;
|
|
6949
|
+
if (ox + p.width > maxX) maxX = ox + p.width;
|
|
6950
|
+
if (oy + p.height > maxY) maxY = oy + p.height;
|
|
6951
|
+
}
|
|
6952
|
+
oy += isRowA ? stepY_AB : stepY_BA;
|
|
6953
|
+
isRowA = !isRowA;
|
|
6954
|
+
}
|
|
6955
|
+
if (placements.length === 0) return emptyResult();
|
|
6956
|
+
return { placements, count: placements.length, minX, minY, maxX, maxY };
|
|
6957
|
+
}
|
|
6958
|
+
function centerLayout(result, bounds) {
|
|
6959
|
+
if (result.count === 0) return;
|
|
6960
|
+
const offX = (bounds.right - bounds.left - (result.maxX - result.minX)) / 2 - (result.minX - bounds.left);
|
|
6961
|
+
const offY = (bounds.bottom - bounds.top - (result.maxY - result.minY)) / 2 - (result.minY - bounds.top);
|
|
6962
|
+
for (const p of result.placements) {
|
|
6963
|
+
p.x += offX;
|
|
6964
|
+
p.y += offY;
|
|
6965
|
+
}
|
|
6966
|
+
}
|
|
6967
|
+
function computeLayoutForPaper(contourPoints, dielineW, dielineH, _paperWidth, _paperHeight, bounds) {
|
|
6968
|
+
const rots = [0, 90, 180, 270];
|
|
6969
|
+
const rd = /* @__PURE__ */ new Map();
|
|
6970
|
+
for (const deg of rots) {
|
|
6971
|
+
rd.set(deg, prepareRotation(contourPoints, dielineW, dielineH, deg));
|
|
6972
|
+
}
|
|
6973
|
+
const results = [];
|
|
6974
|
+
for (const deg of rots) {
|
|
6975
|
+
results.push(singleRotGrid(rd.get(deg), bounds));
|
|
6976
|
+
}
|
|
6977
|
+
const pairs = [
|
|
6978
|
+
[0, 180],
|
|
6979
|
+
[90, 270],
|
|
6980
|
+
[0, 90],
|
|
6981
|
+
[0, 270],
|
|
6982
|
+
[90, 180],
|
|
6983
|
+
[180, 270]
|
|
6984
|
+
];
|
|
6985
|
+
for (const [a, b] of pairs) {
|
|
6986
|
+
const rdA = rd.get(a), rdB = rd.get(b);
|
|
6987
|
+
const stepA = findMinStepX(rdA.profile, rdA.profile, 0);
|
|
6988
|
+
if (stepA <= 0) continue;
|
|
6989
|
+
for (let off = 0; off < stepA; off += 1) {
|
|
6990
|
+
results.push(dualRotGrid(rdA, rdB, off, bounds));
|
|
6991
|
+
results.push(dualRotGrid(rdB, rdA, off, bounds));
|
|
6992
|
+
}
|
|
6993
|
+
}
|
|
6994
|
+
let best = results[0];
|
|
6995
|
+
for (const r of results) {
|
|
6996
|
+
if (r.count > best.count) best = r;
|
|
6997
|
+
}
|
|
6998
|
+
centerLayout(best, bounds);
|
|
6999
|
+
return {
|
|
7000
|
+
rotation: best.placements[0]?.rotation ?? 0,
|
|
7001
|
+
placements: best.placements,
|
|
7002
|
+
producedPerSheet: best.count
|
|
7003
|
+
};
|
|
7004
|
+
}
|
|
7005
|
+
|
|
7006
|
+
// src/utils/autoLayout/calculate/tuck-end-boxes/becf-1030a/index.ts
|
|
7007
|
+
function prepareRotation2(contourPoints, dielineW, dielineH, deg) {
|
|
7008
|
+
const rotated = normalizePoints(contourPoints, deg);
|
|
7009
|
+
return {
|
|
7010
|
+
profile: buildProfile(rotated),
|
|
7011
|
+
bbOffset: computeDielineBBOffset(contourPoints, dielineW, dielineH, deg),
|
|
7012
|
+
deg
|
|
7013
|
+
};
|
|
7014
|
+
}
|
|
7015
|
+
function findPairRowStepY(pA, pB, gapAB, pairStepX) {
|
|
7016
|
+
const reach = Math.max(pA.width, pB.width) + Math.abs(gapAB);
|
|
7017
|
+
const nMin = Math.floor(-reach / pairStepX) - 1;
|
|
7018
|
+
const nMax = Math.ceil(reach / pairStepX) + 1;
|
|
7019
|
+
let maxStep = 0;
|
|
7020
|
+
for (let n = nMin; n <= nMax; n++) {
|
|
7021
|
+
const dx = n * pairStepX;
|
|
7022
|
+
const s1 = findMinStepY(pA, pA, dx);
|
|
7023
|
+
if (s1 > maxStep) maxStep = s1;
|
|
7024
|
+
const s2 = findMinStepY(pA, pB, dx + gapAB);
|
|
7025
|
+
if (s2 > maxStep) maxStep = s2;
|
|
7026
|
+
const s3 = findMinStepY(pB, pA, dx - gapAB);
|
|
7027
|
+
if (s3 > maxStep) maxStep = s3;
|
|
7028
|
+
const s4 = findMinStepY(pB, pB, dx);
|
|
7029
|
+
if (s4 > maxStep) maxStep = s4;
|
|
7030
|
+
}
|
|
7031
|
+
return maxStep;
|
|
7032
|
+
}
|
|
7033
|
+
function pairGrid(rdA, rdB, bounds) {
|
|
7034
|
+
const pA = rdA.profile, pB = rdB.profile;
|
|
7035
|
+
const gapAB = findMinStepX(pA, pB, 0);
|
|
7036
|
+
if (gapAB <= 0) return emptyResult();
|
|
7037
|
+
const pairW = gapAB + pB.width;
|
|
7038
|
+
const pairH = Math.max(pA.height, pB.height);
|
|
7039
|
+
const pairStepX = Math.max(
|
|
7040
|
+
gapAB + findMinStepX(pB, pA, 0),
|
|
7041
|
+
findMinStepX(pA, pA, 0),
|
|
7042
|
+
findMinStepX(pB, pB, 0)
|
|
7043
|
+
);
|
|
7044
|
+
const pairStepY = findPairRowStepY(pA, pB, gapAB, pairStepX);
|
|
7045
|
+
if (pairStepX <= 0 || pairStepY <= 0) return emptyResult();
|
|
7046
|
+
const usableW = bounds.right - bounds.left;
|
|
7047
|
+
const usableH = bounds.bottom - bounds.top;
|
|
7048
|
+
const pairCols = Math.max(0, Math.floor((usableW - pairW) / pairStepX) + 1);
|
|
7049
|
+
const pairRows = Math.max(0, Math.floor((usableH - pairH) / pairStepY) + 1);
|
|
7050
|
+
if (pairCols === 0 || pairRows === 0) return emptyResult();
|
|
7051
|
+
const placements = [];
|
|
7052
|
+
let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
|
|
7053
|
+
for (let r = 0; r < pairRows; r++) {
|
|
7054
|
+
for (let c = 0; c < pairCols; c++) {
|
|
7055
|
+
const baseX = bounds.left + c * pairStepX;
|
|
7056
|
+
const baseY = bounds.top + r * pairStepY;
|
|
7057
|
+
const oxA = baseX;
|
|
7058
|
+
const oyA = baseY;
|
|
7059
|
+
placements.push({ x: oxA + rdA.bbOffset.dx, y: oyA + rdA.bbOffset.dy, rotation: rdA.deg });
|
|
7060
|
+
if (oxA < minX) minX = oxA;
|
|
7061
|
+
if (oyA < minY) minY = oyA;
|
|
7062
|
+
if (oxA + pA.width > maxX) maxX = oxA + pA.width;
|
|
7063
|
+
if (oyA + pA.height > maxY) maxY = oyA + pA.height;
|
|
7064
|
+
const oxB = baseX + gapAB;
|
|
7065
|
+
const oyB = baseY;
|
|
7066
|
+
placements.push({ x: oxB + rdB.bbOffset.dx, y: oyB + rdB.bbOffset.dy, rotation: rdB.deg });
|
|
7067
|
+
if (oxB < minX) minX = oxB;
|
|
7068
|
+
if (oyB < minY) minY = oyB;
|
|
7069
|
+
if (oxB + pB.width > maxX) maxX = oxB + pB.width;
|
|
7070
|
+
if (oyB + pB.height > maxY) maxY = oyB + pB.height;
|
|
7071
|
+
}
|
|
7072
|
+
}
|
|
7073
|
+
const pairsRightEdge = bounds.left + (pairCols - 1) * pairStepX + pairW;
|
|
7074
|
+
const pairsBottomEdge = bounds.top + (pairRows - 1) * pairStepY + pairH;
|
|
7075
|
+
const gapRight = bounds.right - pairsRightEdge;
|
|
7076
|
+
const gapBottom = bounds.bottom - pairsBottomEdge;
|
|
7077
|
+
const extraRotations = [rdA, rdB];
|
|
7078
|
+
for (const rdExtra of extraRotations) {
|
|
7079
|
+
const pe = rdExtra.profile;
|
|
7080
|
+
if (pe.width <= gapRight) {
|
|
7081
|
+
for (let r = 0; r < pairRows; r++) {
|
|
7082
|
+
const ox = pairsRightEdge;
|
|
7083
|
+
const oy = bounds.top + r * pairStepY;
|
|
7084
|
+
if (ox + pe.width <= bounds.right && oy + pe.height <= bounds.bottom) {
|
|
7085
|
+
placements.push({ x: ox + rdExtra.bbOffset.dx, y: oy + rdExtra.bbOffset.dy, rotation: rdExtra.deg });
|
|
7086
|
+
if (ox + pe.width > maxX) maxX = ox + pe.width;
|
|
7087
|
+
}
|
|
7088
|
+
}
|
|
7089
|
+
break;
|
|
7090
|
+
}
|
|
7091
|
+
}
|
|
7092
|
+
for (const rdExtra of extraRotations) {
|
|
7093
|
+
const pe = rdExtra.profile;
|
|
7094
|
+
if (pe.height <= gapBottom) {
|
|
7095
|
+
for (let c = 0; c < pairCols; c++) {
|
|
7096
|
+
const oxA = bounds.left + c * pairStepX;
|
|
7097
|
+
const oy = pairsBottomEdge;
|
|
7098
|
+
if (oxA + pe.width <= bounds.right && oy + pe.height <= bounds.bottom) {
|
|
7099
|
+
placements.push({ x: oxA + rdExtra.bbOffset.dx, y: oy + rdExtra.bbOffset.dy, rotation: rdExtra.deg });
|
|
7100
|
+
if (oy + pe.height > maxY) maxY = oy + pe.height;
|
|
7101
|
+
}
|
|
7102
|
+
}
|
|
7103
|
+
break;
|
|
7104
|
+
}
|
|
7105
|
+
}
|
|
7106
|
+
return { placements, count: placements.length, minX, minY, maxX, maxY };
|
|
7107
|
+
}
|
|
7108
|
+
function computeLayoutForPaper2(contourPoints, dielineW, dielineH, _paperWidth, _paperHeight, bounds) {
|
|
7109
|
+
const rots = [0, 90, 180, 270];
|
|
7110
|
+
const rd = /* @__PURE__ */ new Map();
|
|
7111
|
+
for (const deg of rots) {
|
|
7112
|
+
rd.set(deg, prepareRotation2(contourPoints, dielineW, dielineH, deg));
|
|
7113
|
+
}
|
|
7114
|
+
const results = [];
|
|
7115
|
+
for (const deg of rots) {
|
|
7116
|
+
results.push(singleRotGrid(rd.get(deg), bounds));
|
|
7117
|
+
}
|
|
7118
|
+
const allPairs = [
|
|
7119
|
+
[0, 180],
|
|
7120
|
+
[90, 270],
|
|
7121
|
+
[0, 90],
|
|
7122
|
+
[0, 270],
|
|
7123
|
+
[90, 180],
|
|
7124
|
+
[180, 270]
|
|
7125
|
+
];
|
|
7126
|
+
for (const [a, b] of allPairs) {
|
|
7127
|
+
const rdA = rd.get(a), rdB = rd.get(b);
|
|
7128
|
+
const stepA = findMinStepX(rdA.profile, rdA.profile, 0);
|
|
7129
|
+
if (stepA <= 0) continue;
|
|
7130
|
+
for (let off = 0; off < stepA; off += 1) {
|
|
7131
|
+
results.push(dualRotGrid(rdA, rdB, off, bounds));
|
|
7132
|
+
results.push(dualRotGrid(rdB, rdA, off, bounds));
|
|
7133
|
+
}
|
|
7134
|
+
}
|
|
7135
|
+
for (const [a, b] of allPairs) {
|
|
7136
|
+
results.push(pairGrid(rd.get(a), rd.get(b), bounds));
|
|
7137
|
+
results.push(pairGrid(rd.get(b), rd.get(a), bounds));
|
|
7138
|
+
}
|
|
7139
|
+
const singleResults = [];
|
|
7140
|
+
const multiResults = [];
|
|
7141
|
+
for (const r of results) {
|
|
7142
|
+
if (r.count === 0) continue;
|
|
7143
|
+
const rotations = new Set(r.placements.map((p) => p.rotation));
|
|
7144
|
+
if (rotations.size > 1) {
|
|
7145
|
+
multiResults.push(r);
|
|
7146
|
+
} else {
|
|
7147
|
+
singleResults.push(r);
|
|
7148
|
+
}
|
|
7149
|
+
}
|
|
7150
|
+
function pickBest(arr) {
|
|
7151
|
+
let b = arr[0] ?? emptyResult();
|
|
7152
|
+
let bArea = (b.maxX - b.minX) * (b.maxY - b.minY);
|
|
7153
|
+
for (const r of arr) {
|
|
7154
|
+
const area = (r.maxX - r.minX) * (r.maxY - r.minY);
|
|
7155
|
+
if (r.count > b.count || r.count === b.count && area < bArea) {
|
|
7156
|
+
b = r;
|
|
7157
|
+
bArea = area;
|
|
7158
|
+
}
|
|
7159
|
+
}
|
|
7160
|
+
return b;
|
|
7161
|
+
}
|
|
7162
|
+
const bestSingle = pickBest(singleResults);
|
|
7163
|
+
const bestMulti = pickBest(multiResults);
|
|
7164
|
+
const best = bestMulti.count >= bestSingle.count && bestMulti.count > 0 ? bestMulti : bestSingle;
|
|
7165
|
+
centerLayout(best, bounds);
|
|
7166
|
+
return {
|
|
7167
|
+
rotation: best.placements[0]?.rotation ?? 0,
|
|
7168
|
+
placements: best.placements,
|
|
7169
|
+
producedPerSheet: best.count
|
|
7170
|
+
};
|
|
4386
7171
|
}
|
|
4387
7172
|
|
|
4388
|
-
// src/utils/autoLayout/calculate/tuck-end-boxes/becf-
|
|
4389
|
-
|
|
4390
|
-
|
|
4391
|
-
|
|
4392
|
-
|
|
4393
|
-
|
|
4394
|
-
|
|
7173
|
+
// src/utils/autoLayout/calculate/tuck-end-boxes/becf-1040a/index.ts
|
|
7174
|
+
function prepareRotation3(contourPoints, dielineW, dielineH, deg) {
|
|
7175
|
+
const rotated = normalizePoints(contourPoints, deg);
|
|
7176
|
+
return {
|
|
7177
|
+
profile: buildProfile(rotated),
|
|
7178
|
+
bbOffset: computeDielineBBOffset(contourPoints, dielineW, dielineH, deg),
|
|
7179
|
+
deg
|
|
7180
|
+
};
|
|
7181
|
+
}
|
|
7182
|
+
function findPairRowStepY2(pA, pB, gapAB, pairStepX) {
|
|
7183
|
+
const reach = Math.max(pA.width, pB.width) + Math.abs(gapAB);
|
|
7184
|
+
const nMin = Math.floor(-reach / pairStepX) - 1;
|
|
7185
|
+
const nMax = Math.ceil(reach / pairStepX) + 1;
|
|
7186
|
+
let maxStep = 0;
|
|
7187
|
+
for (let n = nMin; n <= nMax; n++) {
|
|
7188
|
+
const dx = n * pairStepX;
|
|
7189
|
+
const s1 = findMinStepY(pA, pA, dx);
|
|
7190
|
+
if (s1 > maxStep) maxStep = s1;
|
|
7191
|
+
const s2 = findMinStepY(pA, pB, dx + gapAB);
|
|
7192
|
+
if (s2 > maxStep) maxStep = s2;
|
|
7193
|
+
const s3 = findMinStepY(pB, pA, dx - gapAB);
|
|
7194
|
+
if (s3 > maxStep) maxStep = s3;
|
|
7195
|
+
const s4 = findMinStepY(pB, pB, dx);
|
|
7196
|
+
if (s4 > maxStep) maxStep = s4;
|
|
4395
7197
|
}
|
|
4396
|
-
|
|
4397
|
-
|
|
4398
|
-
|
|
4399
|
-
const
|
|
4400
|
-
const
|
|
4401
|
-
|
|
4402
|
-
const
|
|
4403
|
-
const
|
|
4404
|
-
|
|
4405
|
-
|
|
4406
|
-
|
|
4407
|
-
|
|
4408
|
-
|
|
4409
|
-
|
|
4410
|
-
|
|
4411
|
-
|
|
4412
|
-
|
|
7198
|
+
return maxStep;
|
|
7199
|
+
}
|
|
7200
|
+
function pairGrid2(rdA, rdB, bounds) {
|
|
7201
|
+
const pA = rdA.profile, pB = rdB.profile;
|
|
7202
|
+
const gapAB = findMinStepX(pA, pB, 0);
|
|
7203
|
+
if (gapAB <= 0) return emptyResult();
|
|
7204
|
+
const pairW = gapAB + pB.width;
|
|
7205
|
+
const pairH = Math.max(pA.height, pB.height);
|
|
7206
|
+
const pairStepX = Math.max(
|
|
7207
|
+
gapAB + findMinStepX(pB, pA, 0),
|
|
7208
|
+
findMinStepX(pA, pA, 0),
|
|
7209
|
+
findMinStepX(pB, pB, 0)
|
|
7210
|
+
);
|
|
7211
|
+
if (pairStepX <= 0) return emptyResult();
|
|
7212
|
+
const pairStepY = findPairRowStepY2(pA, pB, gapAB, pairStepX);
|
|
7213
|
+
if (pairStepY <= 0) return emptyResult();
|
|
7214
|
+
const usableW = bounds.right - bounds.left;
|
|
7215
|
+
const usableH = bounds.bottom - bounds.top;
|
|
7216
|
+
const pairCols = Math.max(0, Math.floor((usableW - pairW) / pairStepX) + 1);
|
|
7217
|
+
const pairRows = Math.max(0, Math.floor((usableH - pairH) / pairStepY) + 1);
|
|
7218
|
+
if (pairCols === 0 || pairRows === 0) return emptyResult();
|
|
7219
|
+
const placements = [];
|
|
7220
|
+
let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
|
|
7221
|
+
for (let r = 0; r < pairRows; r++) {
|
|
7222
|
+
for (let c = 0; c < pairCols; c++) {
|
|
7223
|
+
const baseX = bounds.left + c * pairStepX;
|
|
7224
|
+
const baseY = bounds.top + r * pairStepY;
|
|
7225
|
+
placements.push({ x: baseX + rdA.bbOffset.dx, y: baseY + rdA.bbOffset.dy, rotation: rdA.deg });
|
|
7226
|
+
if (baseX < minX) minX = baseX;
|
|
7227
|
+
if (baseY < minY) minY = baseY;
|
|
7228
|
+
if (baseX + pA.width > maxX) maxX = baseX + pA.width;
|
|
7229
|
+
if (baseY + pA.height > maxY) maxY = baseY + pA.height;
|
|
7230
|
+
const bx = baseX + gapAB;
|
|
7231
|
+
placements.push({ x: bx + rdB.bbOffset.dx, y: baseY + rdB.bbOffset.dy, rotation: rdB.deg });
|
|
7232
|
+
if (bx < minX) minX = bx;
|
|
7233
|
+
if (bx + pB.width > maxX) maxX = bx + pB.width;
|
|
7234
|
+
if (baseY + pB.height > maxY) maxY = baseY + pB.height;
|
|
7235
|
+
}
|
|
7236
|
+
}
|
|
7237
|
+
const pairsRightEdge = bounds.left + (pairCols - 1) * pairStepX + pairW;
|
|
7238
|
+
const gapRight = bounds.right - pairsRightEdge;
|
|
7239
|
+
for (const rdExtra of [rdA, rdB]) {
|
|
7240
|
+
const pe = rdExtra.profile;
|
|
7241
|
+
if (pe.width > gapRight) continue;
|
|
7242
|
+
const dxFromB = pairsRightEdge - (bounds.left + (pairCols - 1) * pairStepX + gapAB);
|
|
7243
|
+
const dxFromA = pairsRightEdge - bounds.left - (pairCols - 1) * pairStepX;
|
|
7244
|
+
const extraStepY = Math.max(
|
|
7245
|
+
findMinStepY(pA, pe, dxFromA),
|
|
7246
|
+
findMinStepY(pB, pe, dxFromB),
|
|
7247
|
+
findMinStepY(pe, pe, 0)
|
|
7248
|
+
);
|
|
7249
|
+
if (extraStepY <= 0) continue;
|
|
7250
|
+
const effectiveStepY = Math.max(pairStepY, extraStepY);
|
|
7251
|
+
const extraRows = Math.max(0, Math.floor((usableH - pe.height) / effectiveStepY) + 1);
|
|
7252
|
+
for (let r = 0; r < extraRows; r++) {
|
|
7253
|
+
const ox = pairsRightEdge;
|
|
7254
|
+
const oy = bounds.top + r * effectiveStepY;
|
|
7255
|
+
if (ox + pe.width <= bounds.right && oy + pe.height <= bounds.bottom) {
|
|
7256
|
+
placements.push({ x: ox + rdExtra.bbOffset.dx, y: oy + rdExtra.bbOffset.dy, rotation: rdExtra.deg });
|
|
7257
|
+
if (ox + pe.width > maxX) maxX = ox + pe.width;
|
|
7258
|
+
if (oy + pe.height > maxY) maxY = oy + pe.height;
|
|
4413
7259
|
}
|
|
4414
7260
|
}
|
|
7261
|
+
break;
|
|
4415
7262
|
}
|
|
4416
|
-
|
|
4417
|
-
|
|
4418
|
-
|
|
4419
|
-
|
|
4420
|
-
|
|
4421
|
-
|
|
4422
|
-
|
|
4423
|
-
|
|
4424
|
-
|
|
7263
|
+
const pairsBottomEdge = bounds.top + (pairRows - 1) * pairStepY + pairH;
|
|
7264
|
+
const gapBottom = bounds.bottom - pairsBottomEdge;
|
|
7265
|
+
for (const rdExtra of [rdA, rdB]) {
|
|
7266
|
+
const pe = rdExtra.profile;
|
|
7267
|
+
if (pe.height > gapBottom) continue;
|
|
7268
|
+
const extraStepX = findMinStepX(pe, pe, 0);
|
|
7269
|
+
if (extraStepX <= 0) continue;
|
|
7270
|
+
const dyFromPairRow = pairsBottomEdge - (bounds.top + (pairRows - 1) * pairStepY);
|
|
7271
|
+
const stepFromA = findMinStepY(pA, pe, 0);
|
|
7272
|
+
const stepFromB = findMinStepY(pB, pe, gapAB);
|
|
7273
|
+
if (dyFromPairRow < stepFromA || dyFromPairRow < stepFromB) continue;
|
|
7274
|
+
const extraCols = Math.max(0, Math.floor((usableW - pe.width) / extraStepX) + 1);
|
|
7275
|
+
for (let c = 0; c < extraCols; c++) {
|
|
7276
|
+
const ox = bounds.left + c * extraStepX;
|
|
7277
|
+
const oy = pairsBottomEdge;
|
|
7278
|
+
if (ox + pe.width <= bounds.right && oy + pe.height <= bounds.bottom) {
|
|
7279
|
+
placements.push({ x: ox + rdExtra.bbOffset.dx, y: oy + rdExtra.bbOffset.dy, rotation: rdExtra.deg });
|
|
7280
|
+
if (ox + pe.width > maxX) maxX = ox + pe.width;
|
|
7281
|
+
if (oy + pe.height > maxY) maxY = oy + pe.height;
|
|
7282
|
+
}
|
|
7283
|
+
}
|
|
7284
|
+
break;
|
|
7285
|
+
}
|
|
7286
|
+
return { placements, count: placements.length, minX, minY, maxX, maxY };
|
|
7287
|
+
}
|
|
7288
|
+
function verticalPairGrid(rdA, rdB, bounds) {
|
|
7289
|
+
const pA = rdA.profile, pB = rdB.profile;
|
|
7290
|
+
const gapAB_Y = findMinStepY(pA, pB, 0);
|
|
7291
|
+
if (gapAB_Y <= 0) return emptyResult();
|
|
7292
|
+
const vpairH = gapAB_Y + pB.height;
|
|
7293
|
+
const vpairW = Math.max(pA.width, pB.width);
|
|
7294
|
+
const stepXAA = findMinStepX(pA, pA, 0);
|
|
7295
|
+
const stepXAB = findMinStepX(pA, pB, -gapAB_Y);
|
|
7296
|
+
const stepXBA = findMinStepX(pB, pA, gapAB_Y);
|
|
7297
|
+
const stepXBB = findMinStepX(pB, pB, 0);
|
|
7298
|
+
const vpairStepX = Math.max(stepXAA, stepXAB, stepXBA, stepXBB);
|
|
7299
|
+
if (vpairStepX <= 0) return emptyResult();
|
|
7300
|
+
let vpairStepY = 0;
|
|
7301
|
+
{
|
|
7302
|
+
const reach = Math.max(pA.width, pB.width);
|
|
7303
|
+
const nMin = Math.floor(-reach / vpairStepX) - 1;
|
|
7304
|
+
const nMax = Math.ceil(reach / vpairStepX) + 1;
|
|
7305
|
+
for (let n = nMin; n <= nMax; n++) {
|
|
7306
|
+
const dx = n * vpairStepX;
|
|
7307
|
+
const sAA = findMinStepY(pA, pA, dx);
|
|
7308
|
+
if (sAA > vpairStepY) vpairStepY = sAA;
|
|
7309
|
+
const sAB = findMinStepY(pA, pB, dx) - gapAB_Y;
|
|
7310
|
+
if (sAB > vpairStepY) vpairStepY = sAB;
|
|
7311
|
+
const sBA = findMinStepY(pB, pA, dx) + gapAB_Y;
|
|
7312
|
+
if (sBA > vpairStepY) vpairStepY = sBA;
|
|
7313
|
+
const sBB = findMinStepY(pB, pB, dx);
|
|
7314
|
+
if (sBB > vpairStepY) vpairStepY = sBB;
|
|
7315
|
+
}
|
|
7316
|
+
}
|
|
7317
|
+
if (vpairStepY <= 0) return emptyResult();
|
|
7318
|
+
const usableW = bounds.right - bounds.left;
|
|
7319
|
+
const usableH = bounds.bottom - bounds.top;
|
|
7320
|
+
const cols = Math.max(0, Math.floor((usableW - vpairW) / vpairStepX) + 1);
|
|
7321
|
+
const rows = Math.max(0, Math.floor((usableH - vpairH) / vpairStepY) + 1);
|
|
7322
|
+
if (cols === 0 || rows === 0) return emptyResult();
|
|
7323
|
+
const placements = [];
|
|
7324
|
+
let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
|
|
7325
|
+
for (let r = 0; r < rows; r++) {
|
|
7326
|
+
for (let c = 0; c < cols; c++) {
|
|
7327
|
+
const baseX = bounds.left + c * vpairStepX;
|
|
7328
|
+
const baseY = bounds.top + r * vpairStepY;
|
|
7329
|
+
placements.push({ x: baseX + rdA.bbOffset.dx, y: baseY + rdA.bbOffset.dy, rotation: rdA.deg });
|
|
7330
|
+
if (baseX < minX) minX = baseX;
|
|
7331
|
+
if (baseY < minY) minY = baseY;
|
|
7332
|
+
if (baseX + pA.width > maxX) maxX = baseX + pA.width;
|
|
7333
|
+
if (baseY + pA.height > maxY) maxY = baseY + pA.height;
|
|
7334
|
+
const by = baseY + gapAB_Y;
|
|
7335
|
+
placements.push({ x: baseX + rdB.bbOffset.dx, y: by + rdB.bbOffset.dy, rotation: rdB.deg });
|
|
7336
|
+
if (by + pB.height > maxY) maxY = by + pB.height;
|
|
7337
|
+
}
|
|
7338
|
+
}
|
|
7339
|
+
return { placements, count: placements.length, minX, minY, maxX, maxY };
|
|
7340
|
+
}
|
|
7341
|
+
function computeLayoutForPaper3(contourPoints, dielineW, dielineH, _paperWidth, _paperHeight, bounds) {
|
|
7342
|
+
const rots = [0, 90, 180, 270];
|
|
7343
|
+
const rd = /* @__PURE__ */ new Map();
|
|
7344
|
+
for (const deg of rots) {
|
|
7345
|
+
rd.set(deg, prepareRotation3(contourPoints, dielineW, dielineH, deg));
|
|
7346
|
+
}
|
|
7347
|
+
const results = [];
|
|
7348
|
+
for (const deg of rots) {
|
|
7349
|
+
results.push(singleRotGrid(rd.get(deg), bounds));
|
|
7350
|
+
}
|
|
7351
|
+
const allPairs = [
|
|
7352
|
+
[0, 180],
|
|
7353
|
+
[90, 270],
|
|
7354
|
+
[0, 90],
|
|
7355
|
+
[0, 270],
|
|
7356
|
+
[90, 180],
|
|
7357
|
+
[180, 270]
|
|
7358
|
+
];
|
|
7359
|
+
for (const [a, b] of allPairs) {
|
|
7360
|
+
const rdA = rd.get(a), rdB = rd.get(b);
|
|
7361
|
+
const stepA = findMinStepX(rdA.profile, rdA.profile, 0);
|
|
7362
|
+
if (stepA <= 0) continue;
|
|
7363
|
+
for (let off = 0; off < stepA; off += 1) {
|
|
7364
|
+
results.push(dualRotGrid(rdA, rdB, off, bounds));
|
|
7365
|
+
results.push(dualRotGrid(rdB, rdA, off, bounds));
|
|
7366
|
+
}
|
|
7367
|
+
}
|
|
7368
|
+
for (const [a, b] of allPairs) {
|
|
7369
|
+
results.push(pairGrid2(rd.get(a), rd.get(b), bounds));
|
|
7370
|
+
results.push(pairGrid2(rd.get(b), rd.get(a), bounds));
|
|
7371
|
+
}
|
|
7372
|
+
for (const [a, b] of allPairs) {
|
|
7373
|
+
results.push(verticalPairGrid(rd.get(a), rd.get(b), bounds));
|
|
7374
|
+
results.push(verticalPairGrid(rd.get(b), rd.get(a), bounds));
|
|
7375
|
+
}
|
|
7376
|
+
const singleResults = [];
|
|
7377
|
+
const multiResults = [];
|
|
7378
|
+
for (const r of results) {
|
|
7379
|
+
if (r.count === 0) continue;
|
|
7380
|
+
const rotations = new Set(r.placements.map((p) => p.rotation));
|
|
7381
|
+
if (rotations.size > 1) {
|
|
7382
|
+
multiResults.push(r);
|
|
7383
|
+
} else {
|
|
7384
|
+
singleResults.push(r);
|
|
7385
|
+
}
|
|
7386
|
+
}
|
|
7387
|
+
function pickBest(arr) {
|
|
7388
|
+
let b = arr[0] ?? emptyResult();
|
|
7389
|
+
let bArea = (b.maxX - b.minX) * (b.maxY - b.minY);
|
|
7390
|
+
for (const r of arr) {
|
|
7391
|
+
const area = (r.maxX - r.minX) * (r.maxY - r.minY);
|
|
7392
|
+
if (r.count > b.count || r.count === b.count && area < bArea) {
|
|
7393
|
+
b = r;
|
|
7394
|
+
bArea = area;
|
|
4425
7395
|
}
|
|
4426
7396
|
}
|
|
7397
|
+
return b;
|
|
4427
7398
|
}
|
|
4428
|
-
|
|
7399
|
+
const bestSingle = pickBest(singleResults);
|
|
7400
|
+
const bestMulti = pickBest(multiResults);
|
|
7401
|
+
const best = bestMulti.count >= bestSingle.count && bestMulti.count > 0 ? bestMulti : bestSingle;
|
|
7402
|
+
centerLayout(best, bounds);
|
|
7403
|
+
return {
|
|
7404
|
+
rotation: best.placements[0]?.rotation ?? 0,
|
|
7405
|
+
placements: best.placements,
|
|
7406
|
+
producedPerSheet: best.count
|
|
7407
|
+
};
|
|
4429
7408
|
}
|
|
4430
|
-
|
|
7409
|
+
|
|
7410
|
+
// src/utils/autoLayout/calculate/bags-pillows/becf-12101/index.ts
|
|
7411
|
+
function prepareRotation4(contourPoints, dielineW, dielineH, deg) {
|
|
4431
7412
|
const rotated = normalizePoints(contourPoints, deg);
|
|
4432
7413
|
return {
|
|
4433
7414
|
profile: buildProfile(rotated),
|
|
@@ -4435,119 +7416,243 @@ function prepareRotation(contourPoints, dielineW, dielineH, deg) {
|
|
|
4435
7416
|
deg
|
|
4436
7417
|
};
|
|
4437
7418
|
}
|
|
4438
|
-
function
|
|
4439
|
-
const
|
|
4440
|
-
|
|
4441
|
-
|
|
4442
|
-
|
|
4443
|
-
|
|
4444
|
-
|
|
4445
|
-
|
|
4446
|
-
|
|
7419
|
+
function pairGrid3(rdA, rdB, bounds) {
|
|
7420
|
+
const pA = rdA.profile, pB = rdB.profile;
|
|
7421
|
+
const gapAB = findMinStepX(pA, pB, 0);
|
|
7422
|
+
if (gapAB <= 0) return emptyResult();
|
|
7423
|
+
const pairW = gapAB + pB.width;
|
|
7424
|
+
const pairH = Math.max(pA.height, pB.height);
|
|
7425
|
+
const pairStepX = gapAB + findMinStepX(pB, pA, 0);
|
|
7426
|
+
const pairStepY = Math.max(
|
|
7427
|
+
findMinStepY(pA, pA, 0),
|
|
7428
|
+
findMinStepY(pA, pB, gapAB),
|
|
7429
|
+
findMinStepY(pB, pA, -gapAB),
|
|
7430
|
+
findMinStepY(pB, pB, 0)
|
|
7431
|
+
);
|
|
7432
|
+
if (pairStepX <= 0 || pairStepY <= 0) return emptyResult();
|
|
7433
|
+
const usableW = bounds.right - bounds.left;
|
|
7434
|
+
const usableH = bounds.bottom - bounds.top;
|
|
7435
|
+
const pairCols = Math.max(0, Math.floor((usableW - pairW) / pairStepX) + 1);
|
|
7436
|
+
const pairRows = Math.max(0, Math.floor((usableH - pairH) / pairStepY) + 1);
|
|
7437
|
+
if (pairCols === 0 || pairRows === 0) return emptyResult();
|
|
7438
|
+
const placements = [];
|
|
7439
|
+
let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
|
|
7440
|
+
for (let r = 0; r < pairRows; r++) {
|
|
7441
|
+
for (let c = 0; c < pairCols; c++) {
|
|
7442
|
+
const baseX = bounds.left + c * pairStepX;
|
|
7443
|
+
const baseY = bounds.top + r * pairStepY;
|
|
7444
|
+
const oxA = baseX;
|
|
7445
|
+
const oyA = baseY;
|
|
7446
|
+
placements.push({ x: oxA + rdA.bbOffset.dx, y: oyA + rdA.bbOffset.dy, rotation: rdA.deg });
|
|
7447
|
+
if (oxA < minX) minX = oxA;
|
|
7448
|
+
if (oyA < minY) minY = oyA;
|
|
7449
|
+
if (oxA + pA.width > maxX) maxX = oxA + pA.width;
|
|
7450
|
+
if (oyA + pA.height > maxY) maxY = oyA + pA.height;
|
|
7451
|
+
const oxB = baseX + gapAB;
|
|
7452
|
+
const oyB = baseY;
|
|
7453
|
+
placements.push({ x: oxB + rdB.bbOffset.dx, y: oyB + rdB.bbOffset.dy, rotation: rdB.deg });
|
|
7454
|
+
if (oxB < minX) minX = oxB;
|
|
7455
|
+
if (oyB < minY) minY = oyB;
|
|
7456
|
+
if (oxB + pB.width > maxX) maxX = oxB + pB.width;
|
|
7457
|
+
if (oyB + pB.height > maxY) maxY = oyB + pB.height;
|
|
7458
|
+
}
|
|
4447
7459
|
}
|
|
4448
|
-
|
|
4449
|
-
|
|
4450
|
-
|
|
4451
|
-
const
|
|
4452
|
-
|
|
4453
|
-
for (
|
|
4454
|
-
const
|
|
4455
|
-
if (
|
|
4456
|
-
|
|
4457
|
-
|
|
4458
|
-
|
|
7460
|
+
const pairsRightEdge = bounds.left + (pairCols - 1) * pairStepX + pairW;
|
|
7461
|
+
const pairsBottomEdge = bounds.top + (pairRows - 1) * pairStepY + pairH;
|
|
7462
|
+
const gapRight = bounds.right - pairsRightEdge;
|
|
7463
|
+
const gapBottom = bounds.bottom - pairsBottomEdge;
|
|
7464
|
+
const extraRotations = [rdA, rdB];
|
|
7465
|
+
for (const rdExtra of extraRotations) {
|
|
7466
|
+
const pe = rdExtra.profile;
|
|
7467
|
+
if (pe.width <= gapRight) {
|
|
7468
|
+
for (let r = 0; r < pairRows; r++) {
|
|
7469
|
+
const ox = pairsRightEdge;
|
|
7470
|
+
const oy = bounds.top + r * pairStepY;
|
|
7471
|
+
if (ox + pe.width <= bounds.right && oy + pe.height <= bounds.bottom) {
|
|
7472
|
+
placements.push({ x: ox + rdExtra.bbOffset.dx, y: oy + rdExtra.bbOffset.dy, rotation: rdExtra.deg });
|
|
7473
|
+
if (ox + pe.width > maxX) maxX = ox + pe.width;
|
|
7474
|
+
}
|
|
7475
|
+
}
|
|
7476
|
+
break;
|
|
7477
|
+
}
|
|
4459
7478
|
}
|
|
4460
|
-
|
|
7479
|
+
for (const rdExtra of extraRotations) {
|
|
7480
|
+
const pe = rdExtra.profile;
|
|
7481
|
+
if (pe.height <= gapBottom) {
|
|
7482
|
+
for (let c = 0; c < pairCols; c++) {
|
|
7483
|
+
const oxA = bounds.left + c * pairStepX;
|
|
7484
|
+
const oy = pairsBottomEdge;
|
|
7485
|
+
if (oxA + pe.width <= bounds.right && oy + pe.height <= bounds.bottom) {
|
|
7486
|
+
placements.push({ x: oxA + rdExtra.bbOffset.dx, y: oy + rdExtra.bbOffset.dy, rotation: rdExtra.deg });
|
|
7487
|
+
if (oy + pe.height > maxY) maxY = oy + pe.height;
|
|
7488
|
+
}
|
|
7489
|
+
}
|
|
7490
|
+
break;
|
|
7491
|
+
}
|
|
7492
|
+
}
|
|
7493
|
+
return { placements, count: placements.length, minX, minY, maxX, maxY };
|
|
4461
7494
|
}
|
|
4462
|
-
function
|
|
4463
|
-
const
|
|
4464
|
-
|
|
4465
|
-
const
|
|
4466
|
-
|
|
4467
|
-
for (let n = nMin; n <= nMax; n++) {
|
|
4468
|
-
const s = findMinStepY(profA, profB, offsetX - n * stepX_A);
|
|
4469
|
-
if (s > maxStep) maxStep = s;
|
|
7495
|
+
function computeLayoutForPaper4(contourPoints, dielineW, dielineH, _paperWidth, _paperHeight, bounds) {
|
|
7496
|
+
const rots = [0, 90, 180, 270];
|
|
7497
|
+
const rd = /* @__PURE__ */ new Map();
|
|
7498
|
+
for (const deg of rots) {
|
|
7499
|
+
rd.set(deg, prepareRotation4(contourPoints, dielineW, dielineH, deg));
|
|
4470
7500
|
}
|
|
4471
|
-
|
|
7501
|
+
const results = [];
|
|
7502
|
+
for (const deg of rots) {
|
|
7503
|
+
results.push(singleRotGrid(rd.get(deg), bounds));
|
|
7504
|
+
}
|
|
7505
|
+
const allPairs = [
|
|
7506
|
+
[0, 180],
|
|
7507
|
+
[90, 270],
|
|
7508
|
+
[0, 90],
|
|
7509
|
+
[0, 270],
|
|
7510
|
+
[90, 180],
|
|
7511
|
+
[180, 270]
|
|
7512
|
+
];
|
|
7513
|
+
for (const [a, b] of allPairs) {
|
|
7514
|
+
const rdA = rd.get(a), rdB = rd.get(b);
|
|
7515
|
+
const stepA = findMinStepX(rdA.profile, rdA.profile, 0);
|
|
7516
|
+
if (stepA <= 0) continue;
|
|
7517
|
+
for (let off = 0; off < stepA; off += 1) {
|
|
7518
|
+
results.push(dualRotGrid(rdA, rdB, off, bounds));
|
|
7519
|
+
results.push(dualRotGrid(rdB, rdA, off, bounds));
|
|
7520
|
+
}
|
|
7521
|
+
}
|
|
7522
|
+
for (const [a, b] of allPairs) {
|
|
7523
|
+
results.push(pairGrid3(rd.get(a), rd.get(b), bounds));
|
|
7524
|
+
results.push(pairGrid3(rd.get(b), rd.get(a), bounds));
|
|
7525
|
+
}
|
|
7526
|
+
const singleResults = [];
|
|
7527
|
+
const multiResults = [];
|
|
7528
|
+
for (const r of results) {
|
|
7529
|
+
if (r.count === 0) continue;
|
|
7530
|
+
const rotations = new Set(r.placements.map((p) => p.rotation));
|
|
7531
|
+
if (rotations.size > 1) {
|
|
7532
|
+
multiResults.push(r);
|
|
7533
|
+
} else {
|
|
7534
|
+
singleResults.push(r);
|
|
7535
|
+
}
|
|
7536
|
+
}
|
|
7537
|
+
function pickBest(arr) {
|
|
7538
|
+
let b = arr[0] ?? emptyResult();
|
|
7539
|
+
let bArea = (b.maxX - b.minX) * (b.maxY - b.minY);
|
|
7540
|
+
for (const r of arr) {
|
|
7541
|
+
const area = (r.maxX - r.minX) * (r.maxY - r.minY);
|
|
7542
|
+
if (r.count > b.count || r.count === b.count && area < bArea) {
|
|
7543
|
+
b = r;
|
|
7544
|
+
bArea = area;
|
|
7545
|
+
}
|
|
7546
|
+
}
|
|
7547
|
+
return b;
|
|
7548
|
+
}
|
|
7549
|
+
const bestSingle = pickBest(singleResults);
|
|
7550
|
+
const bestMulti = pickBest(multiResults);
|
|
7551
|
+
const best = bestMulti.count >= bestSingle.count && bestMulti.count > 0 ? bestMulti : bestSingle;
|
|
7552
|
+
centerLayout(best, bounds);
|
|
7553
|
+
return {
|
|
7554
|
+
rotation: best.placements[0]?.rotation ?? 0,
|
|
7555
|
+
placements: best.placements,
|
|
7556
|
+
producedPerSheet: best.count
|
|
7557
|
+
};
|
|
4472
7558
|
}
|
|
4473
|
-
|
|
4474
|
-
|
|
7559
|
+
|
|
7560
|
+
// src/utils/autoLayout/calculate/bags-pillows/becf-12109/index.ts
|
|
7561
|
+
function prepareRotation5(contourPoints, dielineW, dielineH, deg) {
|
|
7562
|
+
const rotated = normalizePoints(contourPoints, deg);
|
|
7563
|
+
return {
|
|
7564
|
+
profile: buildProfile(rotated),
|
|
7565
|
+
bbOffset: computeDielineBBOffset(contourPoints, dielineW, dielineH, deg),
|
|
7566
|
+
deg
|
|
7567
|
+
};
|
|
4475
7568
|
}
|
|
4476
|
-
function
|
|
4477
|
-
const
|
|
4478
|
-
const
|
|
4479
|
-
|
|
4480
|
-
|
|
4481
|
-
const
|
|
4482
|
-
const
|
|
4483
|
-
|
|
7569
|
+
function pairGrid4(rdA, rdB, bounds) {
|
|
7570
|
+
const pA = rdA.profile, pB = rdB.profile;
|
|
7571
|
+
const gapAB = findMinStepX(pA, pB, 0);
|
|
7572
|
+
if (gapAB <= 0) return emptyResult();
|
|
7573
|
+
const pairW = gapAB + pB.width;
|
|
7574
|
+
const pairH = Math.max(pA.height, pB.height);
|
|
7575
|
+
const pairStepX = gapAB + findMinStepX(pB, pA, 0);
|
|
7576
|
+
const pairStepY = Math.max(
|
|
7577
|
+
findMinStepY(pA, pA, 0),
|
|
7578
|
+
findMinStepY(pA, pB, gapAB),
|
|
7579
|
+
findMinStepY(pB, pA, -gapAB),
|
|
7580
|
+
findMinStepY(pB, pB, 0)
|
|
7581
|
+
);
|
|
7582
|
+
if (pairStepX <= 0 || pairStepY <= 0) return emptyResult();
|
|
7583
|
+
const usableW = bounds.right - bounds.left;
|
|
7584
|
+
const usableH = bounds.bottom - bounds.top;
|
|
7585
|
+
const pairCols = Math.max(0, Math.floor((usableW - pairW) / pairStepX) + 1);
|
|
7586
|
+
const pairRows = Math.max(0, Math.floor((usableH - pairH) / pairStepY) + 1);
|
|
7587
|
+
if (pairCols === 0 || pairRows === 0) return emptyResult();
|
|
4484
7588
|
const placements = [];
|
|
4485
7589
|
let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
|
|
4486
|
-
for (let r = 0; r <
|
|
4487
|
-
for (let c = 0; c <
|
|
4488
|
-
const
|
|
4489
|
-
const
|
|
4490
|
-
|
|
4491
|
-
|
|
4492
|
-
|
|
4493
|
-
if (
|
|
4494
|
-
if (
|
|
7590
|
+
for (let r = 0; r < pairRows; r++) {
|
|
7591
|
+
for (let c = 0; c < pairCols; c++) {
|
|
7592
|
+
const baseX = bounds.left + c * pairStepX;
|
|
7593
|
+
const baseY = bounds.top + r * pairStepY;
|
|
7594
|
+
const oxA = baseX;
|
|
7595
|
+
const oyA = baseY;
|
|
7596
|
+
placements.push({ x: oxA + rdA.bbOffset.dx, y: oyA + rdA.bbOffset.dy, rotation: rdA.deg });
|
|
7597
|
+
if (oxA < minX) minX = oxA;
|
|
7598
|
+
if (oyA < minY) minY = oyA;
|
|
7599
|
+
if (oxA + pA.width > maxX) maxX = oxA + pA.width;
|
|
7600
|
+
if (oyA + pA.height > maxY) maxY = oyA + pA.height;
|
|
7601
|
+
const oxB = baseX + gapAB;
|
|
7602
|
+
const oyB = baseY;
|
|
7603
|
+
placements.push({ x: oxB + rdB.bbOffset.dx, y: oyB + rdB.bbOffset.dy, rotation: rdB.deg });
|
|
7604
|
+
if (oxB < minX) minX = oxB;
|
|
7605
|
+
if (oyB < minY) minY = oyB;
|
|
7606
|
+
if (oxB + pB.width > maxX) maxX = oxB + pB.width;
|
|
7607
|
+
if (oyB + pB.height > maxY) maxY = oyB + pB.height;
|
|
4495
7608
|
}
|
|
4496
7609
|
}
|
|
4497
|
-
|
|
4498
|
-
|
|
4499
|
-
|
|
4500
|
-
const
|
|
4501
|
-
const
|
|
4502
|
-
const
|
|
4503
|
-
|
|
4504
|
-
|
|
4505
|
-
|
|
4506
|
-
|
|
4507
|
-
|
|
4508
|
-
|
|
4509
|
-
|
|
4510
|
-
|
|
4511
|
-
|
|
4512
|
-
|
|
4513
|
-
|
|
4514
|
-
const stepX = isRowA ? stepX_A : stepX_B;
|
|
4515
|
-
if (oy + p.height > bounds.bottom) break;
|
|
4516
|
-
let sx = isRowA ? bounds.left : bounds.left + offsetX;
|
|
4517
|
-
if (sx < bounds.left) sx += stepX * Math.ceil((bounds.left - sx) / stepX);
|
|
4518
|
-
for (let ox = sx; ox + p.width <= bounds.right; ox += stepX) {
|
|
4519
|
-
placements.push({ x: ox + rd.bbOffset.dx, y: oy + rd.bbOffset.dy, rotation: rd.deg });
|
|
4520
|
-
if (ox < minX) minX = ox;
|
|
4521
|
-
if (oy < minY) minY = oy;
|
|
4522
|
-
if (ox + p.width > maxX) maxX = ox + p.width;
|
|
4523
|
-
if (oy + p.height > maxY) maxY = oy + p.height;
|
|
7610
|
+
const pairsRightEdge = bounds.left + (pairCols - 1) * pairStepX + pairW;
|
|
7611
|
+
const pairsBottomEdge = bounds.top + (pairRows - 1) * pairStepY + pairH;
|
|
7612
|
+
const gapRight = bounds.right - pairsRightEdge;
|
|
7613
|
+
const gapBottom = bounds.bottom - pairsBottomEdge;
|
|
7614
|
+
const extraRotations = [rdA, rdB];
|
|
7615
|
+
for (const rdExtra of extraRotations) {
|
|
7616
|
+
const pe = rdExtra.profile;
|
|
7617
|
+
if (pe.width <= gapRight) {
|
|
7618
|
+
for (let r = 0; r < pairRows; r++) {
|
|
7619
|
+
const ox = pairsRightEdge;
|
|
7620
|
+
const oy = bounds.top + r * pairStepY;
|
|
7621
|
+
if (ox + pe.width <= bounds.right && oy + pe.height <= bounds.bottom) {
|
|
7622
|
+
placements.push({ x: ox + rdExtra.bbOffset.dx, y: oy + rdExtra.bbOffset.dy, rotation: rdExtra.deg });
|
|
7623
|
+
if (ox + pe.width > maxX) maxX = ox + pe.width;
|
|
7624
|
+
}
|
|
7625
|
+
}
|
|
7626
|
+
break;
|
|
4524
7627
|
}
|
|
4525
|
-
oy += isRowA ? stepY_AB : stepY_BA;
|
|
4526
|
-
isRowA = !isRowA;
|
|
4527
7628
|
}
|
|
4528
|
-
|
|
4529
|
-
|
|
4530
|
-
|
|
4531
|
-
|
|
4532
|
-
|
|
4533
|
-
|
|
4534
|
-
|
|
4535
|
-
|
|
4536
|
-
|
|
4537
|
-
|
|
7629
|
+
for (const rdExtra of extraRotations) {
|
|
7630
|
+
const pe = rdExtra.profile;
|
|
7631
|
+
if (pe.height <= gapBottom) {
|
|
7632
|
+
for (let c = 0; c < pairCols; c++) {
|
|
7633
|
+
const oxA = bounds.left + c * pairStepX;
|
|
7634
|
+
const oy = pairsBottomEdge;
|
|
7635
|
+
if (oxA + pe.width <= bounds.right && oy + pe.height <= bounds.bottom) {
|
|
7636
|
+
placements.push({ x: oxA + rdExtra.bbOffset.dx, y: oy + rdExtra.bbOffset.dy, rotation: rdExtra.deg });
|
|
7637
|
+
if (oy + pe.height > maxY) maxY = oy + pe.height;
|
|
7638
|
+
}
|
|
7639
|
+
}
|
|
7640
|
+
break;
|
|
7641
|
+
}
|
|
4538
7642
|
}
|
|
7643
|
+
return { placements, count: placements.length, minX, minY, maxX, maxY };
|
|
4539
7644
|
}
|
|
4540
|
-
function
|
|
7645
|
+
function computeLayoutForPaper5(contourPoints, dielineW, dielineH, _paperWidth, _paperHeight, bounds) {
|
|
4541
7646
|
const rots = [0, 90, 180, 270];
|
|
4542
7647
|
const rd = /* @__PURE__ */ new Map();
|
|
4543
7648
|
for (const deg of rots) {
|
|
4544
|
-
rd.set(deg,
|
|
7649
|
+
rd.set(deg, prepareRotation5(contourPoints, dielineW, dielineH, deg));
|
|
4545
7650
|
}
|
|
4546
7651
|
const results = [];
|
|
4547
7652
|
for (const deg of rots) {
|
|
4548
7653
|
results.push(singleRotGrid(rd.get(deg), bounds));
|
|
4549
7654
|
}
|
|
4550
|
-
const
|
|
7655
|
+
const allPairs = [
|
|
4551
7656
|
[0, 180],
|
|
4552
7657
|
[90, 270],
|
|
4553
7658
|
[0, 90],
|
|
@@ -4555,7 +7660,7 @@ function computeLayoutForPaper(contourPoints, dielineW, dielineH, _paperWidth, _
|
|
|
4555
7660
|
[90, 180],
|
|
4556
7661
|
[180, 270]
|
|
4557
7662
|
];
|
|
4558
|
-
for (const [a, b] of
|
|
7663
|
+
for (const [a, b] of allPairs) {
|
|
4559
7664
|
const rdA = rd.get(a), rdB = rd.get(b);
|
|
4560
7665
|
const stepA = findMinStepX(rdA.profile, rdA.profile, 0);
|
|
4561
7666
|
if (stepA <= 0) continue;
|
|
@@ -4564,10 +7669,36 @@ function computeLayoutForPaper(contourPoints, dielineW, dielineH, _paperWidth, _
|
|
|
4564
7669
|
results.push(dualRotGrid(rdB, rdA, off, bounds));
|
|
4565
7670
|
}
|
|
4566
7671
|
}
|
|
4567
|
-
|
|
7672
|
+
for (const [a, b] of allPairs) {
|
|
7673
|
+
results.push(pairGrid4(rd.get(a), rd.get(b), bounds));
|
|
7674
|
+
results.push(pairGrid4(rd.get(b), rd.get(a), bounds));
|
|
7675
|
+
}
|
|
7676
|
+
const singleResults = [];
|
|
7677
|
+
const multiResults = [];
|
|
4568
7678
|
for (const r of results) {
|
|
4569
|
-
if (r.count
|
|
7679
|
+
if (r.count === 0) continue;
|
|
7680
|
+
const rotations = new Set(r.placements.map((p) => p.rotation));
|
|
7681
|
+
if (rotations.size > 1) {
|
|
7682
|
+
multiResults.push(r);
|
|
7683
|
+
} else {
|
|
7684
|
+
singleResults.push(r);
|
|
7685
|
+
}
|
|
7686
|
+
}
|
|
7687
|
+
function pickBest(arr) {
|
|
7688
|
+
let b = arr[0] ?? emptyResult();
|
|
7689
|
+
let bArea = (b.maxX - b.minX) * (b.maxY - b.minY);
|
|
7690
|
+
for (const r of arr) {
|
|
7691
|
+
const area = (r.maxX - r.minX) * (r.maxY - r.minY);
|
|
7692
|
+
if (r.count > b.count || r.count === b.count && area < bArea) {
|
|
7693
|
+
b = r;
|
|
7694
|
+
bArea = area;
|
|
7695
|
+
}
|
|
7696
|
+
}
|
|
7697
|
+
return b;
|
|
4570
7698
|
}
|
|
7699
|
+
const bestSingle = pickBest(singleResults);
|
|
7700
|
+
const bestMulti = pickBest(multiResults);
|
|
7701
|
+
const best = bestMulti.count >= bestSingle.count && bestMulti.count > 0 ? bestMulti : bestSingle;
|
|
4571
7702
|
centerLayout(best, bounds);
|
|
4572
7703
|
return {
|
|
4573
7704
|
rotation: best.placements[0]?.rotation ?? 0,
|
|
@@ -4576,8 +7707,8 @@ function computeLayoutForPaper(contourPoints, dielineW, dielineH, _paperWidth, _
|
|
|
4576
7707
|
};
|
|
4577
7708
|
}
|
|
4578
7709
|
|
|
4579
|
-
// src/utils/autoLayout/calculate/
|
|
4580
|
-
function
|
|
7710
|
+
// src/utils/autoLayout/calculate/bags-pillows/becf-c-12101/index.ts
|
|
7711
|
+
function prepareRotation6(contourPoints, dielineW, dielineH, deg) {
|
|
4581
7712
|
const rotated = normalizePoints(contourPoints, deg);
|
|
4582
7713
|
return {
|
|
4583
7714
|
profile: buildProfile(rotated),
|
|
@@ -4585,7 +7716,7 @@ function prepareRotation2(contourPoints, dielineW, dielineH, deg) {
|
|
|
4585
7716
|
deg
|
|
4586
7717
|
};
|
|
4587
7718
|
}
|
|
4588
|
-
function
|
|
7719
|
+
function pairGrid5(rdA, rdB, bounds) {
|
|
4589
7720
|
const pA = rdA.profile, pB = rdB.profile;
|
|
4590
7721
|
const gapAB = findMinStepX(pA, pB, 0);
|
|
4591
7722
|
if (gapAB <= 0) return emptyResult();
|
|
@@ -4661,11 +7792,11 @@ function pairGrid(rdA, rdB, bounds) {
|
|
|
4661
7792
|
}
|
|
4662
7793
|
return { placements, count: placements.length, minX, minY, maxX, maxY };
|
|
4663
7794
|
}
|
|
4664
|
-
function
|
|
7795
|
+
function computeLayoutForPaper6(contourPoints, dielineW, dielineH, _paperWidth, _paperHeight, bounds) {
|
|
4665
7796
|
const rots = [0, 90, 180, 270];
|
|
4666
7797
|
const rd = /* @__PURE__ */ new Map();
|
|
4667
7798
|
for (const deg of rots) {
|
|
4668
|
-
rd.set(deg,
|
|
7799
|
+
rd.set(deg, prepareRotation6(contourPoints, dielineW, dielineH, deg));
|
|
4669
7800
|
}
|
|
4670
7801
|
const results = [];
|
|
4671
7802
|
for (const deg of rots) {
|
|
@@ -4689,8 +7820,8 @@ function computeLayoutForPaper2(contourPoints, dielineW, dielineH, _paperWidth,
|
|
|
4689
7820
|
}
|
|
4690
7821
|
}
|
|
4691
7822
|
for (const [a, b] of allPairs) {
|
|
4692
|
-
results.push(
|
|
4693
|
-
results.push(
|
|
7823
|
+
results.push(pairGrid5(rd.get(a), rd.get(b), bounds));
|
|
7824
|
+
results.push(pairGrid5(rd.get(b), rd.get(a), bounds));
|
|
4694
7825
|
}
|
|
4695
7826
|
const singleResults = [];
|
|
4696
7827
|
const multiResults = [];
|
|
@@ -4726,8 +7857,8 @@ function computeLayoutForPaper2(contourPoints, dielineW, dielineH, _paperWidth,
|
|
|
4726
7857
|
};
|
|
4727
7858
|
}
|
|
4728
7859
|
|
|
4729
|
-
// src/utils/autoLayout/calculate/
|
|
4730
|
-
function
|
|
7860
|
+
// src/utils/autoLayout/calculate/bags-pillows/becf-c-12109/index.ts
|
|
7861
|
+
function prepareRotation7(contourPoints, dielineW, dielineH, deg) {
|
|
4731
7862
|
const rotated = normalizePoints(contourPoints, deg);
|
|
4732
7863
|
return {
|
|
4733
7864
|
profile: buildProfile(rotated),
|
|
@@ -4735,34 +7866,20 @@ function prepareRotation3(contourPoints, dielineW, dielineH, deg) {
|
|
|
4735
7866
|
deg
|
|
4736
7867
|
};
|
|
4737
7868
|
}
|
|
4738
|
-
function
|
|
4739
|
-
const reach = Math.max(pA.width, pB.width) + Math.abs(gapAB);
|
|
4740
|
-
const nMin = Math.floor(-reach / pairStepX) - 1;
|
|
4741
|
-
const nMax = Math.ceil(reach / pairStepX) + 1;
|
|
4742
|
-
let maxStep = 0;
|
|
4743
|
-
for (let n = nMin; n <= nMax; n++) {
|
|
4744
|
-
const dx = n * pairStepX;
|
|
4745
|
-
const s1 = findMinStepY(pA, pA, dx);
|
|
4746
|
-
if (s1 > maxStep) maxStep = s1;
|
|
4747
|
-
const s2 = findMinStepY(pA, pB, dx + gapAB);
|
|
4748
|
-
if (s2 > maxStep) maxStep = s2;
|
|
4749
|
-
const s3 = findMinStepY(pB, pA, dx - gapAB);
|
|
4750
|
-
if (s3 > maxStep) maxStep = s3;
|
|
4751
|
-
const s4 = findMinStepY(pB, pB, dx);
|
|
4752
|
-
if (s4 > maxStep) maxStep = s4;
|
|
4753
|
-
}
|
|
4754
|
-
return maxStep;
|
|
4755
|
-
}
|
|
4756
|
-
function pairGrid2(rdA, rdB, bounds) {
|
|
7869
|
+
function pairGrid6(rdA, rdB, bounds) {
|
|
4757
7870
|
const pA = rdA.profile, pB = rdB.profile;
|
|
4758
7871
|
const gapAB = findMinStepX(pA, pB, 0);
|
|
4759
7872
|
if (gapAB <= 0) return emptyResult();
|
|
4760
7873
|
const pairW = gapAB + pB.width;
|
|
4761
7874
|
const pairH = Math.max(pA.height, pB.height);
|
|
4762
7875
|
const pairStepX = gapAB + findMinStepX(pB, pA, 0);
|
|
4763
|
-
|
|
4764
|
-
|
|
4765
|
-
|
|
7876
|
+
const pairStepY = Math.max(
|
|
7877
|
+
findMinStepY(pA, pA, 0),
|
|
7878
|
+
findMinStepY(pA, pB, gapAB),
|
|
7879
|
+
findMinStepY(pB, pA, -gapAB),
|
|
7880
|
+
findMinStepY(pB, pB, 0)
|
|
7881
|
+
);
|
|
7882
|
+
if (pairStepX <= 0 || pairStepY <= 0) return emptyResult();
|
|
4766
7883
|
const usableW = bounds.right - bounds.left;
|
|
4767
7884
|
const usableH = bounds.bottom - bounds.top;
|
|
4768
7885
|
const pairCols = Math.max(0, Math.floor((usableW - pairW) / pairStepX) + 1);
|
|
@@ -4774,115 +7891,62 @@ function pairGrid2(rdA, rdB, bounds) {
|
|
|
4774
7891
|
for (let c = 0; c < pairCols; c++) {
|
|
4775
7892
|
const baseX = bounds.left + c * pairStepX;
|
|
4776
7893
|
const baseY = bounds.top + r * pairStepY;
|
|
4777
|
-
|
|
4778
|
-
|
|
4779
|
-
|
|
4780
|
-
if (
|
|
4781
|
-
if (
|
|
4782
|
-
|
|
4783
|
-
|
|
4784
|
-
|
|
4785
|
-
|
|
4786
|
-
|
|
7894
|
+
const oxA = baseX;
|
|
7895
|
+
const oyA = baseY;
|
|
7896
|
+
placements.push({ x: oxA + rdA.bbOffset.dx, y: oyA + rdA.bbOffset.dy, rotation: rdA.deg });
|
|
7897
|
+
if (oxA < minX) minX = oxA;
|
|
7898
|
+
if (oyA < minY) minY = oyA;
|
|
7899
|
+
if (oxA + pA.width > maxX) maxX = oxA + pA.width;
|
|
7900
|
+
if (oyA + pA.height > maxY) maxY = oyA + pA.height;
|
|
7901
|
+
const oxB = baseX + gapAB;
|
|
7902
|
+
const oyB = baseY;
|
|
7903
|
+
placements.push({ x: oxB + rdB.bbOffset.dx, y: oyB + rdB.bbOffset.dy, rotation: rdB.deg });
|
|
7904
|
+
if (oxB < minX) minX = oxB;
|
|
7905
|
+
if (oyB < minY) minY = oyB;
|
|
7906
|
+
if (oxB + pB.width > maxX) maxX = oxB + pB.width;
|
|
7907
|
+
if (oyB + pB.height > maxY) maxY = oyB + pB.height;
|
|
4787
7908
|
}
|
|
4788
7909
|
}
|
|
4789
7910
|
const pairsRightEdge = bounds.left + (pairCols - 1) * pairStepX + pairW;
|
|
4790
|
-
const gapRight = bounds.right - pairsRightEdge;
|
|
4791
|
-
for (const rdExtra of [rdA, rdB]) {
|
|
4792
|
-
const pe = rdExtra.profile;
|
|
4793
|
-
if (pe.width > gapRight) continue;
|
|
4794
|
-
const dxFromB = pairsRightEdge - (bounds.left + (pairCols - 1) * pairStepX + gapAB);
|
|
4795
|
-
const dxFromA = pairsRightEdge - bounds.left - (pairCols - 1) * pairStepX;
|
|
4796
|
-
const extraStepY = Math.max(
|
|
4797
|
-
findMinStepY(pA, pe, dxFromA),
|
|
4798
|
-
findMinStepY(pB, pe, dxFromB),
|
|
4799
|
-
findMinStepY(pe, pe, 0)
|
|
4800
|
-
);
|
|
4801
|
-
if (extraStepY <= 0) continue;
|
|
4802
|
-
const effectiveStepY = Math.max(pairStepY, extraStepY);
|
|
4803
|
-
const extraRows = Math.max(0, Math.floor((usableH - pe.height) / effectiveStepY) + 1);
|
|
4804
|
-
for (let r = 0; r < extraRows; r++) {
|
|
4805
|
-
const ox = pairsRightEdge;
|
|
4806
|
-
const oy = bounds.top + r * effectiveStepY;
|
|
4807
|
-
if (ox + pe.width <= bounds.right && oy + pe.height <= bounds.bottom) {
|
|
4808
|
-
placements.push({ x: ox + rdExtra.bbOffset.dx, y: oy + rdExtra.bbOffset.dy, rotation: rdExtra.deg });
|
|
4809
|
-
if (ox + pe.width > maxX) maxX = ox + pe.width;
|
|
4810
|
-
if (oy + pe.height > maxY) maxY = oy + pe.height;
|
|
4811
|
-
}
|
|
4812
|
-
}
|
|
4813
|
-
break;
|
|
4814
|
-
}
|
|
4815
7911
|
const pairsBottomEdge = bounds.top + (pairRows - 1) * pairStepY + pairH;
|
|
7912
|
+
const gapRight = bounds.right - pairsRightEdge;
|
|
4816
7913
|
const gapBottom = bounds.bottom - pairsBottomEdge;
|
|
4817
|
-
|
|
7914
|
+
const extraRotations = [rdA, rdB];
|
|
7915
|
+
for (const rdExtra of extraRotations) {
|
|
4818
7916
|
const pe = rdExtra.profile;
|
|
4819
|
-
if (pe.
|
|
4820
|
-
|
|
4821
|
-
|
|
4822
|
-
|
|
4823
|
-
|
|
4824
|
-
|
|
4825
|
-
|
|
4826
|
-
|
|
4827
|
-
for (let c = 0; c < extraCols; c++) {
|
|
4828
|
-
const ox = bounds.left + c * extraStepX;
|
|
4829
|
-
const oy = pairsBottomEdge;
|
|
4830
|
-
if (ox + pe.width <= bounds.right && oy + pe.height <= bounds.bottom) {
|
|
4831
|
-
placements.push({ x: ox + rdExtra.bbOffset.dx, y: oy + rdExtra.bbOffset.dy, rotation: rdExtra.deg });
|
|
4832
|
-
if (ox + pe.width > maxX) maxX = ox + pe.width;
|
|
4833
|
-
if (oy + pe.height > maxY) maxY = oy + pe.height;
|
|
7917
|
+
if (pe.width <= gapRight) {
|
|
7918
|
+
for (let r = 0; r < pairRows; r++) {
|
|
7919
|
+
const ox = pairsRightEdge;
|
|
7920
|
+
const oy = bounds.top + r * pairStepY;
|
|
7921
|
+
if (ox + pe.width <= bounds.right && oy + pe.height <= bounds.bottom) {
|
|
7922
|
+
placements.push({ x: ox + rdExtra.bbOffset.dx, y: oy + rdExtra.bbOffset.dy, rotation: rdExtra.deg });
|
|
7923
|
+
if (ox + pe.width > maxX) maxX = ox + pe.width;
|
|
7924
|
+
}
|
|
4834
7925
|
}
|
|
7926
|
+
break;
|
|
4835
7927
|
}
|
|
4836
|
-
break;
|
|
4837
7928
|
}
|
|
4838
|
-
|
|
4839
|
-
|
|
4840
|
-
|
|
4841
|
-
|
|
4842
|
-
|
|
4843
|
-
|
|
4844
|
-
|
|
4845
|
-
|
|
4846
|
-
|
|
4847
|
-
|
|
4848
|
-
|
|
4849
|
-
|
|
4850
|
-
const stepXAB = findMinStepX(pA, pB, -gapAB_Y);
|
|
4851
|
-
const stepXBA = findMinStepX(pB, pA, gapAB_Y);
|
|
4852
|
-
const stepXBB = findMinStepX(pB, pB, 0);
|
|
4853
|
-
vpairStepX = Math.max(stepXAA, stepXAB, stepXBA, stepXBB);
|
|
4854
|
-
}
|
|
4855
|
-
if (vpairStepX <= 0) return emptyResult();
|
|
4856
|
-
const vpairStepY = gapAB_Y + findMinStepY(pB, pA, 0);
|
|
4857
|
-
if (vpairStepY <= 0) return emptyResult();
|
|
4858
|
-
const usableW = bounds.right - bounds.left;
|
|
4859
|
-
const usableH = bounds.bottom - bounds.top;
|
|
4860
|
-
const cols = Math.max(0, Math.floor((usableW - vpairW) / vpairStepX) + 1);
|
|
4861
|
-
const rows = Math.max(0, Math.floor((usableH - vpairH) / vpairStepY) + 1);
|
|
4862
|
-
if (cols === 0 || rows === 0) return emptyResult();
|
|
4863
|
-
const placements = [];
|
|
4864
|
-
let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
|
|
4865
|
-
for (let r = 0; r < rows; r++) {
|
|
4866
|
-
for (let c = 0; c < cols; c++) {
|
|
4867
|
-
const baseX = bounds.left + c * vpairStepX;
|
|
4868
|
-
const baseY = bounds.top + r * vpairStepY;
|
|
4869
|
-
placements.push({ x: baseX + rdA.bbOffset.dx, y: baseY + rdA.bbOffset.dy, rotation: rdA.deg });
|
|
4870
|
-
if (baseX < minX) minX = baseX;
|
|
4871
|
-
if (baseY < minY) minY = baseY;
|
|
4872
|
-
if (baseX + pA.width > maxX) maxX = baseX + pA.width;
|
|
4873
|
-
if (baseY + pA.height > maxY) maxY = baseY + pA.height;
|
|
4874
|
-
const by = baseY + gapAB_Y;
|
|
4875
|
-
placements.push({ x: baseX + rdB.bbOffset.dx, y: by + rdB.bbOffset.dy, rotation: rdB.deg });
|
|
4876
|
-
if (by + pB.height > maxY) maxY = by + pB.height;
|
|
7929
|
+
for (const rdExtra of extraRotations) {
|
|
7930
|
+
const pe = rdExtra.profile;
|
|
7931
|
+
if (pe.height <= gapBottom) {
|
|
7932
|
+
for (let c = 0; c < pairCols; c++) {
|
|
7933
|
+
const oxA = bounds.left + c * pairStepX;
|
|
7934
|
+
const oy = pairsBottomEdge;
|
|
7935
|
+
if (oxA + pe.width <= bounds.right && oy + pe.height <= bounds.bottom) {
|
|
7936
|
+
placements.push({ x: oxA + rdExtra.bbOffset.dx, y: oy + rdExtra.bbOffset.dy, rotation: rdExtra.deg });
|
|
7937
|
+
if (oy + pe.height > maxY) maxY = oy + pe.height;
|
|
7938
|
+
}
|
|
7939
|
+
}
|
|
7940
|
+
break;
|
|
4877
7941
|
}
|
|
4878
7942
|
}
|
|
4879
7943
|
return { placements, count: placements.length, minX, minY, maxX, maxY };
|
|
4880
7944
|
}
|
|
4881
|
-
function
|
|
7945
|
+
function computeLayoutForPaper7(contourPoints, dielineW, dielineH, _paperWidth, _paperHeight, bounds) {
|
|
4882
7946
|
const rots = [0, 90, 180, 270];
|
|
4883
7947
|
const rd = /* @__PURE__ */ new Map();
|
|
4884
7948
|
for (const deg of rots) {
|
|
4885
|
-
rd.set(deg,
|
|
7949
|
+
rd.set(deg, prepareRotation7(contourPoints, dielineW, dielineH, deg));
|
|
4886
7950
|
}
|
|
4887
7951
|
const results = [];
|
|
4888
7952
|
for (const deg of rots) {
|
|
@@ -4906,12 +7970,8 @@ function computeLayoutForPaper3(contourPoints, dielineW, dielineH, _paperWidth,
|
|
|
4906
7970
|
}
|
|
4907
7971
|
}
|
|
4908
7972
|
for (const [a, b] of allPairs) {
|
|
4909
|
-
results.push(
|
|
4910
|
-
results.push(
|
|
4911
|
-
}
|
|
4912
|
-
for (const [a, b] of allPairs) {
|
|
4913
|
-
results.push(verticalPairGrid(rd.get(a), rd.get(b), bounds));
|
|
4914
|
-
results.push(verticalPairGrid(rd.get(b), rd.get(a), bounds));
|
|
7973
|
+
results.push(pairGrid6(rd.get(a), rd.get(b), bounds));
|
|
7974
|
+
results.push(pairGrid6(rd.get(b), rd.get(a), bounds));
|
|
4915
7975
|
}
|
|
4916
7976
|
const singleResults = [];
|
|
4917
7977
|
const multiResults = [];
|
|
@@ -4947,8 +8007,8 @@ function computeLayoutForPaper3(contourPoints, dielineW, dielineH, _paperWidth,
|
|
|
4947
8007
|
};
|
|
4948
8008
|
}
|
|
4949
8009
|
|
|
4950
|
-
// src/utils/autoLayout/calculate/bags-pillows/becf-12101/index.ts
|
|
4951
|
-
function
|
|
8010
|
+
// src/utils/autoLayout/calculate/bags-pillows/becf-b-12101/index.ts
|
|
8011
|
+
function prepareRotation8(contourPoints, dielineW, dielineH, deg) {
|
|
4952
8012
|
const rotated = normalizePoints(contourPoints, deg);
|
|
4953
8013
|
return {
|
|
4954
8014
|
profile: buildProfile(rotated),
|
|
@@ -4956,7 +8016,7 @@ function prepareRotation4(contourPoints, dielineW, dielineH, deg) {
|
|
|
4956
8016
|
deg
|
|
4957
8017
|
};
|
|
4958
8018
|
}
|
|
4959
|
-
function
|
|
8019
|
+
function pairGrid7(rdA, rdB, bounds) {
|
|
4960
8020
|
const pA = rdA.profile, pB = rdB.profile;
|
|
4961
8021
|
const gapAB = findMinStepX(pA, pB, 0);
|
|
4962
8022
|
if (gapAB <= 0) return emptyResult();
|
|
@@ -4981,28 +8041,23 @@ function pairGrid3(rdA, rdB, bounds) {
|
|
|
4981
8041
|
for (let c = 0; c < pairCols; c++) {
|
|
4982
8042
|
const baseX = bounds.left + c * pairStepX;
|
|
4983
8043
|
const baseY = bounds.top + r * pairStepY;
|
|
4984
|
-
|
|
4985
|
-
|
|
4986
|
-
|
|
4987
|
-
if (
|
|
4988
|
-
if (
|
|
4989
|
-
if (oxA + pA.width > maxX) maxX = oxA + pA.width;
|
|
4990
|
-
if (oyA + pA.height > maxY) maxY = oyA + pA.height;
|
|
8044
|
+
placements.push({ x: baseX + rdA.bbOffset.dx, y: baseY + rdA.bbOffset.dy, rotation: rdA.deg });
|
|
8045
|
+
if (baseX < minX) minX = baseX;
|
|
8046
|
+
if (baseY < minY) minY = baseY;
|
|
8047
|
+
if (baseX + pA.width > maxX) maxX = baseX + pA.width;
|
|
8048
|
+
if (baseY + pA.height > maxY) maxY = baseY + pA.height;
|
|
4991
8049
|
const oxB = baseX + gapAB;
|
|
4992
|
-
|
|
4993
|
-
placements.push({ x: oxB + rdB.bbOffset.dx, y: oyB + rdB.bbOffset.dy, rotation: rdB.deg });
|
|
8050
|
+
placements.push({ x: oxB + rdB.bbOffset.dx, y: baseY + rdB.bbOffset.dy, rotation: rdB.deg });
|
|
4994
8051
|
if (oxB < minX) minX = oxB;
|
|
4995
|
-
if (oyB < minY) minY = oyB;
|
|
4996
8052
|
if (oxB + pB.width > maxX) maxX = oxB + pB.width;
|
|
4997
|
-
if (
|
|
8053
|
+
if (baseY + pB.height > maxY) maxY = baseY + pB.height;
|
|
4998
8054
|
}
|
|
4999
8055
|
}
|
|
5000
8056
|
const pairsRightEdge = bounds.left + (pairCols - 1) * pairStepX + pairW;
|
|
5001
8057
|
const pairsBottomEdge = bounds.top + (pairRows - 1) * pairStepY + pairH;
|
|
5002
8058
|
const gapRight = bounds.right - pairsRightEdge;
|
|
5003
8059
|
const gapBottom = bounds.bottom - pairsBottomEdge;
|
|
5004
|
-
const
|
|
5005
|
-
for (const rdExtra of extraRotations) {
|
|
8060
|
+
for (const rdExtra of [rdA, rdB]) {
|
|
5006
8061
|
const pe = rdExtra.profile;
|
|
5007
8062
|
if (pe.width <= gapRight) {
|
|
5008
8063
|
for (let r = 0; r < pairRows; r++) {
|
|
@@ -5016,7 +8071,7 @@ function pairGrid3(rdA, rdB, bounds) {
|
|
|
5016
8071
|
break;
|
|
5017
8072
|
}
|
|
5018
8073
|
}
|
|
5019
|
-
for (const rdExtra of
|
|
8074
|
+
for (const rdExtra of [rdA, rdB]) {
|
|
5020
8075
|
const pe = rdExtra.profile;
|
|
5021
8076
|
if (pe.height <= gapBottom) {
|
|
5022
8077
|
for (let c = 0; c < pairCols; c++) {
|
|
@@ -5032,24 +8087,13 @@ function pairGrid3(rdA, rdB, bounds) {
|
|
|
5032
8087
|
}
|
|
5033
8088
|
return { placements, count: placements.length, minX, minY, maxX, maxY };
|
|
5034
8089
|
}
|
|
5035
|
-
function
|
|
8090
|
+
function computeLayoutForPaper8(contourPoints, dielineW, dielineH, _paperWidth, _paperHeight, bounds) {
|
|
5036
8091
|
const rots = [0, 90, 180, 270];
|
|
5037
8092
|
const rd = /* @__PURE__ */ new Map();
|
|
5038
|
-
for (const deg of rots)
|
|
5039
|
-
rd.set(deg, prepareRotation4(contourPoints, dielineW, dielineH, deg));
|
|
5040
|
-
}
|
|
8093
|
+
for (const deg of rots) rd.set(deg, prepareRotation8(contourPoints, dielineW, dielineH, deg));
|
|
5041
8094
|
const results = [];
|
|
5042
|
-
for (const deg of rots)
|
|
5043
|
-
|
|
5044
|
-
}
|
|
5045
|
-
const allPairs = [
|
|
5046
|
-
[0, 180],
|
|
5047
|
-
[90, 270],
|
|
5048
|
-
[0, 90],
|
|
5049
|
-
[0, 270],
|
|
5050
|
-
[90, 180],
|
|
5051
|
-
[180, 270]
|
|
5052
|
-
];
|
|
8095
|
+
for (const deg of rots) results.push(singleRotGrid(rd.get(deg), bounds));
|
|
8096
|
+
const allPairs = [[0, 180], [90, 270], [0, 90], [0, 270], [90, 180], [180, 270]];
|
|
5053
8097
|
for (const [a, b] of allPairs) {
|
|
5054
8098
|
const rdA = rd.get(a), rdB = rd.get(b);
|
|
5055
8099
|
const stepA = findMinStepX(rdA.profile, rdA.profile, 0);
|
|
@@ -5060,19 +8104,15 @@ function computeLayoutForPaper4(contourPoints, dielineW, dielineH, _paperWidth,
|
|
|
5060
8104
|
}
|
|
5061
8105
|
}
|
|
5062
8106
|
for (const [a, b] of allPairs) {
|
|
5063
|
-
results.push(
|
|
5064
|
-
results.push(
|
|
8107
|
+
results.push(pairGrid7(rd.get(a), rd.get(b), bounds));
|
|
8108
|
+
results.push(pairGrid7(rd.get(b), rd.get(a), bounds));
|
|
5065
8109
|
}
|
|
5066
8110
|
const singleResults = [];
|
|
5067
8111
|
const multiResults = [];
|
|
5068
8112
|
for (const r of results) {
|
|
5069
8113
|
if (r.count === 0) continue;
|
|
5070
8114
|
const rotations = new Set(r.placements.map((p) => p.rotation));
|
|
5071
|
-
|
|
5072
|
-
multiResults.push(r);
|
|
5073
|
-
} else {
|
|
5074
|
-
singleResults.push(r);
|
|
5075
|
-
}
|
|
8115
|
+
(rotations.size > 1 ? multiResults : singleResults).push(r);
|
|
5076
8116
|
}
|
|
5077
8117
|
function pickBest(arr) {
|
|
5078
8118
|
let b = arr[0] ?? emptyResult();
|
|
@@ -5090,15 +8130,11 @@ function computeLayoutForPaper4(contourPoints, dielineW, dielineH, _paperWidth,
|
|
|
5090
8130
|
const bestMulti = pickBest(multiResults);
|
|
5091
8131
|
const best = bestMulti.count >= bestSingle.count && bestMulti.count > 0 ? bestMulti : bestSingle;
|
|
5092
8132
|
centerLayout(best, bounds);
|
|
5093
|
-
return {
|
|
5094
|
-
rotation: best.placements[0]?.rotation ?? 0,
|
|
5095
|
-
placements: best.placements,
|
|
5096
|
-
producedPerSheet: best.count
|
|
5097
|
-
};
|
|
8133
|
+
return { rotation: best.placements[0]?.rotation ?? 0, placements: best.placements, producedPerSheet: best.count };
|
|
5098
8134
|
}
|
|
5099
8135
|
|
|
5100
|
-
// src/utils/autoLayout/calculate/bags-pillows/becf-12109/index.ts
|
|
5101
|
-
function
|
|
8136
|
+
// src/utils/autoLayout/calculate/bags-pillows/becf-b-12109/index.ts
|
|
8137
|
+
function prepareRotation9(contourPoints, dielineW, dielineH, deg) {
|
|
5102
8138
|
const rotated = normalizePoints(contourPoints, deg);
|
|
5103
8139
|
return {
|
|
5104
8140
|
profile: buildProfile(rotated),
|
|
@@ -5106,7 +8142,7 @@ function prepareRotation5(contourPoints, dielineW, dielineH, deg) {
|
|
|
5106
8142
|
deg
|
|
5107
8143
|
};
|
|
5108
8144
|
}
|
|
5109
|
-
function
|
|
8145
|
+
function pairGrid8(rdA, rdB, bounds) {
|
|
5110
8146
|
const pA = rdA.profile, pB = rdB.profile;
|
|
5111
8147
|
const gapAB = findMinStepX(pA, pB, 0);
|
|
5112
8148
|
if (gapAB <= 0) return emptyResult();
|
|
@@ -5131,28 +8167,23 @@ function pairGrid4(rdA, rdB, bounds) {
|
|
|
5131
8167
|
for (let c = 0; c < pairCols; c++) {
|
|
5132
8168
|
const baseX = bounds.left + c * pairStepX;
|
|
5133
8169
|
const baseY = bounds.top + r * pairStepY;
|
|
5134
|
-
|
|
5135
|
-
|
|
5136
|
-
|
|
5137
|
-
if (
|
|
5138
|
-
if (
|
|
5139
|
-
if (oxA + pA.width > maxX) maxX = oxA + pA.width;
|
|
5140
|
-
if (oyA + pA.height > maxY) maxY = oyA + pA.height;
|
|
8170
|
+
placements.push({ x: baseX + rdA.bbOffset.dx, y: baseY + rdA.bbOffset.dy, rotation: rdA.deg });
|
|
8171
|
+
if (baseX < minX) minX = baseX;
|
|
8172
|
+
if (baseY < minY) minY = baseY;
|
|
8173
|
+
if (baseX + pA.width > maxX) maxX = baseX + pA.width;
|
|
8174
|
+
if (baseY + pA.height > maxY) maxY = baseY + pA.height;
|
|
5141
8175
|
const oxB = baseX + gapAB;
|
|
5142
|
-
|
|
5143
|
-
placements.push({ x: oxB + rdB.bbOffset.dx, y: oyB + rdB.bbOffset.dy, rotation: rdB.deg });
|
|
8176
|
+
placements.push({ x: oxB + rdB.bbOffset.dx, y: baseY + rdB.bbOffset.dy, rotation: rdB.deg });
|
|
5144
8177
|
if (oxB < minX) minX = oxB;
|
|
5145
|
-
if (oyB < minY) minY = oyB;
|
|
5146
8178
|
if (oxB + pB.width > maxX) maxX = oxB + pB.width;
|
|
5147
|
-
if (
|
|
8179
|
+
if (baseY + pB.height > maxY) maxY = baseY + pB.height;
|
|
5148
8180
|
}
|
|
5149
8181
|
}
|
|
5150
8182
|
const pairsRightEdge = bounds.left + (pairCols - 1) * pairStepX + pairW;
|
|
5151
8183
|
const pairsBottomEdge = bounds.top + (pairRows - 1) * pairStepY + pairH;
|
|
5152
8184
|
const gapRight = bounds.right - pairsRightEdge;
|
|
5153
8185
|
const gapBottom = bounds.bottom - pairsBottomEdge;
|
|
5154
|
-
const
|
|
5155
|
-
for (const rdExtra of extraRotations) {
|
|
8186
|
+
for (const rdExtra of [rdA, rdB]) {
|
|
5156
8187
|
const pe = rdExtra.profile;
|
|
5157
8188
|
if (pe.width <= gapRight) {
|
|
5158
8189
|
for (let r = 0; r < pairRows; r++) {
|
|
@@ -5166,7 +8197,7 @@ function pairGrid4(rdA, rdB, bounds) {
|
|
|
5166
8197
|
break;
|
|
5167
8198
|
}
|
|
5168
8199
|
}
|
|
5169
|
-
for (const rdExtra of
|
|
8200
|
+
for (const rdExtra of [rdA, rdB]) {
|
|
5170
8201
|
const pe = rdExtra.profile;
|
|
5171
8202
|
if (pe.height <= gapBottom) {
|
|
5172
8203
|
for (let c = 0; c < pairCols; c++) {
|
|
@@ -5182,24 +8213,13 @@ function pairGrid4(rdA, rdB, bounds) {
|
|
|
5182
8213
|
}
|
|
5183
8214
|
return { placements, count: placements.length, minX, minY, maxX, maxY };
|
|
5184
8215
|
}
|
|
5185
|
-
function
|
|
8216
|
+
function computeLayoutForPaper9(contourPoints, dielineW, dielineH, _paperWidth, _paperHeight, bounds) {
|
|
5186
8217
|
const rots = [0, 90, 180, 270];
|
|
5187
8218
|
const rd = /* @__PURE__ */ new Map();
|
|
5188
|
-
for (const deg of rots)
|
|
5189
|
-
rd.set(deg, prepareRotation5(contourPoints, dielineW, dielineH, deg));
|
|
5190
|
-
}
|
|
8219
|
+
for (const deg of rots) rd.set(deg, prepareRotation9(contourPoints, dielineW, dielineH, deg));
|
|
5191
8220
|
const results = [];
|
|
5192
|
-
for (const deg of rots)
|
|
5193
|
-
|
|
5194
|
-
}
|
|
5195
|
-
const allPairs = [
|
|
5196
|
-
[0, 180],
|
|
5197
|
-
[90, 270],
|
|
5198
|
-
[0, 90],
|
|
5199
|
-
[0, 270],
|
|
5200
|
-
[90, 180],
|
|
5201
|
-
[180, 270]
|
|
5202
|
-
];
|
|
8221
|
+
for (const deg of rots) results.push(singleRotGrid(rd.get(deg), bounds));
|
|
8222
|
+
const allPairs = [[0, 180], [90, 270], [0, 90], [0, 270], [90, 180], [180, 270]];
|
|
5203
8223
|
for (const [a, b] of allPairs) {
|
|
5204
8224
|
const rdA = rd.get(a), rdB = rd.get(b);
|
|
5205
8225
|
const stepA = findMinStepX(rdA.profile, rdA.profile, 0);
|
|
@@ -5210,19 +8230,15 @@ function computeLayoutForPaper5(contourPoints, dielineW, dielineH, _paperWidth,
|
|
|
5210
8230
|
}
|
|
5211
8231
|
}
|
|
5212
8232
|
for (const [a, b] of allPairs) {
|
|
5213
|
-
results.push(
|
|
5214
|
-
results.push(
|
|
8233
|
+
results.push(pairGrid8(rd.get(a), rd.get(b), bounds));
|
|
8234
|
+
results.push(pairGrid8(rd.get(b), rd.get(a), bounds));
|
|
5215
8235
|
}
|
|
5216
8236
|
const singleResults = [];
|
|
5217
8237
|
const multiResults = [];
|
|
5218
8238
|
for (const r of results) {
|
|
5219
8239
|
if (r.count === 0) continue;
|
|
5220
8240
|
const rotations = new Set(r.placements.map((p) => p.rotation));
|
|
5221
|
-
|
|
5222
|
-
multiResults.push(r);
|
|
5223
|
-
} else {
|
|
5224
|
-
singleResults.push(r);
|
|
5225
|
-
}
|
|
8241
|
+
(rotations.size > 1 ? multiResults : singleResults).push(r);
|
|
5226
8242
|
}
|
|
5227
8243
|
function pickBest(arr) {
|
|
5228
8244
|
let b = arr[0] ?? emptyResult();
|
|
@@ -5240,11 +8256,7 @@ function computeLayoutForPaper5(contourPoints, dielineW, dielineH, _paperWidth,
|
|
|
5240
8256
|
const bestMulti = pickBest(multiResults);
|
|
5241
8257
|
const best = bestMulti.count >= bestSingle.count && bestMulti.count > 0 ? bestMulti : bestSingle;
|
|
5242
8258
|
centerLayout(best, bounds);
|
|
5243
|
-
return {
|
|
5244
|
-
rotation: best.placements[0]?.rotation ?? 0,
|
|
5245
|
-
placements: best.placements,
|
|
5246
|
-
producedPerSheet: best.count
|
|
5247
|
-
};
|
|
8259
|
+
return { rotation: best.placements[0]?.rotation ?? 0, placements: best.placements, producedPerSheet: best.count };
|
|
5248
8260
|
}
|
|
5249
8261
|
|
|
5250
8262
|
// src/utils/autoLayout/calculate/index.ts
|
|
@@ -5290,6 +8302,38 @@ function resolveModelFunctions(modelId, attrs) {
|
|
|
5290
8302
|
offsetContour: offsetContour6
|
|
5291
8303
|
};
|
|
5292
8304
|
}
|
|
8305
|
+
case "BECF-C-12101": {
|
|
8306
|
+
const a = attrs;
|
|
8307
|
+
return {
|
|
8308
|
+
contour: generateOuterContour7(a),
|
|
8309
|
+
dieline: generateBecfC12101(a),
|
|
8310
|
+
offsetContour: offsetContour7
|
|
8311
|
+
};
|
|
8312
|
+
}
|
|
8313
|
+
case "BECF-C-12109": {
|
|
8314
|
+
const a = attrs;
|
|
8315
|
+
return {
|
|
8316
|
+
contour: generateOuterContour8(a),
|
|
8317
|
+
dieline: generateBecfC12109(a),
|
|
8318
|
+
offsetContour: offsetContour8
|
|
8319
|
+
};
|
|
8320
|
+
}
|
|
8321
|
+
case "BECF-B-12101": {
|
|
8322
|
+
const a = attrs;
|
|
8323
|
+
return {
|
|
8324
|
+
contour: generateOuterContour9(a),
|
|
8325
|
+
dieline: generateBecfB12101(a),
|
|
8326
|
+
offsetContour: offsetContour9
|
|
8327
|
+
};
|
|
8328
|
+
}
|
|
8329
|
+
case "BECF-B-12109": {
|
|
8330
|
+
const a = attrs;
|
|
8331
|
+
return {
|
|
8332
|
+
contour: generateOuterContour10(a),
|
|
8333
|
+
dieline: generateBecfB12109(a),
|
|
8334
|
+
offsetContour: offsetContour10
|
|
8335
|
+
};
|
|
8336
|
+
}
|
|
5293
8337
|
case "BECF-1010A":
|
|
5294
8338
|
default: {
|
|
5295
8339
|
const a = attrs;
|
|
@@ -5313,6 +8357,14 @@ function resolveLayoutCalculator(modelId) {
|
|
|
5313
8357
|
return computeLayoutForPaper4;
|
|
5314
8358
|
case "BECF-12109":
|
|
5315
8359
|
return computeLayoutForPaper5;
|
|
8360
|
+
case "BECF-C-12101":
|
|
8361
|
+
return computeLayoutForPaper6;
|
|
8362
|
+
case "BECF-C-12109":
|
|
8363
|
+
return computeLayoutForPaper7;
|
|
8364
|
+
case "BECF-B-12101":
|
|
8365
|
+
return computeLayoutForPaper8;
|
|
8366
|
+
case "BECF-B-12109":
|
|
8367
|
+
return computeLayoutForPaper9;
|
|
5316
8368
|
default:
|
|
5317
8369
|
return computeLayoutForPaperDefault;
|
|
5318
8370
|
}
|
|
@@ -5326,11 +8378,11 @@ function calculateAutoLayout(rawConfig) {
|
|
|
5326
8378
|
colorbarHeight: rawConfig.colorbarHeight ?? 5,
|
|
5327
8379
|
isShowColorbar: rawConfig.isShowColorbar ?? true
|
|
5328
8380
|
};
|
|
5329
|
-
const { contour, dieline, offsetContour:
|
|
8381
|
+
const { contour, dieline, offsetContour: offsetContour11 } = resolveModelFunctions(
|
|
5330
8382
|
config.model.modelId,
|
|
5331
8383
|
config.model.attributes
|
|
5332
8384
|
);
|
|
5333
|
-
const offsetContourPoints = config.layoutDistance > 0 ?
|
|
8385
|
+
const offsetContourPoints = config.layoutDistance > 0 ? offsetContour11(contour, config.layoutDistance / 2) : contour;
|
|
5334
8386
|
const cbDepth = config.isShowColorbar ? config.colorbarHeight : 0;
|
|
5335
8387
|
const computeLayout = resolveLayoutCalculator(config.model.modelId);
|
|
5336
8388
|
const paperResults = [];
|
|
@@ -5691,6 +8743,46 @@ function renderDieLine(modelId, attrs) {
|
|
|
5691
8743
|
renderAs: "group"
|
|
5692
8744
|
}
|
|
5693
8745
|
);
|
|
8746
|
+
case "BECF-12109":
|
|
8747
|
+
return /* @__PURE__ */ jsx(
|
|
8748
|
+
DIE_LINE_BECF_12109,
|
|
8749
|
+
{
|
|
8750
|
+
attributes: attrs,
|
|
8751
|
+
renderAs: "group"
|
|
8752
|
+
}
|
|
8753
|
+
);
|
|
8754
|
+
case "BECF-C-12101":
|
|
8755
|
+
return /* @__PURE__ */ jsx(
|
|
8756
|
+
DIE_LINE_BECF_C_12101,
|
|
8757
|
+
{
|
|
8758
|
+
attributes: attrs,
|
|
8759
|
+
renderAs: "group"
|
|
8760
|
+
}
|
|
8761
|
+
);
|
|
8762
|
+
case "BECF-C-12109":
|
|
8763
|
+
return /* @__PURE__ */ jsx(
|
|
8764
|
+
DIE_LINE_BECF_C_12109,
|
|
8765
|
+
{
|
|
8766
|
+
attributes: attrs,
|
|
8767
|
+
renderAs: "group"
|
|
8768
|
+
}
|
|
8769
|
+
);
|
|
8770
|
+
case "BECF-B-12101":
|
|
8771
|
+
return /* @__PURE__ */ jsx(
|
|
8772
|
+
DIE_LINE_BECF_B_12101,
|
|
8773
|
+
{
|
|
8774
|
+
attributes: attrs,
|
|
8775
|
+
renderAs: "group"
|
|
8776
|
+
}
|
|
8777
|
+
);
|
|
8778
|
+
case "BECF-B-12109":
|
|
8779
|
+
return /* @__PURE__ */ jsx(
|
|
8780
|
+
DIE_LINE_BECF_B_12109,
|
|
8781
|
+
{
|
|
8782
|
+
attributes: attrs,
|
|
8783
|
+
renderAs: "group"
|
|
8784
|
+
}
|
|
8785
|
+
);
|
|
5694
8786
|
case "BECF-1010A":
|
|
5695
8787
|
default:
|
|
5696
8788
|
return /* @__PURE__ */ jsx(
|
|
@@ -6281,6 +9373,50 @@ function resolveModel(modelId, attrs, layoutDistance) {
|
|
|
6281
9373
|
generateContour: (a) => generateOuterContour6(a)
|
|
6282
9374
|
};
|
|
6283
9375
|
}
|
|
9376
|
+
case "BECF-C-12101": {
|
|
9377
|
+
const typedAttrs = attrs;
|
|
9378
|
+
const contour = generateOuterContour7(typedAttrs);
|
|
9379
|
+
return {
|
|
9380
|
+
dieline: generateBecfC12101(typedAttrs),
|
|
9381
|
+
contourPath: contourToPath7(contour),
|
|
9382
|
+
offsetContourPoints: layoutDistance > 0 ? offsetContour7(contour, layoutDistance / 2) : contour,
|
|
9383
|
+
generate: (a) => generateBecfC12101(a),
|
|
9384
|
+
generateContour: (a) => generateOuterContour7(a)
|
|
9385
|
+
};
|
|
9386
|
+
}
|
|
9387
|
+
case "BECF-C-12109": {
|
|
9388
|
+
const typedAttrs = attrs;
|
|
9389
|
+
const contour = generateOuterContour8(typedAttrs);
|
|
9390
|
+
return {
|
|
9391
|
+
dieline: generateBecfC12109(typedAttrs),
|
|
9392
|
+
contourPath: contourToPath8(contour),
|
|
9393
|
+
offsetContourPoints: layoutDistance > 0 ? offsetContour8(contour, layoutDistance / 2) : contour,
|
|
9394
|
+
generate: (a) => generateBecfC12109(a),
|
|
9395
|
+
generateContour: (a) => generateOuterContour8(a)
|
|
9396
|
+
};
|
|
9397
|
+
}
|
|
9398
|
+
case "BECF-B-12101": {
|
|
9399
|
+
const typedAttrs = attrs;
|
|
9400
|
+
const contour = generateOuterContour9(typedAttrs);
|
|
9401
|
+
return {
|
|
9402
|
+
dieline: generateBecfB12101(typedAttrs),
|
|
9403
|
+
contourPath: contourToPath9(contour),
|
|
9404
|
+
offsetContourPoints: layoutDistance > 0 ? offsetContour9(contour, layoutDistance / 2) : contour,
|
|
9405
|
+
generate: (a) => generateBecfB12101(a),
|
|
9406
|
+
generateContour: (a) => generateOuterContour9(a)
|
|
9407
|
+
};
|
|
9408
|
+
}
|
|
9409
|
+
case "BECF-B-12109": {
|
|
9410
|
+
const typedAttrs = attrs;
|
|
9411
|
+
const contour = generateOuterContour10(typedAttrs);
|
|
9412
|
+
return {
|
|
9413
|
+
dieline: generateBecfB12109(typedAttrs),
|
|
9414
|
+
contourPath: contourToPath10(contour),
|
|
9415
|
+
offsetContourPoints: layoutDistance > 0 ? offsetContour10(contour, layoutDistance / 2) : contour,
|
|
9416
|
+
generate: (a) => generateBecfB12109(a),
|
|
9417
|
+
generateContour: (a) => generateOuterContour10(a)
|
|
9418
|
+
};
|
|
9419
|
+
}
|
|
6284
9420
|
case "BECF-1010A":
|
|
6285
9421
|
default: {
|
|
6286
9422
|
const typedAttrs = attrs;
|
|
@@ -6338,6 +9474,38 @@ function renderDieLine2(modelId, attrs) {
|
|
|
6338
9474
|
renderAs: "group"
|
|
6339
9475
|
}
|
|
6340
9476
|
);
|
|
9477
|
+
case "BECF-C-12101":
|
|
9478
|
+
return /* @__PURE__ */ jsx(
|
|
9479
|
+
DIE_LINE_BECF_C_12101,
|
|
9480
|
+
{
|
|
9481
|
+
attributes: attrs,
|
|
9482
|
+
renderAs: "group"
|
|
9483
|
+
}
|
|
9484
|
+
);
|
|
9485
|
+
case "BECF-C-12109":
|
|
9486
|
+
return /* @__PURE__ */ jsx(
|
|
9487
|
+
DIE_LINE_BECF_C_12109,
|
|
9488
|
+
{
|
|
9489
|
+
attributes: attrs,
|
|
9490
|
+
renderAs: "group"
|
|
9491
|
+
}
|
|
9492
|
+
);
|
|
9493
|
+
case "BECF-B-12101":
|
|
9494
|
+
return /* @__PURE__ */ jsx(
|
|
9495
|
+
DIE_LINE_BECF_B_12101,
|
|
9496
|
+
{
|
|
9497
|
+
attributes: attrs,
|
|
9498
|
+
renderAs: "group"
|
|
9499
|
+
}
|
|
9500
|
+
);
|
|
9501
|
+
case "BECF-B-12109":
|
|
9502
|
+
return /* @__PURE__ */ jsx(
|
|
9503
|
+
DIE_LINE_BECF_B_12109,
|
|
9504
|
+
{
|
|
9505
|
+
attributes: attrs,
|
|
9506
|
+
renderAs: "group"
|
|
9507
|
+
}
|
|
9508
|
+
);
|
|
6341
9509
|
case "BECF-1010A":
|
|
6342
9510
|
default:
|
|
6343
9511
|
return /* @__PURE__ */ jsx(
|
|
@@ -6351,7 +9519,7 @@ function renderDieLine2(modelId, attrs) {
|
|
|
6351
9519
|
})();
|
|
6352
9520
|
}
|
|
6353
9521
|
var PAPER_GAP = 20;
|
|
6354
|
-
var
|
|
9522
|
+
var PX_PER_MM12 = 96 / 25.4;
|
|
6355
9523
|
var RESULT_PANEL_HEIGHT = 55;
|
|
6356
9524
|
var RESULT_GAP = 5;
|
|
6357
9525
|
function getOpposite2(side) {
|
|
@@ -6528,8 +9696,8 @@ var AUTO_LAYOUT = forwardRef(
|
|
|
6528
9696
|
const svg = document.createElementNS(svgNs, "svg");
|
|
6529
9697
|
svg.setAttribute("xmlns", svgNs);
|
|
6530
9698
|
svg.setAttribute("viewBox", `0 0 ${vw} ${vh}`);
|
|
6531
|
-
svg.setAttribute("width", String(Math.round(vw *
|
|
6532
|
-
svg.setAttribute("height", String(Math.round(vh *
|
|
9699
|
+
svg.setAttribute("width", String(Math.round(vw * PX_PER_MM12)));
|
|
9700
|
+
svg.setAttribute("height", String(Math.round(vh * PX_PER_MM12)));
|
|
6533
9701
|
const bg = document.createElementNS(svgNs, "rect");
|
|
6534
9702
|
bg.setAttribute("width", String(vw));
|
|
6535
9703
|
bg.setAttribute("height", String(vh));
|
|
@@ -6562,8 +9730,8 @@ var AUTO_LAYOUT = forwardRef(
|
|
|
6562
9730
|
img.src = url;
|
|
6563
9731
|
});
|
|
6564
9732
|
const canvas = document.createElement("canvas");
|
|
6565
|
-
canvas.width = Math.round(vw *
|
|
6566
|
-
canvas.height = Math.round(vh *
|
|
9733
|
+
canvas.width = Math.round(vw * PX_PER_MM12);
|
|
9734
|
+
canvas.height = Math.round(vh * PX_PER_MM12);
|
|
6567
9735
|
const ctx = canvas.getContext("2d");
|
|
6568
9736
|
ctx.fillStyle = "#ffffff";
|
|
6569
9737
|
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
|
@@ -6587,8 +9755,8 @@ var AUTO_LAYOUT = forwardRef(
|
|
|
6587
9755
|
const svg = document.createElementNS(svgNs, "svg");
|
|
6588
9756
|
svg.setAttribute("xmlns", svgNs);
|
|
6589
9757
|
svg.setAttribute("viewBox", `0 0 ${paperResult.paperWidth} ${paperResult.paperHeight}`);
|
|
6590
|
-
svg.setAttribute("width", String(Math.round(paperResult.paperWidth *
|
|
6591
|
-
svg.setAttribute("height", String(Math.round(paperResult.paperHeight *
|
|
9758
|
+
svg.setAttribute("width", String(Math.round(paperResult.paperWidth * PX_PER_MM12)));
|
|
9759
|
+
svg.setAttribute("height", String(Math.round(paperResult.paperHeight * PX_PER_MM12)));
|
|
6592
9760
|
const bg = document.createElementNS(svgNs, "rect");
|
|
6593
9761
|
bg.setAttribute("width", String(paperResult.paperWidth));
|
|
6594
9762
|
bg.setAttribute("height", String(paperResult.paperHeight));
|
|
@@ -6692,8 +9860,8 @@ var AUTO_LAYOUT = forwardRef(
|
|
|
6692
9860
|
img.src = url;
|
|
6693
9861
|
});
|
|
6694
9862
|
const canvas = document.createElement("canvas");
|
|
6695
|
-
canvas.width = Math.round(paperResult.paperWidth *
|
|
6696
|
-
canvas.height = Math.round(paperResult.paperHeight *
|
|
9863
|
+
canvas.width = Math.round(paperResult.paperWidth * PX_PER_MM12);
|
|
9864
|
+
canvas.height = Math.round(paperResult.paperHeight * PX_PER_MM12);
|
|
6697
9865
|
const ctx = canvas.getContext("2d");
|
|
6698
9866
|
ctx.fillStyle = theme.colorPaperFill;
|
|
6699
9867
|
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
|
@@ -7202,6 +10370,16 @@ var DIE_LINE_LAYOUT = forwardRef(
|
|
|
7202
10370
|
return /* @__PURE__ */ jsx(MODEL_BECF_12101, { ref, ...props });
|
|
7203
10371
|
case "BECF-12109":
|
|
7204
10372
|
return /* @__PURE__ */ jsx(MODEL_BECF_12109, { ref, ...props });
|
|
10373
|
+
case "BECF-C-12101":
|
|
10374
|
+
return /* @__PURE__ */ jsx(MODEL_BECF_C_12101, { ref, ...props });
|
|
10375
|
+
case "BECF-C-12109":
|
|
10376
|
+
return /* @__PURE__ */ jsx(MODEL_BECF_C_12109, { ref, ...props });
|
|
10377
|
+
case "BECF-B-12101":
|
|
10378
|
+
return /* @__PURE__ */ jsx(MODEL_BECF_B_12101, { ref, ...props });
|
|
10379
|
+
case "BECF-B-12109":
|
|
10380
|
+
return /* @__PURE__ */ jsx(MODEL_BECF_B_12109, { ref, ...props });
|
|
10381
|
+
case "BECF-10A0A":
|
|
10382
|
+
return /* @__PURE__ */ jsx(MODEL_BECF_10A0A, { ref, ...props });
|
|
7205
10383
|
default:
|
|
7206
10384
|
return null;
|
|
7207
10385
|
}
|
|
@@ -7254,7 +10432,58 @@ var BECF_12109_DEFAULT_ATTRIBUTES = {
|
|
|
7254
10432
|
glueArea: 13
|
|
7255
10433
|
};
|
|
7256
10434
|
|
|
10435
|
+
// src/statics/bags-pillows/becf-c-12101/DEFAULT_ATTRIBUTES.ts
|
|
10436
|
+
var BECF_C_12101_DEFAULT_ATTRIBUTES = {
|
|
10437
|
+
length: 100,
|
|
10438
|
+
width: 50,
|
|
10439
|
+
height: 150,
|
|
10440
|
+
glueArea: 13
|
|
10441
|
+
};
|
|
10442
|
+
|
|
10443
|
+
// src/statics/bags-pillows/becf-c-12109/DEFAULT_ATTRIBUTES.ts
|
|
10444
|
+
var BECF_C_12109_DEFAULT_ATTRIBUTES = {
|
|
10445
|
+
length: 100,
|
|
10446
|
+
width: 50,
|
|
10447
|
+
height: 150,
|
|
10448
|
+
glueArea: 13
|
|
10449
|
+
};
|
|
10450
|
+
|
|
10451
|
+
// src/statics/bags-pillows/becf-b-12101/DEFAULT_ATTRIBUTES.ts
|
|
10452
|
+
var BECF_B_12101_DEFAULT_ATTRIBUTES = {
|
|
10453
|
+
length: 100,
|
|
10454
|
+
width: 50,
|
|
10455
|
+
height: 150,
|
|
10456
|
+
glueArea: 13
|
|
10457
|
+
};
|
|
10458
|
+
|
|
10459
|
+
// src/statics/bags-pillows/becf-b-12109/DEFAULT_ATTRIBUTES.ts
|
|
10460
|
+
var BECF_B_12109_DEFAULT_ATTRIBUTES = {
|
|
10461
|
+
length: 100,
|
|
10462
|
+
width: 50,
|
|
10463
|
+
height: 150,
|
|
10464
|
+
glueArea: 13
|
|
10465
|
+
};
|
|
10466
|
+
|
|
10467
|
+
// src/statics/snap-lock-boxes/becf-10a0a/DEFAULT_ATTRIBUTES.ts
|
|
10468
|
+
var BECF_10A0A_DEFAULT_ATTRIBUTES = {
|
|
10469
|
+
length: 150,
|
|
10470
|
+
width: 50,
|
|
10471
|
+
height: 150
|
|
10472
|
+
};
|
|
10473
|
+
|
|
7257
10474
|
// src/statics/modelList.ts
|
|
10475
|
+
var MODEL_DEFAULT_ATTRIBUTES = {
|
|
10476
|
+
"BECF-1010A": { ...BECF_1010A_DEFAULT_ATTRIBUTES },
|
|
10477
|
+
"BECF-1040A": { ...BECF_1040A_DEFAULT_ATTRIBUTES },
|
|
10478
|
+
"BECF-1030A": { ...BECF_1030A_DEFAULT_ATTRIBUTES },
|
|
10479
|
+
"BECF-12101": { ...BECF_12101_DEFAULT_ATTRIBUTES },
|
|
10480
|
+
"BECF-12109": { ...BECF_12109_DEFAULT_ATTRIBUTES },
|
|
10481
|
+
"BECF-B-12101": { ...BECF_B_12101_DEFAULT_ATTRIBUTES },
|
|
10482
|
+
"BECF-B-12109": { ...BECF_B_12109_DEFAULT_ATTRIBUTES },
|
|
10483
|
+
"BECF-C-12101": { ...BECF_C_12101_DEFAULT_ATTRIBUTES },
|
|
10484
|
+
"BECF-C-12109": { ...BECF_C_12109_DEFAULT_ATTRIBUTES },
|
|
10485
|
+
"BECF-10A0A": { ...BECF_10A0A_DEFAULT_ATTRIBUTES }
|
|
10486
|
+
};
|
|
7258
10487
|
var modelList = [
|
|
7259
10488
|
{
|
|
7260
10489
|
id: "BECF-1010A",
|
|
@@ -7293,10 +10522,45 @@ var modelList = [
|
|
|
7293
10522
|
},
|
|
7294
10523
|
{
|
|
7295
10524
|
id: "BECF-12109",
|
|
7296
|
-
nameEN: "SHOPPING BAGS TYPE
|
|
7297
|
-
nameTH: "\u0E16\u0E38\u0E07\u0E23\u0E49\u0E2D\u0E22\u0E40\u0E0A\u0E37\u0E2D\u0E01\u0E40\u0E1B\u0E35\u0E22 \u0E21\u0E31\u0E14\u0E1B\u0E21
|
|
10525
|
+
nameEN: "SHOPPING BAGS TYPE A1",
|
|
10526
|
+
nameTH: "\u0E16\u0E38\u0E07\u0E23\u0E49\u0E2D\u0E22\u0E40\u0E0A\u0E37\u0E2D\u0E01\u0E40\u0E1B\u0E35\u0E22 \u0E21\u0E31\u0E14\u0E1B\u0E21 A1",
|
|
7298
10527
|
dimension: ["DIE_LINE"],
|
|
7299
10528
|
attributes: { ...BECF_12109_DEFAULT_ATTRIBUTES }
|
|
10529
|
+
},
|
|
10530
|
+
{
|
|
10531
|
+
id: "BECF-B-12101",
|
|
10532
|
+
nameEN: "SHOPPING BAGS TYPE B",
|
|
10533
|
+
nameTH: "\u0E16\u0E38\u0E07\u0E2B\u0E39\u0E40\u0E01\u0E25\u0E35\u0E22\u0E27\u0E01\u0E23\u0E30\u0E14\u0E32\u0E29 B",
|
|
10534
|
+
dimension: ["DIE_LINE"],
|
|
10535
|
+
attributes: { ...BECF_B_12101_DEFAULT_ATTRIBUTES }
|
|
10536
|
+
},
|
|
10537
|
+
{
|
|
10538
|
+
id: "BECF-B-12109",
|
|
10539
|
+
nameEN: "SHOPPING BAGS TYPE B1",
|
|
10540
|
+
nameTH: "\u0E16\u0E38\u0E07\u0E2B\u0E39\u0E40\u0E01\u0E25\u0E35\u0E22\u0E27\u0E01\u0E23\u0E30\u0E14\u0E32\u0E29 B1",
|
|
10541
|
+
dimension: ["DIE_LINE"],
|
|
10542
|
+
attributes: { ...BECF_B_12109_DEFAULT_ATTRIBUTES }
|
|
10543
|
+
},
|
|
10544
|
+
{
|
|
10545
|
+
id: "BECF-C-12101",
|
|
10546
|
+
nameEN: "SHOPPING BAGS TYPE C",
|
|
10547
|
+
nameTH: "\u0E16\u0E38\u0E07\u0E2B\u0E39\u0E23\u0E34\u0E1A\u0E1A\u0E34\u0E49\u0E19 C",
|
|
10548
|
+
dimension: ["DIE_LINE"],
|
|
10549
|
+
attributes: { ...BECF_C_12101_DEFAULT_ATTRIBUTES }
|
|
10550
|
+
},
|
|
10551
|
+
{
|
|
10552
|
+
id: "BECF-C-12109",
|
|
10553
|
+
nameEN: "SHOPPING BAGS TYPE C1",
|
|
10554
|
+
nameTH: "\u0E16\u0E38\u0E07\u0E2B\u0E39\u0E23\u0E34\u0E1A\u0E1A\u0E34\u0E49\u0E19 C1",
|
|
10555
|
+
dimension: ["DIE_LINE"],
|
|
10556
|
+
attributes: { ...BECF_C_12109_DEFAULT_ATTRIBUTES }
|
|
10557
|
+
},
|
|
10558
|
+
{
|
|
10559
|
+
id: "BECF-10A0A",
|
|
10560
|
+
nameEN: "SNAP LOCK BOTTOM BOX",
|
|
10561
|
+
nameTH: "\u0E01\u0E25\u0E48\u0E2D\u0E07\u0E01\u0E49\u0E19\u0E25\u0E47\u0E2D\u0E04",
|
|
10562
|
+
dimension: ["DIE_LINE"],
|
|
10563
|
+
attributes: { ...BECF_10A0A_DEFAULT_ATTRIBUTES }
|
|
7300
10564
|
}
|
|
7301
10565
|
];
|
|
7302
10566
|
|
|
@@ -7309,6 +10573,6 @@ var BECF_11D01_DEFAULT_ATTRIBUTES = {
|
|
|
7309
10573
|
glueArea: 13
|
|
7310
10574
|
};
|
|
7311
10575
|
|
|
7312
|
-
export { AUTO_LAYOUT, AUTO_LAYOUT_THEME_CONFIG, BECF_1010A_DEFAULT_ATTRIBUTES, BECF_1030A_DEFAULT_ATTRIBUTES, BECF_1040A_DEFAULT_ATTRIBUTES, BECF_11D01_DEFAULT_ATTRIBUTES, BECF_12101_DEFAULT_ATTRIBUTES, BECF_12109_DEFAULT_ATTRIBUTES, Colorbar, DIE_LINE_LAYOUT, Gripper, MODEL_BECF_1010A, MODEL_BECF_1030A, MODEL_BECF_1040A, MODEL_BECF_11D01, MODEL_BECF_12101, MODEL_BECF_12109, MODEL_THEME_CONFIG, appendColorbarToSvg, appendGripperToSvg, calculateAutoLayout, configurePackaging, modelList };
|
|
10576
|
+
export { AUTO_LAYOUT, AUTO_LAYOUT_THEME_CONFIG, BECF_1010A_DEFAULT_ATTRIBUTES, BECF_1030A_DEFAULT_ATTRIBUTES, BECF_1040A_DEFAULT_ATTRIBUTES, BECF_10A0A_DEFAULT_ATTRIBUTES, BECF_11D01_DEFAULT_ATTRIBUTES, BECF_12101_DEFAULT_ATTRIBUTES, BECF_12109_DEFAULT_ATTRIBUTES, BECF_B_12101_DEFAULT_ATTRIBUTES, BECF_B_12109_DEFAULT_ATTRIBUTES, BECF_C_12101_DEFAULT_ATTRIBUTES, BECF_C_12109_DEFAULT_ATTRIBUTES, Colorbar, DIE_LINE_LAYOUT, Gripper, MODEL_BECF_1010A, MODEL_BECF_1030A, MODEL_BECF_1040A, MODEL_BECF_10A0A, MODEL_BECF_11D01, MODEL_BECF_12101, MODEL_BECF_12109, MODEL_BECF_B_12101, MODEL_BECF_B_12109, MODEL_BECF_C_12101, MODEL_BECF_C_12109, MODEL_DEFAULT_ATTRIBUTES, MODEL_THEME_CONFIG, appendColorbarToSvg, appendGripperToSvg, calculateAutoLayout, configurePackaging, modelList };
|
|
7313
10577
|
//# sourceMappingURL=index.mjs.map
|
|
7314
10578
|
//# sourceMappingURL=index.mjs.map
|