@lucablockltd/ultimate-packaging 1.4.0 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +16 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +1997 -280
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1997 -280
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -3,6 +3,45 @@ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
|
3
3
|
|
|
4
4
|
// src/components/model/tuck-end-boxes/becf-1010a/index.tsx
|
|
5
5
|
|
|
6
|
+
// src/utils/debugDieline.ts
|
|
7
|
+
var DEBUG_PALETTE = [
|
|
8
|
+
"#e74c3c",
|
|
9
|
+
"#3498db",
|
|
10
|
+
"#2ecc71",
|
|
11
|
+
"#9b59b6",
|
|
12
|
+
"#f39c12",
|
|
13
|
+
"#1abc9c",
|
|
14
|
+
"#e67e22",
|
|
15
|
+
"#c0392b",
|
|
16
|
+
"#2980b9",
|
|
17
|
+
"#8e44ad",
|
|
18
|
+
"#16a085",
|
|
19
|
+
"#d35400",
|
|
20
|
+
"#27ae60",
|
|
21
|
+
"#2c3e50",
|
|
22
|
+
"#f1c40f"
|
|
23
|
+
];
|
|
24
|
+
function parseSvgPoints(d) {
|
|
25
|
+
const points = [];
|
|
26
|
+
const regex = /([MLA])\s*([-\d.]+)\s+([-\d.]+)(?:\s+([-\d.]+)\s+([-\d.]+)\s+([-\d.]+)\s+([-\d.]+)\s+([-\d.]+))?/gi;
|
|
27
|
+
let match;
|
|
28
|
+
while ((match = regex.exec(d)) !== null) {
|
|
29
|
+
const cmd = match[1].toUpperCase();
|
|
30
|
+
if (cmd === "M" || cmd === "L") {
|
|
31
|
+
points.push({ x: parseFloat(match[2]), y: parseFloat(match[3]) });
|
|
32
|
+
} else if (cmd === "A") {
|
|
33
|
+
const arcRegex = /A\s*[-\d.]+\s+[-\d.]+\s+[-\d.]+\s+[-\d.]+\s+[-\d.]+\s+([-\d.]+)\s+([-\d.]+)/i;
|
|
34
|
+
const arcMatch = arcRegex.exec(d.slice(match.index));
|
|
35
|
+
if (arcMatch) {
|
|
36
|
+
points.push({ x: parseFloat(arcMatch[1]), y: parseFloat(arcMatch[2]) });
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return points.filter(
|
|
41
|
+
(p, i, arr) => i === 0 || p.x !== arr[i - 1].x || p.y !== arr[i - 1].y
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
6
45
|
// src/components/dieline/tuck-end-boxes/becf-1010a/generate.ts
|
|
7
46
|
var MT = 0.5;
|
|
8
47
|
var ARC_R = 5;
|
|
@@ -152,6 +191,47 @@ function bottomDustFlaps(xSide1, xFront, xSide2, xEnd, yBody2, dustFlap, dfCorne
|
|
|
152
191
|
dustFlapPath(xSide2, xEnd, yBody2, 1, dustFlap, dfCorner, dfInset, dfVertical, false, false)
|
|
153
192
|
];
|
|
154
193
|
}
|
|
194
|
+
function generateBecf1010aDebugSections(attr) {
|
|
195
|
+
const { length, width, height, glueArea, dustFlap, tuckFlap } = attr;
|
|
196
|
+
const glueTaper = glueArea * GLUE_TAPER_RATIO;
|
|
197
|
+
const tabWidth = 8;
|
|
198
|
+
const tabStep = 1;
|
|
199
|
+
const dfInset = Math.min(dustFlap / 3, width * 0.2);
|
|
200
|
+
const dfCorner = Math.min(dustFlap * 0.2, dfInset * 0.6);
|
|
201
|
+
const dfVertical = Math.min(dustFlap * 0.4, dustFlap - dfCorner);
|
|
202
|
+
const xRear = glueArea;
|
|
203
|
+
const xSide1 = glueArea + length;
|
|
204
|
+
const xFront = glueArea + length + width;
|
|
205
|
+
const xSide2 = glueArea + length + width + length;
|
|
206
|
+
const xEnd = glueArea + 2 * length + 2 * width;
|
|
207
|
+
const yTop = 0;
|
|
208
|
+
const yFold1 = tuckFlap;
|
|
209
|
+
const yBody1 = tuckFlap + width;
|
|
210
|
+
const yBody2 = tuckFlap + width + height;
|
|
211
|
+
const yFold2 = tuckFlap + width + height + width;
|
|
212
|
+
const yBot = tuckFlap + 2 * width + height + tuckFlap;
|
|
213
|
+
const totalWidth = xEnd;
|
|
214
|
+
const totalHeight = yBot;
|
|
215
|
+
const crease = [];
|
|
216
|
+
crease.push(
|
|
217
|
+
...verticalCreases(xRear, xSide1, xFront, xSide2, yBody1, yBody2),
|
|
218
|
+
...horizontalCreases(xRear, xSide1, xFront, xSide2, xEnd, yBody1, yBody2),
|
|
219
|
+
tuckFoldCrease(xRear, xSide1, tabWidth, yFold1),
|
|
220
|
+
tuckFoldCrease(xFront, xSide2, tabWidth, yFold2)
|
|
221
|
+
);
|
|
222
|
+
let ci = 0;
|
|
223
|
+
const sections = [
|
|
224
|
+
{ name: "Right Edge", color: DEBUG_PALETTE[ci++ % DEBUG_PALETTE.length], paths: [line(xEnd, yBody1, xEnd, yBody2)] },
|
|
225
|
+
{ name: "Glue Area", color: DEBUG_PALETTE[ci++ % DEBUG_PALETTE.length], paths: [glueAreaPath(xRear, yBody1, yBody2, glueTaper, glueArea)] },
|
|
226
|
+
{ name: "Rear Bottom Edge", color: DEBUG_PALETTE[ci++ % DEBUG_PALETTE.length], paths: [line(xSide1, yBody2, xRear, yBody2)] },
|
|
227
|
+
{ name: "Top Tuck", color: DEBUG_PALETTE[ci++ % DEBUG_PALETTE.length], paths: [...topTuckStructure(xRear, xSide1, yBody1, yFold1, yTop, tabWidth, tabStep), ...topTuckTip(xRear, xSide1, yFold1, yTop, tabStep)] },
|
|
228
|
+
{ name: "Bottom Tuck", color: DEBUG_PALETTE[ci++ % DEBUG_PALETTE.length], paths: [...bottomTuckStructure(xFront, xSide2, yBody2, yFold2, yBot, tabWidth, tabStep), ...bottomTuckTip(xFront, xSide2, yFold2, yBot, tabStep)] },
|
|
229
|
+
{ name: "Front Top Edge", color: DEBUG_PALETTE[ci++ % DEBUG_PALETTE.length], paths: [line(xFront, yBody1, xSide2, yBody1), line(xFront - MT, yBody1, xFront, yBody1), line(xSide2, yBody1, xSide2 + MT, yBody1)] },
|
|
230
|
+
{ name: "Top Dust Flaps", color: DEBUG_PALETTE[ci++ % DEBUG_PALETTE.length], paths: topDustFlaps(xSide1, xFront, xSide2, xEnd, yBody1, dustFlap, dfCorner, dfInset, dfVertical) },
|
|
231
|
+
{ name: "Bottom Dust Flaps", color: DEBUG_PALETTE[ci++ % DEBUG_PALETTE.length], paths: bottomDustFlaps(xSide1, xFront, xSide2, xEnd, yBody2, dustFlap, dfCorner, dfInset, dfVertical) }
|
|
232
|
+
];
|
|
233
|
+
return { sections, crease, viewBox: { width: totalWidth, height: totalHeight } };
|
|
234
|
+
}
|
|
155
235
|
function generateOuterContour(attr) {
|
|
156
236
|
const { length, width, height, glueArea, dustFlap, tuckFlap } = attr;
|
|
157
237
|
const glueTaper = glueArea * GLUE_TAPER_RATIO;
|
|
@@ -1006,6 +1086,276 @@ async function exportDimensionPdf(params) {
|
|
|
1006
1086
|
const arrayBuffer = doc.output("arraybuffer");
|
|
1007
1087
|
return new Blob([arrayBuffer], { type: "application/pdf" });
|
|
1008
1088
|
}
|
|
1089
|
+
|
|
1090
|
+
// src/utils/readyToPrint.ts
|
|
1091
|
+
var DIM_PADDING2 = 15;
|
|
1092
|
+
var FOOTER_H2 = 40;
|
|
1093
|
+
var MARGIN2 = 5;
|
|
1094
|
+
function camelToCapitalize2(str) {
|
|
1095
|
+
return str.replace(/([A-Z])/g, " $1").replace(/^./, (s) => s.toUpperCase());
|
|
1096
|
+
}
|
|
1097
|
+
function hexToRgb2(hex) {
|
|
1098
|
+
return {
|
|
1099
|
+
r: parseInt(hex.slice(1, 3), 16),
|
|
1100
|
+
g: parseInt(hex.slice(3, 5), 16),
|
|
1101
|
+
b: parseInt(hex.slice(5, 7), 16)
|
|
1102
|
+
};
|
|
1103
|
+
}
|
|
1104
|
+
function drawPath(doc, d, ox, oy) {
|
|
1105
|
+
const commands = parseSvgPath(d);
|
|
1106
|
+
let startX = 0;
|
|
1107
|
+
let startY = 0;
|
|
1108
|
+
let curX = 0;
|
|
1109
|
+
let curY = 0;
|
|
1110
|
+
for (const cmd of commands) {
|
|
1111
|
+
switch (cmd.type) {
|
|
1112
|
+
case "M":
|
|
1113
|
+
curX = cmd.x + ox;
|
|
1114
|
+
curY = cmd.y + oy;
|
|
1115
|
+
startX = curX;
|
|
1116
|
+
startY = curY;
|
|
1117
|
+
break;
|
|
1118
|
+
case "L": {
|
|
1119
|
+
const nx = cmd.x + ox;
|
|
1120
|
+
const ny = cmd.y + oy;
|
|
1121
|
+
doc.line(curX, curY, nx, ny);
|
|
1122
|
+
curX = nx;
|
|
1123
|
+
curY = ny;
|
|
1124
|
+
break;
|
|
1125
|
+
}
|
|
1126
|
+
case "C": {
|
|
1127
|
+
const x0 = curX;
|
|
1128
|
+
const y0 = curY;
|
|
1129
|
+
const x1 = cmd.x1 + ox;
|
|
1130
|
+
const y1 = cmd.y1 + oy;
|
|
1131
|
+
const x2 = cmd.x2 + ox;
|
|
1132
|
+
const y2 = cmd.y2 + oy;
|
|
1133
|
+
const x3 = cmd.x + ox;
|
|
1134
|
+
const y3 = cmd.y + oy;
|
|
1135
|
+
const steps = 20;
|
|
1136
|
+
let prevX = x0;
|
|
1137
|
+
let prevY = y0;
|
|
1138
|
+
for (let si = 1; si <= steps; si++) {
|
|
1139
|
+
const t = si / steps;
|
|
1140
|
+
const mt = 1 - t;
|
|
1141
|
+
const nx = mt * mt * mt * x0 + 3 * mt * mt * t * x1 + 3 * mt * t * t * x2 + t * t * t * x3;
|
|
1142
|
+
const ny = mt * mt * mt * y0 + 3 * mt * mt * t * y1 + 3 * mt * t * t * y2 + t * t * t * y3;
|
|
1143
|
+
doc.line(prevX, prevY, nx, ny);
|
|
1144
|
+
prevX = nx;
|
|
1145
|
+
prevY = ny;
|
|
1146
|
+
}
|
|
1147
|
+
curX = x3;
|
|
1148
|
+
curY = y3;
|
|
1149
|
+
break;
|
|
1150
|
+
}
|
|
1151
|
+
case "Q": {
|
|
1152
|
+
const qx0 = curX;
|
|
1153
|
+
const qy0 = curY;
|
|
1154
|
+
const qx1 = cmd.x1 + ox;
|
|
1155
|
+
const qy1 = cmd.y1 + oy;
|
|
1156
|
+
const qx2 = cmd.x + ox;
|
|
1157
|
+
const qy2 = cmd.y + oy;
|
|
1158
|
+
const qSteps = 16;
|
|
1159
|
+
let qPrevX = qx0;
|
|
1160
|
+
let qPrevY = qy0;
|
|
1161
|
+
for (let si = 1; si <= qSteps; si++) {
|
|
1162
|
+
const t = si / qSteps;
|
|
1163
|
+
const mt = 1 - t;
|
|
1164
|
+
const nx = mt * mt * qx0 + 2 * mt * t * qx1 + t * t * qx2;
|
|
1165
|
+
const ny = mt * mt * qy0 + 2 * mt * t * qy1 + t * t * qy2;
|
|
1166
|
+
doc.line(qPrevX, qPrevY, nx, ny);
|
|
1167
|
+
qPrevX = nx;
|
|
1168
|
+
qPrevY = ny;
|
|
1169
|
+
}
|
|
1170
|
+
curX = qx2;
|
|
1171
|
+
curY = qy2;
|
|
1172
|
+
break;
|
|
1173
|
+
}
|
|
1174
|
+
case "Z":
|
|
1175
|
+
doc.line(curX, curY, startX, startY);
|
|
1176
|
+
curX = startX;
|
|
1177
|
+
curY = startY;
|
|
1178
|
+
break;
|
|
1179
|
+
}
|
|
1180
|
+
}
|
|
1181
|
+
}
|
|
1182
|
+
async function readyToPrintPdf(params) {
|
|
1183
|
+
const { modelId, dieline, dimensions, attributes, unit, factor, theme } = params;
|
|
1184
|
+
const { width: vw, height: vh } = dieline.viewBox;
|
|
1185
|
+
const contentW = vw + DIM_PADDING2 * 2;
|
|
1186
|
+
const contentH = vh + DIM_PADDING2 * 2;
|
|
1187
|
+
const pageW = contentW + MARGIN2 * 2;
|
|
1188
|
+
const pageH = contentH + MARGIN2 * 2 + FOOTER_H2;
|
|
1189
|
+
const { jsPDF } = await import('jspdf');
|
|
1190
|
+
const doc = new jsPDF({
|
|
1191
|
+
orientation: pageW > pageH ? "landscape" : "portrait",
|
|
1192
|
+
unit: "mm",
|
|
1193
|
+
format: [pageW, pageH]
|
|
1194
|
+
});
|
|
1195
|
+
const ox = MARGIN2 + DIM_PADDING2;
|
|
1196
|
+
const oy = MARGIN2 + DIM_PADDING2;
|
|
1197
|
+
const creaseRgb = hexToRgb2(theme.colorFoldLine);
|
|
1198
|
+
doc.setDrawColor(creaseRgb.r, creaseRgb.g, creaseRgb.b);
|
|
1199
|
+
doc.setLineWidth(0.3);
|
|
1200
|
+
for (const d of dieline.crease) {
|
|
1201
|
+
drawPath(doc, d, ox, oy);
|
|
1202
|
+
}
|
|
1203
|
+
const cutRgb = hexToRgb2(theme.colorDieLine);
|
|
1204
|
+
doc.setDrawColor(cutRgb.r, cutRgb.g, cutRgb.b);
|
|
1205
|
+
doc.setLineWidth(0.3);
|
|
1206
|
+
for (const d of dieline.cut) {
|
|
1207
|
+
drawPath(doc, d, ox, oy);
|
|
1208
|
+
}
|
|
1209
|
+
const tick = 1.5;
|
|
1210
|
+
for (const dim of dimensions) {
|
|
1211
|
+
if (dim.orientation === "horizontal") {
|
|
1212
|
+
const y = dim.y1 + dim.offset + oy;
|
|
1213
|
+
const x1 = dim.x1 + ox;
|
|
1214
|
+
const x2 = dim.x2 + ox;
|
|
1215
|
+
doc.setDrawColor(0, 0, 0);
|
|
1216
|
+
doc.setLineWidth(0.2);
|
|
1217
|
+
doc.line(x1, y, x2, y);
|
|
1218
|
+
doc.setLineWidth(0.3);
|
|
1219
|
+
doc.line(x1, y - tick, x1, y + tick);
|
|
1220
|
+
doc.line(x2, y - tick, x2, y + tick);
|
|
1221
|
+
const midX = (x1 + x2) / 2;
|
|
1222
|
+
doc.setFontSize(3.5 * 2.83);
|
|
1223
|
+
doc.setTextColor(0, 0, 0);
|
|
1224
|
+
doc.text(dim.label, midX, y - 1.5, { align: "center" });
|
|
1225
|
+
} else {
|
|
1226
|
+
const x = dim.x1 + dim.offset + ox;
|
|
1227
|
+
const y1 = dim.y1 + oy;
|
|
1228
|
+
const y2 = dim.y2 + oy;
|
|
1229
|
+
doc.setDrawColor(0, 0, 0);
|
|
1230
|
+
doc.setLineWidth(0.2);
|
|
1231
|
+
doc.line(x, y1, x, y2);
|
|
1232
|
+
doc.setLineWidth(0.3);
|
|
1233
|
+
doc.line(x - tick, y1, x + tick, y1);
|
|
1234
|
+
doc.line(x - tick, y2, x + tick, y2);
|
|
1235
|
+
const midY = (y1 + y2) / 2;
|
|
1236
|
+
doc.setFontSize(3.5 * 2.83);
|
|
1237
|
+
doc.setTextColor(0, 0, 0);
|
|
1238
|
+
const textX = x - 1.5;
|
|
1239
|
+
const tw = doc.getTextWidth(dim.label);
|
|
1240
|
+
doc.text(dim.label, textX, midY + tw / 2, { angle: 90 });
|
|
1241
|
+
}
|
|
1242
|
+
}
|
|
1243
|
+
const footerY = pageH - FOOTER_H2;
|
|
1244
|
+
const halfW = (pageW - MARGIN2 * 2) / 2;
|
|
1245
|
+
const centerX = MARGIN2 + halfW;
|
|
1246
|
+
doc.setDrawColor(180, 180, 180);
|
|
1247
|
+
doc.setLineWidth(0.3);
|
|
1248
|
+
doc.line(MARGIN2, footerY, pageW - MARGIN2, footerY);
|
|
1249
|
+
doc.line(centerX, footerY, centerX, pageH - MARGIN2);
|
|
1250
|
+
doc.setTextColor(0, 0, 0);
|
|
1251
|
+
doc.setFontSize(9);
|
|
1252
|
+
doc.text("Luca Block Co.,Ltd.", MARGIN2 + 3, footerY + 6);
|
|
1253
|
+
doc.text(
|
|
1254
|
+
`Cartons-Tuck end boxes-${modelId}`,
|
|
1255
|
+
pageW - MARGIN2 - 3,
|
|
1256
|
+
footerY + 6,
|
|
1257
|
+
{ align: "right" }
|
|
1258
|
+
);
|
|
1259
|
+
const attrEntries = Object.entries(attributes);
|
|
1260
|
+
const col1X = MARGIN2 + 3;
|
|
1261
|
+
const col2X = MARGIN2 + 3 + halfW / 2;
|
|
1262
|
+
const attrStartY = footerY + 14;
|
|
1263
|
+
const lineH = 5;
|
|
1264
|
+
doc.setFontSize(7);
|
|
1265
|
+
const half = Math.ceil(attrEntries.length / 2);
|
|
1266
|
+
for (let i = 0; i < half; i++) {
|
|
1267
|
+
const [key, val] = attrEntries[i];
|
|
1268
|
+
doc.text(
|
|
1269
|
+
`${camelToCapitalize2(key)}: ${(val * factor).toFixed(1)} ${unit}`,
|
|
1270
|
+
col1X,
|
|
1271
|
+
attrStartY + i * lineH
|
|
1272
|
+
);
|
|
1273
|
+
const j = i + half;
|
|
1274
|
+
if (j < attrEntries.length) {
|
|
1275
|
+
const [key2, val2] = attrEntries[j];
|
|
1276
|
+
doc.text(
|
|
1277
|
+
`${camelToCapitalize2(key2)}: ${(val2 * factor).toFixed(1)} ${unit}`,
|
|
1278
|
+
col2X,
|
|
1279
|
+
attrStartY + i * lineH
|
|
1280
|
+
);
|
|
1281
|
+
}
|
|
1282
|
+
}
|
|
1283
|
+
const arrayBuffer = doc.output("arraybuffer");
|
|
1284
|
+
return new Blob([arrayBuffer], { type: "application/pdf" });
|
|
1285
|
+
}
|
|
1286
|
+
function DebugOverlay({ data, fontSize }) {
|
|
1287
|
+
const ptR = fontSize * 0.3;
|
|
1288
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1289
|
+
/* @__PURE__ */ jsx("g", { id: "debug-crease", children: data.crease.map((d, i) => /* @__PURE__ */ jsx(
|
|
1290
|
+
"path",
|
|
1291
|
+
{
|
|
1292
|
+
d,
|
|
1293
|
+
fill: "none",
|
|
1294
|
+
stroke: "#aaa",
|
|
1295
|
+
strokeWidth: 0.3,
|
|
1296
|
+
strokeDasharray: "2,1"
|
|
1297
|
+
},
|
|
1298
|
+
`dc-${i}`
|
|
1299
|
+
)) }),
|
|
1300
|
+
data.sections.map((section, si) => {
|
|
1301
|
+
let pointCounter = 0;
|
|
1302
|
+
return /* @__PURE__ */ jsxs("g", { id: `debug-${section.name}`, children: [
|
|
1303
|
+
section.paths.map((d, pi) => {
|
|
1304
|
+
const pts = parseSvgPoints(d);
|
|
1305
|
+
const startIdx = pointCounter;
|
|
1306
|
+
pointCounter += pts.length;
|
|
1307
|
+
return /* @__PURE__ */ jsxs("g", { children: [
|
|
1308
|
+
/* @__PURE__ */ jsx(
|
|
1309
|
+
"path",
|
|
1310
|
+
{
|
|
1311
|
+
d,
|
|
1312
|
+
fill: "none",
|
|
1313
|
+
stroke: section.color,
|
|
1314
|
+
strokeWidth: 1
|
|
1315
|
+
}
|
|
1316
|
+
),
|
|
1317
|
+
pts.map((p, idx) => /* @__PURE__ */ jsxs("g", { children: [
|
|
1318
|
+
/* @__PURE__ */ jsx("circle", { cx: p.x, cy: p.y, r: ptR, fill: section.color }),
|
|
1319
|
+
/* @__PURE__ */ jsx(
|
|
1320
|
+
"text",
|
|
1321
|
+
{
|
|
1322
|
+
x: p.x + ptR + 0.5,
|
|
1323
|
+
y: p.y - ptR,
|
|
1324
|
+
fontSize: fontSize * 0.6,
|
|
1325
|
+
fontFamily: "monospace",
|
|
1326
|
+
fontWeight: "bold",
|
|
1327
|
+
fill: section.color,
|
|
1328
|
+
children: startIdx + idx + 1
|
|
1329
|
+
}
|
|
1330
|
+
)
|
|
1331
|
+
] }, `pt-${si}-${pi}-${idx}`))
|
|
1332
|
+
] }, `dp-${si}-${pi}`);
|
|
1333
|
+
}),
|
|
1334
|
+
(() => {
|
|
1335
|
+
const allPts = section.paths.flatMap(parseSvgPoints);
|
|
1336
|
+
if (allPts.length === 0) return null;
|
|
1337
|
+
const cx = allPts.reduce((s, p) => s + p.x, 0) / allPts.length;
|
|
1338
|
+
const cy = allPts.reduce((s, p) => s + p.y, 0) / allPts.length;
|
|
1339
|
+
return /* @__PURE__ */ jsx(
|
|
1340
|
+
"text",
|
|
1341
|
+
{
|
|
1342
|
+
x: cx,
|
|
1343
|
+
y: cy,
|
|
1344
|
+
textAnchor: "middle",
|
|
1345
|
+
dominantBaseline: "central",
|
|
1346
|
+
fontSize,
|
|
1347
|
+
fontFamily: "sans-serif",
|
|
1348
|
+
fontWeight: "bold",
|
|
1349
|
+
fill: section.color,
|
|
1350
|
+
opacity: 0.8,
|
|
1351
|
+
children: section.name
|
|
1352
|
+
}
|
|
1353
|
+
);
|
|
1354
|
+
})()
|
|
1355
|
+
] }, `ds-${si}`);
|
|
1356
|
+
})
|
|
1357
|
+
] });
|
|
1358
|
+
}
|
|
1009
1359
|
var MODEL_ID = "BECF-1010A";
|
|
1010
1360
|
var UNIT_FACTOR = {
|
|
1011
1361
|
mm: 1,
|
|
@@ -1064,7 +1414,8 @@ var DIE_LINE_BECF_1010A = forwardRef(
|
|
|
1064
1414
|
attributes,
|
|
1065
1415
|
unit = "mm",
|
|
1066
1416
|
isShowDimensions = false,
|
|
1067
|
-
renderAs = "svg"
|
|
1417
|
+
renderAs = "svg",
|
|
1418
|
+
debug = false
|
|
1068
1419
|
}, ref) => {
|
|
1069
1420
|
const theme = useMemo(
|
|
1070
1421
|
() => getModelTheme(),
|
|
@@ -1147,16 +1498,33 @@ var DIE_LINE_BECF_1010A = forwardRef(
|
|
|
1147
1498
|
factor,
|
|
1148
1499
|
theme
|
|
1149
1500
|
});
|
|
1501
|
+
},
|
|
1502
|
+
readyToPrint: async () => {
|
|
1503
|
+
const dimData = generateDimensions(attributes, unit);
|
|
1504
|
+
return readyToPrintPdf({
|
|
1505
|
+
modelId: MODEL_ID,
|
|
1506
|
+
dieline,
|
|
1507
|
+
dimensions: dimData,
|
|
1508
|
+
attributes,
|
|
1509
|
+
unit,
|
|
1510
|
+
factor,
|
|
1511
|
+
theme
|
|
1512
|
+
});
|
|
1150
1513
|
}
|
|
1151
1514
|
}),
|
|
1152
1515
|
[attributes, dieline, factor, unit, serializeSvg, theme]
|
|
1153
1516
|
);
|
|
1517
|
+
const debugData = useMemo(
|
|
1518
|
+
() => debug ? generateBecf1010aDebugSections(attributes) : null,
|
|
1519
|
+
[attributes, debug]
|
|
1520
|
+
);
|
|
1154
1521
|
const padding = isShowDimensions ? 15 : 0;
|
|
1155
1522
|
const vbX = -padding;
|
|
1156
1523
|
const vbY = -padding;
|
|
1157
1524
|
const vbW = dieline.viewBox.width + padding * 2;
|
|
1158
1525
|
const vbH = dieline.viewBox.height + padding * 2;
|
|
1159
|
-
const
|
|
1526
|
+
const debugFontSize = Math.max(3, dieline.viewBox.width / 80);
|
|
1527
|
+
const svgChildren = debug && debugData ? /* @__PURE__ */ jsx(DebugOverlay, { data: debugData, fontSize: debugFontSize }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1160
1528
|
/* @__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}`)) }),
|
|
1161
1529
|
/* @__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}`)) }),
|
|
1162
1530
|
isShowDimensions && /* @__PURE__ */ jsx("g", { id: "dimensions", children: dimensions.map((d, i) => renderDimension(d, i, getFontDimensionSize())) })
|
|
@@ -1242,6 +1610,7 @@ var CANVAS_BECF_1010A = forwardRef(
|
|
|
1242
1610
|
});
|
|
1243
1611
|
},
|
|
1244
1612
|
exportDimension: () => dieLineRef.current.exportDimension(),
|
|
1613
|
+
readyToPrint: () => dieLineRef.current.readyToPrint(),
|
|
1245
1614
|
resetView: () => canvasRef.current?.resetView(),
|
|
1246
1615
|
fitView: () => canvasRef.current?.fitView()
|
|
1247
1616
|
}), [serializeCanvasSvg, dieline.viewBox.width, dieline.viewBox.height]);
|
|
@@ -1417,6 +1786,45 @@ function bottomDustFlaps2(xSide1, xFront, xSide2, xEnd, yBody2, dustFlap, dfCorn
|
|
|
1417
1786
|
dustFlapPath2(xSide2, xEnd, yBody2, 1, dustFlap, dfCorner, dfInset, dfVertical, true, false)
|
|
1418
1787
|
];
|
|
1419
1788
|
}
|
|
1789
|
+
function generateBecf1030aDebugSections(attr) {
|
|
1790
|
+
const { length, width, height, glueArea, dustFlap, tuckFlap } = attr;
|
|
1791
|
+
const glueTaper = glueArea * GLUE_TAPER_RATIO2;
|
|
1792
|
+
const tabWidth = 9;
|
|
1793
|
+
const tabStep = 1;
|
|
1794
|
+
const dfInset = Math.min(dustFlap * 0.2, width * 0.2);
|
|
1795
|
+
const dfCorner = Math.min(dustFlap * 0.12, dfInset * 0.6);
|
|
1796
|
+
const dfVertical = Math.min(dustFlap * 0.28, dustFlap - dfCorner);
|
|
1797
|
+
const xRear = glueArea;
|
|
1798
|
+
const xSide1 = glueArea + length;
|
|
1799
|
+
const xFront = glueArea + length + width;
|
|
1800
|
+
const xSide2 = glueArea + length + width + length;
|
|
1801
|
+
const xEnd = glueArea + 2 * length + 2 * width;
|
|
1802
|
+
const yTop = 0;
|
|
1803
|
+
const yFold1 = tuckFlap;
|
|
1804
|
+
const yBody1 = tuckFlap + width;
|
|
1805
|
+
const yBody2 = tuckFlap + width + height;
|
|
1806
|
+
const yFold2 = tuckFlap + width + height + width;
|
|
1807
|
+
const yBot = tuckFlap + 2 * width + height + tuckFlap;
|
|
1808
|
+
const totalWidth = xEnd;
|
|
1809
|
+
const totalHeight = yBot;
|
|
1810
|
+
const crease = [];
|
|
1811
|
+
crease.push(
|
|
1812
|
+
...verticalCreases2(xRear, xSide1, xFront, xSide2, yBody1, yBody2),
|
|
1813
|
+
...horizontalCreases2(xRear, xSide1, xFront, xSide2, xEnd, yBody1, yBody2, tabWidth, yFold1, yFold2, tabStep)
|
|
1814
|
+
);
|
|
1815
|
+
let ci = 0;
|
|
1816
|
+
const sections = [
|
|
1817
|
+
{ name: "Right Edge", color: DEBUG_PALETTE[ci++ % DEBUG_PALETTE.length], paths: [line2(xEnd, yBody1, xEnd, yBody2)] },
|
|
1818
|
+
{ name: "Glue Area", color: DEBUG_PALETTE[ci++ % DEBUG_PALETTE.length], paths: [glueAreaPath2(xRear, yBody1, yBody2, glueTaper, glueArea)] },
|
|
1819
|
+
{ name: "Front Top Edge", color: DEBUG_PALETTE[ci++ % DEBUG_PALETTE.length], paths: [line2(xFront, yBody1, xSide2, yBody1), line2(xFront - MT2, yBody1, xFront, yBody1), line2(xSide2, yBody1, xSide2 + MT2, yBody1)] },
|
|
1820
|
+
{ name: "Front Bottom Edge", color: DEBUG_PALETTE[ci++ % DEBUG_PALETTE.length], paths: [line2(xFront, yBody2, xSide2, yBody2), line2(xFront - MT2, yBody2, xFront, yBody2), line2(xSide2, yBody2, xSide2 + MT2, yBody2)] },
|
|
1821
|
+
{ name: "Top Tuck", color: DEBUG_PALETTE[ci++ % DEBUG_PALETTE.length], paths: [...topTuckStructure2(xRear, xSide1, yBody1, yFold1, tabWidth, tabStep), ...topTuckTip2(xRear, xSide1, yFold1, yTop)] },
|
|
1822
|
+
{ name: "Bottom Tuck", color: DEBUG_PALETTE[ci++ % DEBUG_PALETTE.length], paths: [...bottomTuckStructure2(xRear, xSide1, yBody2, yFold2, tabWidth, tabStep), ...bottomTuckTip2(xRear, xSide1, yFold2, yBot)] },
|
|
1823
|
+
{ name: "Top Dust Flaps", color: DEBUG_PALETTE[ci++ % DEBUG_PALETTE.length], paths: topDustFlaps2(xSide1, xFront, xSide2, xEnd, yBody1, dustFlap, dfCorner, dfInset, dfVertical) },
|
|
1824
|
+
{ name: "Bottom Dust Flaps", color: DEBUG_PALETTE[ci++ % DEBUG_PALETTE.length], paths: bottomDustFlaps2(xSide1, xFront, xSide2, xEnd, yBody2, dustFlap, dfCorner, dfInset, dfVertical) }
|
|
1825
|
+
];
|
|
1826
|
+
return { sections, crease, viewBox: { width: totalWidth, height: totalHeight } };
|
|
1827
|
+
}
|
|
1420
1828
|
function generateOuterContour2(attr) {
|
|
1421
1829
|
const { length, width, height, glueArea, dustFlap, tuckFlap } = attr;
|
|
1422
1830
|
const glueTaper = glueArea * GLUE_TAPER_RATIO2;
|
|
@@ -1712,7 +2120,8 @@ var DIE_LINE_BECF_1030A = forwardRef(
|
|
|
1712
2120
|
attributes,
|
|
1713
2121
|
unit = "mm",
|
|
1714
2122
|
isShowDimensions = false,
|
|
1715
|
-
renderAs = "svg"
|
|
2123
|
+
renderAs = "svg",
|
|
2124
|
+
debug = false
|
|
1716
2125
|
}, ref) => {
|
|
1717
2126
|
const theme = useMemo(
|
|
1718
2127
|
() => getModelTheme(),
|
|
@@ -1795,16 +2204,33 @@ var DIE_LINE_BECF_1030A = forwardRef(
|
|
|
1795
2204
|
factor,
|
|
1796
2205
|
theme
|
|
1797
2206
|
});
|
|
2207
|
+
},
|
|
2208
|
+
readyToPrint: async () => {
|
|
2209
|
+
const dimData = generateDimensions2(attributes, unit);
|
|
2210
|
+
return readyToPrintPdf({
|
|
2211
|
+
modelId: MODEL_ID2,
|
|
2212
|
+
dieline,
|
|
2213
|
+
dimensions: dimData,
|
|
2214
|
+
attributes,
|
|
2215
|
+
unit,
|
|
2216
|
+
factor,
|
|
2217
|
+
theme
|
|
2218
|
+
});
|
|
1798
2219
|
}
|
|
1799
2220
|
}),
|
|
1800
2221
|
[attributes, dieline, factor, unit, serializeSvg, theme]
|
|
1801
2222
|
);
|
|
2223
|
+
const debugData = useMemo(
|
|
2224
|
+
() => debug ? generateBecf1030aDebugSections(attributes) : null,
|
|
2225
|
+
[attributes, debug]
|
|
2226
|
+
);
|
|
1802
2227
|
const padding = isShowDimensions ? 15 : 0;
|
|
1803
2228
|
const vbX = -padding;
|
|
1804
2229
|
const vbY = -padding;
|
|
1805
2230
|
const vbW = dieline.viewBox.width + padding * 2;
|
|
1806
2231
|
const vbH = dieline.viewBox.height + padding * 2;
|
|
1807
|
-
const
|
|
2232
|
+
const debugFontSize = Math.max(3, dieline.viewBox.width / 80);
|
|
2233
|
+
const svgChildren = debug && debugData ? /* @__PURE__ */ jsx(DebugOverlay, { data: debugData, fontSize: debugFontSize }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1808
2234
|
/* @__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}`)) }),
|
|
1809
2235
|
/* @__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}`)) }),
|
|
1810
2236
|
isShowDimensions && /* @__PURE__ */ jsx("g", { id: "dimensions", children: dimensions.map((d, i) => renderDimension2(d, i, getFontDimensionSize())) })
|
|
@@ -1890,6 +2316,7 @@ var CANVAS_BECF_1030A = forwardRef(
|
|
|
1890
2316
|
});
|
|
1891
2317
|
},
|
|
1892
2318
|
exportDimension: () => dieLineRef.current.exportDimension(),
|
|
2319
|
+
readyToPrint: () => dieLineRef.current.readyToPrint(),
|
|
1893
2320
|
resetView: () => canvasRef.current?.resetView(),
|
|
1894
2321
|
fitView: () => canvasRef.current?.fitView()
|
|
1895
2322
|
}), [serializeCanvasSvg, dieline.viewBox.width, dieline.viewBox.height]);
|
|
@@ -2069,9 +2496,11 @@ function bottomDustFlaps3(xSide1, xFront, xSide2, xEnd, yBody2, dustFlap, dfCorn
|
|
|
2069
2496
|
dustFlapPath3(xSide2, xEnd, yBody2, 1, dustFlap, dfCorner, dfInset, dfVertical, "none", "edge")
|
|
2070
2497
|
];
|
|
2071
2498
|
}
|
|
2072
|
-
function
|
|
2499
|
+
function generateBecf1040aDebugSections(attr) {
|
|
2073
2500
|
const { length, width, height, glueArea, dustFlap, tuckFlap } = attr;
|
|
2074
2501
|
const glueTaper = glueArea * GLUE_TAPER_RATIO3;
|
|
2502
|
+
const tabWidth = 7;
|
|
2503
|
+
const tabStep = 1;
|
|
2075
2504
|
const dfInset = Math.min(dustFlap / 6, width * 0.2);
|
|
2076
2505
|
const dfCorner = Math.min(dustFlap * 0.1, dfInset * 0.6);
|
|
2077
2506
|
const dfVertical = Math.min(dustFlap / 6, dustFlap - dfCorner);
|
|
@@ -2080,24 +2509,60 @@ function generateOuterContour3(attr) {
|
|
|
2080
2509
|
const xFront = glueArea + length + width;
|
|
2081
2510
|
const xSide2 = glueArea + length + width + length;
|
|
2082
2511
|
const xEnd = glueArea + 2 * length + 2 * width;
|
|
2083
|
-
const yTop = 0;
|
|
2084
2512
|
const yFold1 = tuckFlap;
|
|
2085
2513
|
const yBody1 = tuckFlap + width;
|
|
2086
2514
|
const yBody2 = tuckFlap + width + height;
|
|
2087
2515
|
const yFold2 = tuckFlap + width + height + width;
|
|
2088
2516
|
const yBot = tuckFlap + 2 * width + height + tuckFlap;
|
|
2089
|
-
const
|
|
2090
|
-
const
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2517
|
+
const totalWidth = xEnd;
|
|
2518
|
+
const totalHeight = yBot;
|
|
2519
|
+
const crease = [];
|
|
2520
|
+
crease.push(
|
|
2521
|
+
...verticalCreases3(xRear, xSide1, xFront, xSide2, yBody1, yBody2),
|
|
2522
|
+
...horizontalCreases3(xSide1, xFront, xSide2, xEnd, yBody1, yBody2, tabWidth, yFold1, yFold2, tabStep)
|
|
2523
|
+
);
|
|
2524
|
+
let ci = 0;
|
|
2525
|
+
const sections = [
|
|
2526
|
+
{ name: "Right Edge", color: DEBUG_PALETTE[ci++ % DEBUG_PALETTE.length], paths: [line3(xEnd, yBody1, xEnd, yBody2)] },
|
|
2527
|
+
{ name: "Glue Area", color: DEBUG_PALETTE[ci++ % DEBUG_PALETTE.length], paths: [glueAreaPath3(xRear, yBody1, yBody2, glueTaper, glueArea)] },
|
|
2528
|
+
{ name: "Rear Top Edge", color: DEBUG_PALETTE[ci++ % DEBUG_PALETTE.length], paths: [line3(xSide1, yBody1, xRear, yBody1), line3(xSide1, yBody1, xSide1 + MT3, yBody1)] },
|
|
2529
|
+
{ name: "Rear Bottom Edge", color: DEBUG_PALETTE[ci++ % DEBUG_PALETTE.length], paths: [line3(xSide1, yBody2, xRear, yBody2), line3(xSide1, yBody2, xSide1 + MT3, yBody2)] },
|
|
2530
|
+
{ name: "Top Tuck", color: DEBUG_PALETTE[ci++ % DEBUG_PALETTE.length], paths: [...topTuckStructure3(xFront, xSide2, yBody1, yFold1, tabWidth, tabStep), ...topTuckTip3(xFront, xSide2, yFold1, 0)] },
|
|
2531
|
+
{ name: "Bottom Tuck", color: DEBUG_PALETTE[ci++ % DEBUG_PALETTE.length], paths: [...bottomTuckStructure3(xFront, xSide2, yBody2, yFold2, tabWidth, tabStep), ...bottomTuckTip3(xFront, xSide2, yFold2, yBot)] },
|
|
2532
|
+
{ name: "Top Dust Flaps", color: DEBUG_PALETTE[ci++ % DEBUG_PALETTE.length], paths: topDustFlaps3(xSide1, xFront, xSide2, xEnd, yBody1, dustFlap, dfCorner, dfInset, dfVertical) },
|
|
2533
|
+
{ name: "Bottom Dust Flaps", color: DEBUG_PALETTE[ci++ % DEBUG_PALETTE.length], paths: bottomDustFlaps3(xSide1, xFront, xSide2, xEnd, yBody2, dustFlap, dfCorner, dfInset, dfVertical) }
|
|
2534
|
+
];
|
|
2535
|
+
return { sections, crease, viewBox: { width: totalWidth, height: totalHeight } };
|
|
2536
|
+
}
|
|
2537
|
+
function generateOuterContour3(attr) {
|
|
2538
|
+
const { length, width, height, glueArea, dustFlap, tuckFlap } = attr;
|
|
2539
|
+
const glueTaper = glueArea * GLUE_TAPER_RATIO3;
|
|
2540
|
+
const dfInset = Math.min(dustFlap / 6, width * 0.2);
|
|
2541
|
+
const dfCorner = Math.min(dustFlap * 0.1, dfInset * 0.6);
|
|
2542
|
+
const dfVertical = Math.min(dustFlap / 6, dustFlap - dfCorner);
|
|
2543
|
+
const xRear = glueArea;
|
|
2544
|
+
const xSide1 = glueArea + length;
|
|
2545
|
+
const xFront = glueArea + length + width;
|
|
2546
|
+
const xSide2 = glueArea + length + width + length;
|
|
2547
|
+
const xEnd = glueArea + 2 * length + 2 * width;
|
|
2548
|
+
const yTop = 0;
|
|
2549
|
+
const yFold1 = tuckFlap;
|
|
2550
|
+
const yBody1 = tuckFlap + width;
|
|
2551
|
+
const yBody2 = tuckFlap + width + height;
|
|
2552
|
+
const yFold2 = tuckFlap + width + height + width;
|
|
2553
|
+
const yBot = tuckFlap + 2 * width + height + tuckFlap;
|
|
2554
|
+
const arcSteps = 8;
|
|
2555
|
+
const points = [];
|
|
2556
|
+
points.push({ x: 0, y: yBody2 - glueTaper });
|
|
2557
|
+
points.push({ x: 0, y: yBody1 + glueTaper });
|
|
2558
|
+
points.push({ x: xRear, y: yBody1 });
|
|
2559
|
+
points.push({ x: xSide1, y: yBody1 });
|
|
2560
|
+
points.push({ x: xSide1 + MT3, y: yBody1 });
|
|
2561
|
+
points.push({ x: xSide1 + MT3, y: yBody1 - dfVertical });
|
|
2562
|
+
points.push({ x: xSide1 + MT3 + dfCorner, y: yBody1 - dfVertical - dfCorner });
|
|
2563
|
+
points.push({ x: xSide1 + dfInset, y: yBody1 - dustFlap });
|
|
2564
|
+
points.push({ x: xFront - dfInset, y: yBody1 - dustFlap });
|
|
2565
|
+
points.push({ x: xFront - dfCorner, y: yBody1 - dfCorner });
|
|
2101
2566
|
points.push({ x: xFront, y: yBody1 });
|
|
2102
2567
|
points.push({ x: xFront, y: yFold1 });
|
|
2103
2568
|
points.push({ x: xFront + MT3, y: yFold1 });
|
|
@@ -2363,7 +2828,8 @@ var DIE_LINE_BECF_1040A = forwardRef(
|
|
|
2363
2828
|
attributes,
|
|
2364
2829
|
unit = "mm",
|
|
2365
2830
|
isShowDimensions = false,
|
|
2366
|
-
renderAs = "svg"
|
|
2831
|
+
renderAs = "svg",
|
|
2832
|
+
debug = false
|
|
2367
2833
|
}, ref) => {
|
|
2368
2834
|
const theme = useMemo(
|
|
2369
2835
|
() => getModelTheme(),
|
|
@@ -2446,16 +2912,33 @@ var DIE_LINE_BECF_1040A = forwardRef(
|
|
|
2446
2912
|
factor,
|
|
2447
2913
|
theme
|
|
2448
2914
|
});
|
|
2915
|
+
},
|
|
2916
|
+
readyToPrint: async () => {
|
|
2917
|
+
const dimData = generateDimensions3(attributes, unit);
|
|
2918
|
+
return readyToPrintPdf({
|
|
2919
|
+
modelId: MODEL_ID3,
|
|
2920
|
+
dieline,
|
|
2921
|
+
dimensions: dimData,
|
|
2922
|
+
attributes,
|
|
2923
|
+
unit,
|
|
2924
|
+
factor,
|
|
2925
|
+
theme
|
|
2926
|
+
});
|
|
2449
2927
|
}
|
|
2450
2928
|
}),
|
|
2451
2929
|
[attributes, dieline, factor, unit, serializeSvg, theme]
|
|
2452
2930
|
);
|
|
2931
|
+
const debugData = useMemo(
|
|
2932
|
+
() => debug ? generateBecf1040aDebugSections(attributes) : null,
|
|
2933
|
+
[attributes, debug]
|
|
2934
|
+
);
|
|
2453
2935
|
const padding = isShowDimensions ? 15 : 0;
|
|
2454
2936
|
const vbX = -padding;
|
|
2455
2937
|
const vbY = -padding;
|
|
2456
2938
|
const vbW = dieline.viewBox.width + padding * 2;
|
|
2457
2939
|
const vbH = dieline.viewBox.height + padding * 2;
|
|
2458
|
-
const
|
|
2940
|
+
const debugFontSize = Math.max(3, dieline.viewBox.width / 80);
|
|
2941
|
+
const svgChildren = debug && debugData ? /* @__PURE__ */ jsx(DebugOverlay, { data: debugData, fontSize: debugFontSize }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2459
2942
|
/* @__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}`)) }),
|
|
2460
2943
|
/* @__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}`)) }),
|
|
2461
2944
|
isShowDimensions && /* @__PURE__ */ jsx("g", { id: "dimensions", children: dimensions.map((d, i) => renderDimension3(d, i, getFontDimensionSize())) })
|
|
@@ -2541,6 +3024,7 @@ var CANVAS_BECF_1040A = forwardRef(
|
|
|
2541
3024
|
});
|
|
2542
3025
|
},
|
|
2543
3026
|
exportDimension: () => dieLineRef.current.exportDimension(),
|
|
3027
|
+
readyToPrint: () => dieLineRef.current.readyToPrint(),
|
|
2544
3028
|
resetView: () => canvasRef.current?.resetView(),
|
|
2545
3029
|
fitView: () => canvasRef.current?.fitView()
|
|
2546
3030
|
}), [serializeCanvasSvg, dieline.viewBox.width, dieline.viewBox.height]);
|
|
@@ -2868,6 +3352,149 @@ function generateDimensions4(attr, unit) {
|
|
|
2868
3352
|
}
|
|
2869
3353
|
];
|
|
2870
3354
|
}
|
|
3355
|
+
function generateBecf11d01DebugSections(attr) {
|
|
3356
|
+
const { length, width, height, flapHeight, glueArea } = attr;
|
|
3357
|
+
const glueTaper = glueArea * GLUE_TAPER_RATIO4;
|
|
3358
|
+
const xRear = glueArea;
|
|
3359
|
+
const xSide1 = glueArea + length;
|
|
3360
|
+
const xFront = glueArea + length + width;
|
|
3361
|
+
const xSide2 = glueArea + length + width + length;
|
|
3362
|
+
const xEnd = glueArea + 2 * length + 2 * width;
|
|
3363
|
+
const yTop = 0;
|
|
3364
|
+
const yBody1 = flapHeight;
|
|
3365
|
+
const yBody2 = flapHeight + height;
|
|
3366
|
+
const yBot = 2 * flapHeight + height;
|
|
3367
|
+
const totalWidth = xEnd;
|
|
3368
|
+
const totalHeight = yBot;
|
|
3369
|
+
const crease = [];
|
|
3370
|
+
crease.push(
|
|
3371
|
+
line4(xRear, yBody1, xRear, yBody2),
|
|
3372
|
+
line4(xSide1, yBody1, xSide1, yBody2),
|
|
3373
|
+
line4(xFront, yBody1, xFront, yBody2),
|
|
3374
|
+
line4(xSide2, yBody1, xSide2, yBody2)
|
|
3375
|
+
);
|
|
3376
|
+
crease.push(line4(xRear + FLAP_INSET, yBody1 + MT4, xSide1 - FLAP_INSET, yBody1 + MT4));
|
|
3377
|
+
crease.push(line4(xSide1, yBody1, xFront, yBody1));
|
|
3378
|
+
crease.push(line4(xFront + FLAP_INSET, yBody1 + MT4, xSide2 - FLAP_INSET, yBody1 + MT4));
|
|
3379
|
+
crease.push(line4(xSide2, yBody1, xEnd, yBody1));
|
|
3380
|
+
crease.push(line4(xRear + FLAP_INSET, yBody2 - MT4, xSide1 - FLAP_INSET, yBody2 - MT4));
|
|
3381
|
+
crease.push(line4(xSide1, yBody2, xFront, yBody2));
|
|
3382
|
+
crease.push(line4(xFront + FLAP_INSET, yBody2 - MT4, xSide2 - FLAP_INSET, yBody2 - MT4));
|
|
3383
|
+
crease.push(line4(xSide2, yBody2, xEnd, yBody2));
|
|
3384
|
+
const sections = [];
|
|
3385
|
+
let colorIdx = 0;
|
|
3386
|
+
sections.push({
|
|
3387
|
+
name: "Glue Area",
|
|
3388
|
+
color: DEBUG_PALETTE[colorIdx++ % DEBUG_PALETTE.length],
|
|
3389
|
+
paths: [glueAreaPath4(xRear, yBody1, yBody2, glueTaper, glueArea)]
|
|
3390
|
+
});
|
|
3391
|
+
sections.push({
|
|
3392
|
+
name: "Right Edge",
|
|
3393
|
+
color: DEBUG_PALETTE[colorIdx++ % DEBUG_PALETTE.length],
|
|
3394
|
+
paths: [line4(xEnd, yBody1, xEnd, yBody2)]
|
|
3395
|
+
});
|
|
3396
|
+
{
|
|
3397
|
+
const rL = xRear + FLAP_INSET;
|
|
3398
|
+
const rR = xSide1 - FLAP_INSET;
|
|
3399
|
+
sections.push({
|
|
3400
|
+
name: "Top Rear Dust Flap",
|
|
3401
|
+
color: DEBUG_PALETTE[colorIdx++ % DEBUG_PALETTE.length],
|
|
3402
|
+
paths: [
|
|
3403
|
+
line4(rL, yBody1, rL, yTop),
|
|
3404
|
+
line4(rL, yTop, rR, yTop),
|
|
3405
|
+
line4(rR, yTop, rR, yBody1),
|
|
3406
|
+
line4(xRear, yBody1, rL, yBody1),
|
|
3407
|
+
line4(rR, yBody1, xSide1, yBody1)
|
|
3408
|
+
]
|
|
3409
|
+
});
|
|
3410
|
+
}
|
|
3411
|
+
sections.push({
|
|
3412
|
+
name: "Top Side1 Flap",
|
|
3413
|
+
color: DEBUG_PALETTE[colorIdx++ % DEBUG_PALETTE.length],
|
|
3414
|
+
paths: [
|
|
3415
|
+
line4(xSide1, yBody1, xSide1, yTop),
|
|
3416
|
+
line4(xSide1, yTop, xFront, yTop),
|
|
3417
|
+
line4(xFront, yTop, xFront, yBody1)
|
|
3418
|
+
]
|
|
3419
|
+
});
|
|
3420
|
+
{
|
|
3421
|
+
const fL = xFront + FLAP_INSET;
|
|
3422
|
+
const fR = xSide2 - FLAP_INSET;
|
|
3423
|
+
sections.push({
|
|
3424
|
+
name: "Top Front Dust Flap",
|
|
3425
|
+
color: DEBUG_PALETTE[colorIdx++ % DEBUG_PALETTE.length],
|
|
3426
|
+
paths: [
|
|
3427
|
+
line4(fL, yBody1, fL, yTop),
|
|
3428
|
+
line4(fL, yTop, fR, yTop),
|
|
3429
|
+
line4(fR, yTop, fR, yBody1),
|
|
3430
|
+
line4(xFront, yBody1, fL, yBody1),
|
|
3431
|
+
line4(fR, yBody1, xSide2, yBody1)
|
|
3432
|
+
]
|
|
3433
|
+
});
|
|
3434
|
+
}
|
|
3435
|
+
sections.push({
|
|
3436
|
+
name: "Top Side2 Flap",
|
|
3437
|
+
color: DEBUG_PALETTE[colorIdx++ % DEBUG_PALETTE.length],
|
|
3438
|
+
paths: [
|
|
3439
|
+
line4(xSide2, yBody1, xSide2, yTop),
|
|
3440
|
+
line4(xSide2, yTop, xEnd, yTop),
|
|
3441
|
+
line4(xEnd, yTop, xEnd, yBody1)
|
|
3442
|
+
]
|
|
3443
|
+
});
|
|
3444
|
+
{
|
|
3445
|
+
const rL = xRear + FLAP_INSET;
|
|
3446
|
+
const rR = xSide1 - FLAP_INSET;
|
|
3447
|
+
sections.push({
|
|
3448
|
+
name: "Bottom Rear Dust Flap",
|
|
3449
|
+
color: DEBUG_PALETTE[colorIdx++ % DEBUG_PALETTE.length],
|
|
3450
|
+
paths: [
|
|
3451
|
+
line4(rL, yBody2, rL, yBot),
|
|
3452
|
+
line4(rL, yBot, rR, yBot),
|
|
3453
|
+
line4(rR, yBot, rR, yBody2),
|
|
3454
|
+
line4(xRear, yBody2, rL, yBody2),
|
|
3455
|
+
line4(rR, yBody2, xSide1, yBody2)
|
|
3456
|
+
]
|
|
3457
|
+
});
|
|
3458
|
+
}
|
|
3459
|
+
sections.push({
|
|
3460
|
+
name: "Bottom Side1 Flap",
|
|
3461
|
+
color: DEBUG_PALETTE[colorIdx++ % DEBUG_PALETTE.length],
|
|
3462
|
+
paths: [
|
|
3463
|
+
line4(xSide1, yBody2, xSide1, yBot),
|
|
3464
|
+
line4(xSide1, yBot, xFront, yBot),
|
|
3465
|
+
line4(xFront, yBot, xFront, yBody2)
|
|
3466
|
+
]
|
|
3467
|
+
});
|
|
3468
|
+
{
|
|
3469
|
+
const fL = xFront + FLAP_INSET;
|
|
3470
|
+
const fR = xSide2 - FLAP_INSET;
|
|
3471
|
+
sections.push({
|
|
3472
|
+
name: "Bottom Front Dust Flap",
|
|
3473
|
+
color: DEBUG_PALETTE[colorIdx++ % DEBUG_PALETTE.length],
|
|
3474
|
+
paths: [
|
|
3475
|
+
line4(fL, yBody2, fL, yBot),
|
|
3476
|
+
line4(fL, yBot, fR, yBot),
|
|
3477
|
+
line4(fR, yBot, fR, yBody2),
|
|
3478
|
+
line4(xFront, yBody2, fL, yBody2),
|
|
3479
|
+
line4(fR, yBody2, xSide2, yBody2)
|
|
3480
|
+
]
|
|
3481
|
+
});
|
|
3482
|
+
}
|
|
3483
|
+
sections.push({
|
|
3484
|
+
name: "Bottom Side2 Flap",
|
|
3485
|
+
color: DEBUG_PALETTE[colorIdx++ % DEBUG_PALETTE.length],
|
|
3486
|
+
paths: [
|
|
3487
|
+
line4(xSide2, yBody2, xSide2, yBot),
|
|
3488
|
+
line4(xSide2, yBot, xEnd, yBot),
|
|
3489
|
+
line4(xEnd, yBot, xEnd, yBody2)
|
|
3490
|
+
]
|
|
3491
|
+
});
|
|
3492
|
+
return {
|
|
3493
|
+
sections,
|
|
3494
|
+
crease,
|
|
3495
|
+
viewBox: { width: totalWidth, height: totalHeight }
|
|
3496
|
+
};
|
|
3497
|
+
}
|
|
2871
3498
|
var MODEL_ID4 = "BECF-11D01";
|
|
2872
3499
|
var UNIT_FACTOR4 = {
|
|
2873
3500
|
mm: 1,
|
|
@@ -2926,7 +3553,8 @@ var DIE_LINE_BECF_11D01 = forwardRef(
|
|
|
2926
3553
|
attributes,
|
|
2927
3554
|
unit = "mm",
|
|
2928
3555
|
isShowDimensions = false,
|
|
2929
|
-
renderAs = "svg"
|
|
3556
|
+
renderAs = "svg",
|
|
3557
|
+
debug = false
|
|
2930
3558
|
}, ref) => {
|
|
2931
3559
|
const theme = useMemo(
|
|
2932
3560
|
() => getModelTheme(),
|
|
@@ -2938,6 +3566,10 @@ var DIE_LINE_BECF_11D01 = forwardRef(
|
|
|
2938
3566
|
() => generateDimensions4(attributes, unit),
|
|
2939
3567
|
[attributes, unit]
|
|
2940
3568
|
);
|
|
3569
|
+
const debugData = useMemo(
|
|
3570
|
+
() => debug ? generateBecf11d01DebugSections(attributes) : null,
|
|
3571
|
+
[attributes, debug]
|
|
3572
|
+
);
|
|
2941
3573
|
const factor = UNIT_FACTOR4[unit] ?? 1;
|
|
2942
3574
|
const serializeSvg = useCallback(
|
|
2943
3575
|
(showDimensions) => {
|
|
@@ -3008,6 +3640,18 @@ var DIE_LINE_BECF_11D01 = forwardRef(
|
|
|
3008
3640
|
factor,
|
|
3009
3641
|
theme
|
|
3010
3642
|
});
|
|
3643
|
+
},
|
|
3644
|
+
readyToPrint: async () => {
|
|
3645
|
+
const dimData = generateDimensions4(attributes, unit);
|
|
3646
|
+
return readyToPrintPdf({
|
|
3647
|
+
modelId: MODEL_ID4,
|
|
3648
|
+
dieline,
|
|
3649
|
+
dimensions: dimData,
|
|
3650
|
+
attributes,
|
|
3651
|
+
unit,
|
|
3652
|
+
factor,
|
|
3653
|
+
theme
|
|
3654
|
+
});
|
|
3011
3655
|
}
|
|
3012
3656
|
}),
|
|
3013
3657
|
[attributes, dieline, factor, unit, serializeSvg, theme]
|
|
@@ -3017,7 +3661,8 @@ var DIE_LINE_BECF_11D01 = forwardRef(
|
|
|
3017
3661
|
const vbY = -padding;
|
|
3018
3662
|
const vbW = dieline.viewBox.width + padding * 2;
|
|
3019
3663
|
const vbH = dieline.viewBox.height + padding * 2;
|
|
3020
|
-
const
|
|
3664
|
+
const debugFontSize = Math.max(3, dieline.viewBox.width / 80);
|
|
3665
|
+
const svgChildren = debug && debugData ? /* @__PURE__ */ jsx(DebugOverlay, { data: debugData, fontSize: debugFontSize }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3021
3666
|
/* @__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}`)) }),
|
|
3022
3667
|
/* @__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}`)) }),
|
|
3023
3668
|
isShowDimensions && /* @__PURE__ */ jsx("g", { id: "dimensions", children: dimensions.map((d, i) => renderDimension4(d, i, getFontDimensionSize())) })
|
|
@@ -3103,6 +3748,7 @@ var CANVAS_BECF_11D01 = forwardRef(
|
|
|
3103
3748
|
});
|
|
3104
3749
|
},
|
|
3105
3750
|
exportDimension: () => dieLineRef.current.exportDimension(),
|
|
3751
|
+
readyToPrint: () => dieLineRef.current.readyToPrint(),
|
|
3106
3752
|
resetView: () => canvasRef.current?.resetView(),
|
|
3107
3753
|
fitView: () => canvasRef.current?.fitView()
|
|
3108
3754
|
}), [serializeCanvasSvg, dieline.viewBox.width, dieline.viewBox.height]);
|
|
@@ -3138,9 +3784,10 @@ var MODEL_BECF_11D01 = forwardRef(
|
|
|
3138
3784
|
var DIP = 15;
|
|
3139
3785
|
var ROPE_R = 3;
|
|
3140
3786
|
var ROPE_Y = 20;
|
|
3141
|
-
var
|
|
3142
|
-
|
|
3143
|
-
|
|
3787
|
+
var D_SMALL = 30;
|
|
3788
|
+
var D_LARGE = 40;
|
|
3789
|
+
function calcD(c) {
|
|
3790
|
+
return c < 300 ? D_SMALL : D_LARGE;
|
|
3144
3791
|
}
|
|
3145
3792
|
function calcKulak(b) {
|
|
3146
3793
|
if (b <= 13) return b - 1;
|
|
@@ -3154,7 +3801,7 @@ function calcX(a) {
|
|
|
3154
3801
|
}
|
|
3155
3802
|
function getAutoCalcValues(attr) {
|
|
3156
3803
|
const { length: A, width: B, height: C, glueArea } = attr;
|
|
3157
|
-
const D = calcD(C
|
|
3804
|
+
const D = calcD(C);
|
|
3158
3805
|
const kulak = glueArea ?? calcKulak(B);
|
|
3159
3806
|
const X = calcX(A);
|
|
3160
3807
|
return { d: D, kulak, dip: DIP, ropeR: ROPE_R, ropeY: ROPE_Y, ropeX: X };
|
|
@@ -3167,7 +3814,7 @@ function circlePath(cx, cy, r) {
|
|
|
3167
3814
|
}
|
|
3168
3815
|
function generateBecf12101(attr) {
|
|
3169
3816
|
const { length: A, width: B, height: C, glueArea } = attr;
|
|
3170
|
-
const D = calcD(C
|
|
3817
|
+
const D = calcD(C);
|
|
3171
3818
|
const kulak = glueArea ?? calcKulak(B);
|
|
3172
3819
|
const X = calcX(A);
|
|
3173
3820
|
const xFront = kulak;
|
|
@@ -3222,9 +3869,92 @@ function generateBecf12101(attr) {
|
|
|
3222
3869
|
crease.push(line5(xSide2Mid, yFoldBottomStart, xEnd, D + C - 2));
|
|
3223
3870
|
return { cut, crease, viewBox: { width: totalWidth, height: totalHeight } };
|
|
3224
3871
|
}
|
|
3872
|
+
function generateBecf12101DebugSections(attr) {
|
|
3873
|
+
const { length: A, width: B, height: C, glueArea } = attr;
|
|
3874
|
+
const D = calcD(C);
|
|
3875
|
+
const kulak = glueArea ?? calcKulak(B);
|
|
3876
|
+
const X = calcX(A);
|
|
3877
|
+
const xFront = kulak;
|
|
3878
|
+
const xSide1 = kulak + A;
|
|
3879
|
+
const xSide1Mid = kulak + A + B / 2;
|
|
3880
|
+
const xBack = kulak + A + B;
|
|
3881
|
+
const xSide2 = kulak + 2 * A + B;
|
|
3882
|
+
const xSide2Mid = kulak + 2 * A + B + B / 2;
|
|
3883
|
+
const xEnd = kulak + 2 * A + 2 * B - 2;
|
|
3884
|
+
const yFoldTop = D;
|
|
3885
|
+
const yFoldBottomStart = D + C - B / 2;
|
|
3886
|
+
const yFoldBottom = D + C;
|
|
3887
|
+
const yBottomFlap = D + C + B / 2;
|
|
3888
|
+
const yEnd = D + C + B / 2 + DIP;
|
|
3889
|
+
const totalWidth = xEnd;
|
|
3890
|
+
const totalHeight = yEnd;
|
|
3891
|
+
const crease = [];
|
|
3892
|
+
crease.push(line5(0, yFoldTop, totalWidth, yFoldTop));
|
|
3893
|
+
crease.push(line5(0, yFoldBottomStart, totalWidth, yFoldBottomStart));
|
|
3894
|
+
crease.push(line5(0, yFoldBottom, totalWidth, yFoldBottom));
|
|
3895
|
+
crease.push(line5(xFront, 0, xFront, totalHeight));
|
|
3896
|
+
crease.push(line5(xSide1, 0, xSide1, totalHeight));
|
|
3897
|
+
crease.push(line5(xSide1Mid, 0, xSide1Mid, totalHeight));
|
|
3898
|
+
crease.push(line5(xBack, 0, xBack, totalHeight));
|
|
3899
|
+
crease.push(line5(xSide2, 0, xSide2, totalHeight));
|
|
3900
|
+
crease.push(line5(xSide2Mid, 0, xSide2Mid, totalHeight));
|
|
3901
|
+
crease.push(line5(0, yFoldBottom - kulak, kulak + B / 2, yBottomFlap));
|
|
3902
|
+
crease.push(line5(kulak + A - B / 2, yBottomFlap, xSide1Mid, yFoldBottomStart));
|
|
3903
|
+
crease.push(line5(xSide1Mid, yFoldBottomStart, kulak + A + B + B / 2, yBottomFlap));
|
|
3904
|
+
crease.push(line5(kulak + 2 * A + B - B / 2, yBottomFlap, xSide2Mid, yFoldBottomStart));
|
|
3905
|
+
crease.push(line5(xSide2Mid, yFoldBottomStart, xEnd, D + C - 2));
|
|
3906
|
+
const frontCx = kulak + A / 2;
|
|
3907
|
+
const backCx = kulak + A + B + A / 2;
|
|
3908
|
+
const ropeTopY = yFoldTop - ROPE_Y;
|
|
3909
|
+
const ropeBotY = yFoldTop + ROPE_Y;
|
|
3910
|
+
let ci = 0;
|
|
3911
|
+
const sections = [
|
|
3912
|
+
{
|
|
3913
|
+
name: "Outer Rect",
|
|
3914
|
+
color: DEBUG_PALETTE[ci++ % DEBUG_PALETTE.length],
|
|
3915
|
+
paths: [
|
|
3916
|
+
line5(0, 0, totalWidth, 0),
|
|
3917
|
+
line5(totalWidth, 0, totalWidth, totalHeight),
|
|
3918
|
+
line5(totalWidth, totalHeight, 0, totalHeight),
|
|
3919
|
+
line5(0, totalHeight, 0, 0)
|
|
3920
|
+
]
|
|
3921
|
+
},
|
|
3922
|
+
{
|
|
3923
|
+
name: "Bottom Zone Cuts",
|
|
3924
|
+
color: DEBUG_PALETTE[ci++ % DEBUG_PALETTE.length],
|
|
3925
|
+
paths: [
|
|
3926
|
+
line5(kulak + B / 2, yBottomFlap, kulak + B / 2, yEnd),
|
|
3927
|
+
line5(kulak + A - B / 2, yBottomFlap, kulak + A - B / 2, yEnd),
|
|
3928
|
+
line5(kulak + A + B + B / 2, yBottomFlap, kulak + A + B + B / 2, yEnd),
|
|
3929
|
+
line5(kulak + 2 * A + B - B / 2, yBottomFlap, kulak + 2 * A + B - B / 2, yEnd)
|
|
3930
|
+
]
|
|
3931
|
+
},
|
|
3932
|
+
{
|
|
3933
|
+
name: "Front Rope Holes",
|
|
3934
|
+
color: DEBUG_PALETTE[ci++ % DEBUG_PALETTE.length],
|
|
3935
|
+
paths: [
|
|
3936
|
+
circlePath(frontCx - X / 2, ropeTopY, ROPE_R),
|
|
3937
|
+
circlePath(frontCx - X / 2, ropeBotY, ROPE_R),
|
|
3938
|
+
circlePath(frontCx + X / 2, ropeTopY, ROPE_R),
|
|
3939
|
+
circlePath(frontCx + X / 2, ropeBotY, ROPE_R)
|
|
3940
|
+
]
|
|
3941
|
+
},
|
|
3942
|
+
{
|
|
3943
|
+
name: "Back Rope Holes",
|
|
3944
|
+
color: DEBUG_PALETTE[ci++ % DEBUG_PALETTE.length],
|
|
3945
|
+
paths: [
|
|
3946
|
+
circlePath(backCx - X / 2, ropeTopY, ROPE_R),
|
|
3947
|
+
circlePath(backCx - X / 2, ropeBotY, ROPE_R),
|
|
3948
|
+
circlePath(backCx + X / 2, ropeTopY, ROPE_R),
|
|
3949
|
+
circlePath(backCx + X / 2, ropeBotY, ROPE_R)
|
|
3950
|
+
]
|
|
3951
|
+
}
|
|
3952
|
+
];
|
|
3953
|
+
return { sections, crease, viewBox: { width: totalWidth, height: totalHeight } };
|
|
3954
|
+
}
|
|
3225
3955
|
function generateOuterContour5(attr) {
|
|
3226
3956
|
const { length: A, width: B, height: C, glueArea } = attr;
|
|
3227
|
-
const D = calcD(C
|
|
3957
|
+
const D = calcD(C);
|
|
3228
3958
|
const kulak = glueArea ?? calcKulak(B);
|
|
3229
3959
|
const totalWidth = kulak + 2 * A + 2 * B - 2;
|
|
3230
3960
|
const totalHeight = D + C + B / 2 + DIP;
|
|
@@ -3282,7 +4012,7 @@ function contourToPath5(points) {
|
|
|
3282
4012
|
}
|
|
3283
4013
|
function generateDimensions5(attr, unit) {
|
|
3284
4014
|
const { length: A, width: B, height: C, glueArea } = attr;
|
|
3285
|
-
const D = calcD(C
|
|
4015
|
+
const D = calcD(C);
|
|
3286
4016
|
const kulak = glueArea ?? calcKulak(B);
|
|
3287
4017
|
const factor = unit === "cm" ? 0.1 : unit === "in" ? 1 / 25.4 : 1;
|
|
3288
4018
|
const suffix = unit;
|
|
@@ -3291,11 +4021,12 @@ function generateDimensions5(attr, unit) {
|
|
|
3291
4021
|
const xSide1 = kulak + A;
|
|
3292
4022
|
const xBack = kulak + A + B;
|
|
3293
4023
|
const yFoldTop = D;
|
|
4024
|
+
const yFoldBottomStart = D + C - B / 2;
|
|
3294
4025
|
const yFoldBottom = D + C;
|
|
4026
|
+
const yBottomFlap = D + C + B / 2;
|
|
3295
4027
|
const yEnd = D + C + B / 2 + DIP;
|
|
3296
4028
|
const totalWidth = kulak + 2 * A + 2 * B - 2;
|
|
3297
4029
|
const totalHeight = yEnd;
|
|
3298
|
-
const bottomSection = B / 2 + DIP;
|
|
3299
4030
|
return [
|
|
3300
4031
|
// Overall dimensions (outside)
|
|
3301
4032
|
{
|
|
@@ -3316,7 +4047,17 @@ function generateDimensions5(attr, unit) {
|
|
|
3316
4047
|
orientation: "vertical",
|
|
3317
4048
|
offset: -12
|
|
3318
4049
|
},
|
|
3319
|
-
//
|
|
4050
|
+
// Top flap (D)
|
|
4051
|
+
{
|
|
4052
|
+
x1: xBack + A * 0.6,
|
|
4053
|
+
y1: 0,
|
|
4054
|
+
x2: xBack + A * 0.6,
|
|
4055
|
+
y2: yFoldTop,
|
|
4056
|
+
label: fmt(D),
|
|
4057
|
+
orientation: "vertical",
|
|
4058
|
+
offset: -10
|
|
4059
|
+
},
|
|
4060
|
+
// Body height (h = C)
|
|
3320
4061
|
{
|
|
3321
4062
|
x1: xBack + A * 0.6,
|
|
3322
4063
|
y1: yFoldTop,
|
|
@@ -3326,23 +4067,33 @@ function generateDimensions5(attr, unit) {
|
|
|
3326
4067
|
orientation: "vertical",
|
|
3327
4068
|
offset: -10
|
|
3328
4069
|
},
|
|
3329
|
-
//
|
|
4070
|
+
// W-fold upper (B/2) — yFoldBottomStart to yFoldBottom
|
|
3330
4071
|
{
|
|
3331
4072
|
x1: xBack + A * 0.6,
|
|
3332
|
-
y1:
|
|
4073
|
+
y1: yFoldBottomStart,
|
|
3333
4074
|
x2: xBack + A * 0.6,
|
|
3334
|
-
y2:
|
|
3335
|
-
label: fmt(
|
|
4075
|
+
y2: yFoldBottom,
|
|
4076
|
+
label: fmt(B / 2),
|
|
3336
4077
|
orientation: "vertical",
|
|
3337
4078
|
offset: -10
|
|
3338
4079
|
},
|
|
3339
|
-
//
|
|
4080
|
+
// W-fold lower (B/2) — yFoldBottom to yBottomFlap
|
|
3340
4081
|
{
|
|
3341
4082
|
x1: xBack + A * 0.6,
|
|
3342
4083
|
y1: yFoldBottom,
|
|
3343
4084
|
x2: xBack + A * 0.6,
|
|
4085
|
+
y2: yBottomFlap,
|
|
4086
|
+
label: fmt(B / 2),
|
|
4087
|
+
orientation: "vertical",
|
|
4088
|
+
offset: -10
|
|
4089
|
+
},
|
|
4090
|
+
// DIP — bottom glue tab
|
|
4091
|
+
{
|
|
4092
|
+
x1: xBack + A * 0.6,
|
|
4093
|
+
y1: yBottomFlap,
|
|
4094
|
+
x2: xBack + A * 0.6,
|
|
3344
4095
|
y2: yEnd,
|
|
3345
|
-
label: fmt(
|
|
4096
|
+
label: fmt(DIP),
|
|
3346
4097
|
orientation: "vertical",
|
|
3347
4098
|
offset: -10
|
|
3348
4099
|
},
|
|
@@ -3436,7 +4187,8 @@ var DIE_LINE_BECF_12101 = forwardRef(
|
|
|
3436
4187
|
attributes,
|
|
3437
4188
|
unit = "mm",
|
|
3438
4189
|
isShowDimensions = false,
|
|
3439
|
-
renderAs = "svg"
|
|
4190
|
+
renderAs = "svg",
|
|
4191
|
+
debug = false
|
|
3440
4192
|
}, ref) => {
|
|
3441
4193
|
const theme = useMemo(
|
|
3442
4194
|
() => getModelTheme(),
|
|
@@ -3444,6 +4196,10 @@ var DIE_LINE_BECF_12101 = forwardRef(
|
|
|
3444
4196
|
);
|
|
3445
4197
|
const svgRef = useRef(null);
|
|
3446
4198
|
const dieline = useMemo(() => generateBecf12101(attributes), [attributes]);
|
|
4199
|
+
const debugData = useMemo(
|
|
4200
|
+
() => debug ? generateBecf12101DebugSections(attributes) : null,
|
|
4201
|
+
[attributes, debug]
|
|
4202
|
+
);
|
|
3447
4203
|
const dimensions = useMemo(
|
|
3448
4204
|
() => generateDimensions5(attributes, unit),
|
|
3449
4205
|
[attributes, unit]
|
|
@@ -3525,6 +4281,18 @@ var DIE_LINE_BECF_12101 = forwardRef(
|
|
|
3525
4281
|
factor,
|
|
3526
4282
|
theme
|
|
3527
4283
|
});
|
|
4284
|
+
},
|
|
4285
|
+
readyToPrint: async () => {
|
|
4286
|
+
const dimData = generateDimensions5(attributes, unit);
|
|
4287
|
+
return readyToPrintPdf({
|
|
4288
|
+
modelId: MODEL_ID5,
|
|
4289
|
+
dieline,
|
|
4290
|
+
dimensions: dimData,
|
|
4291
|
+
attributes,
|
|
4292
|
+
unit,
|
|
4293
|
+
factor,
|
|
4294
|
+
theme
|
|
4295
|
+
});
|
|
3528
4296
|
}
|
|
3529
4297
|
};
|
|
3530
4298
|
},
|
|
@@ -3535,7 +4303,8 @@ var DIE_LINE_BECF_12101 = forwardRef(
|
|
|
3535
4303
|
const vbY = -padding;
|
|
3536
4304
|
const vbW = dieline.viewBox.width + padding * 2;
|
|
3537
4305
|
const vbH = dieline.viewBox.height + padding * 2;
|
|
3538
|
-
const
|
|
4306
|
+
const debugFontSize = Math.max(3, dieline.viewBox.width / 80);
|
|
4307
|
+
const svgChildren = debug && debugData ? /* @__PURE__ */ jsx(DebugOverlay, { data: debugData, fontSize: debugFontSize }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3539
4308
|
/* @__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}`)) }),
|
|
3540
4309
|
/* @__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}`)) }),
|
|
3541
4310
|
isShowDimensions && /* @__PURE__ */ jsx("g", { id: "dimensions", children: dimensions.map((d, i) => renderDimension5(d, i, getFontDimensionSize())) })
|
|
@@ -3621,6 +4390,7 @@ var CANVAS_BECF_12101 = forwardRef(
|
|
|
3621
4390
|
});
|
|
3622
4391
|
},
|
|
3623
4392
|
exportDimension: () => dieLineRef.current.exportDimension(),
|
|
4393
|
+
readyToPrint: () => dieLineRef.current.readyToPrint(),
|
|
3624
4394
|
resetView: () => canvasRef.current?.resetView(),
|
|
3625
4395
|
fitView: () => canvasRef.current?.fitView()
|
|
3626
4396
|
}), [serializeCanvasSvg, dieline.viewBox.width, dieline.viewBox.height]);
|
|
@@ -3653,14 +4423,15 @@ var MODEL_BECF_12101 = forwardRef(
|
|
|
3653
4423
|
);
|
|
3654
4424
|
|
|
3655
4425
|
// src/components/dieline/bags-pillows/becf-12109/generate.ts
|
|
3656
|
-
var DIP2 =
|
|
4426
|
+
var DIP2 = 15;
|
|
3657
4427
|
var ROPE_R2 = 3;
|
|
3658
4428
|
var ROPE_Y2 = 20;
|
|
3659
|
-
var
|
|
4429
|
+
var D_SMALL2 = 30;
|
|
4430
|
+
var D_LARGE2 = 40;
|
|
3660
4431
|
var NOTCH_X = 3;
|
|
3661
4432
|
var NOTCH_Y = 5;
|
|
3662
|
-
function calcD2(c
|
|
3663
|
-
return
|
|
4433
|
+
function calcD2(c) {
|
|
4434
|
+
return c < 300 ? D_SMALL2 : D_LARGE2;
|
|
3664
4435
|
}
|
|
3665
4436
|
function calcKulak2(b) {
|
|
3666
4437
|
if (b <= 13) return b - 1;
|
|
@@ -3674,7 +4445,7 @@ function calcX2(a) {
|
|
|
3674
4445
|
}
|
|
3675
4446
|
function getAutoCalcValues2(attr) {
|
|
3676
4447
|
const { length: A, width: B, height: C, glueArea } = attr;
|
|
3677
|
-
const D = calcD2(C
|
|
4448
|
+
const D = calcD2(C);
|
|
3678
4449
|
const kulak = glueArea ?? calcKulak2(B);
|
|
3679
4450
|
const X = calcX2(A);
|
|
3680
4451
|
return { d: D, kulak, dip: DIP2, ropeR: ROPE_R2, ropeY: ROPE_Y2, ropeX: X };
|
|
@@ -3687,7 +4458,7 @@ function circlePath2(cx, cy, r) {
|
|
|
3687
4458
|
}
|
|
3688
4459
|
function generateBecf12109(attr) {
|
|
3689
4460
|
const { length: A, width: B, height: C, glueArea } = attr;
|
|
3690
|
-
const D = calcD2(C
|
|
4461
|
+
const D = calcD2(C);
|
|
3691
4462
|
const kulak = glueArea ?? calcKulak2(B);
|
|
3692
4463
|
const X = calcX2(A);
|
|
3693
4464
|
const xFront = kulak;
|
|
@@ -3755,9 +4526,117 @@ function generateBecf12109(attr) {
|
|
|
3755
4526
|
crease.push(line6(xSide2Mid, yFoldBottomStart, xEnd, D + C - 2));
|
|
3756
4527
|
return { cut, crease, viewBox: { width: totalWidth, height: totalHeight } };
|
|
3757
4528
|
}
|
|
4529
|
+
function generateBecf12109DebugSections(attr) {
|
|
4530
|
+
const { length: A, width: B, height: C, glueArea } = attr;
|
|
4531
|
+
const D = calcD2(C);
|
|
4532
|
+
const kulak = glueArea ?? calcKulak2(B);
|
|
4533
|
+
const X = calcX2(A);
|
|
4534
|
+
const xFront = kulak;
|
|
4535
|
+
const xSide1 = kulak + A;
|
|
4536
|
+
const xBack = kulak + A + B;
|
|
4537
|
+
const xSide2 = kulak + 2 * A + B;
|
|
4538
|
+
const xSide1Mid = kulak + A + B / 2;
|
|
4539
|
+
const xSide2Mid = kulak + 2 * A + B + B / 2;
|
|
4540
|
+
const xEnd = kulak + 2 * A + 2 * B - 2;
|
|
4541
|
+
const yFoldTop = D;
|
|
4542
|
+
const yFoldBottomStart = D + C - B / 2;
|
|
4543
|
+
const yFoldBottom = D + C;
|
|
4544
|
+
const yNotchStart = yFoldBottom + NOTCH_Y;
|
|
4545
|
+
const yEnd = D + C + B / 2 + DIP2;
|
|
4546
|
+
const totalWidth = xEnd;
|
|
4547
|
+
const totalHeight = yEnd;
|
|
4548
|
+
const crease = [];
|
|
4549
|
+
crease.push(line6(0, yFoldTop, totalWidth, yFoldTop));
|
|
4550
|
+
crease.push(line6(0, yFoldBottomStart, totalWidth, yFoldBottomStart));
|
|
4551
|
+
crease.push(line6(kulak, yFoldBottom, xEnd, yFoldBottom));
|
|
4552
|
+
crease.push(line6(xFront, 0, xFront, yFoldBottom));
|
|
4553
|
+
crease.push(line6(xSide1, 0, xSide1, yFoldBottom));
|
|
4554
|
+
crease.push(line6(xBack, 0, xBack, yFoldBottom));
|
|
4555
|
+
crease.push(line6(xSide2, 0, xSide2, yFoldBottom));
|
|
4556
|
+
crease.push(line6(xSide1Mid, 0, xSide1Mid, totalHeight));
|
|
4557
|
+
crease.push(line6(xSide2Mid, 0, xSide2Mid, totalHeight));
|
|
4558
|
+
crease.push(line6(xBack, yFoldBottom, xSide1Mid, yFoldBottomStart));
|
|
4559
|
+
crease.push(line6(xSide1Mid, yFoldBottomStart, xSide1, yFoldBottom));
|
|
4560
|
+
crease.push(line6(xSide2Mid, yFoldBottomStart, xSide2, yFoldBottom));
|
|
4561
|
+
crease.push(line6(xSide2Mid, yFoldBottomStart, xEnd, D + C - 2));
|
|
4562
|
+
const frontCx = kulak + A / 2;
|
|
4563
|
+
const backCx = kulak + A + B + A / 2;
|
|
4564
|
+
const ropeTopY = yFoldTop - ROPE_Y2;
|
|
4565
|
+
const ropeBotY = yFoldTop + ROPE_Y2;
|
|
4566
|
+
const boundaries = [xFront, xSide1, xBack, xSide2, xEnd];
|
|
4567
|
+
const vNotchPaths = [];
|
|
4568
|
+
for (let i = 0; i < boundaries.length; i++) {
|
|
4569
|
+
const xb = boundaries[i];
|
|
4570
|
+
const isFirst = i === 0;
|
|
4571
|
+
const isLast = i === boundaries.length - 1;
|
|
4572
|
+
if (!isFirst) {
|
|
4573
|
+
vNotchPaths.push(line6(xb - NOTCH_X, yNotchStart, xb - NOTCH_X, totalHeight));
|
|
4574
|
+
vNotchPaths.push(line6(xb - NOTCH_X, yNotchStart, xb, yFoldBottom));
|
|
4575
|
+
}
|
|
4576
|
+
if (!isLast) {
|
|
4577
|
+
vNotchPaths.push(line6(xb + NOTCH_X, yNotchStart, xb + NOTCH_X, totalHeight));
|
|
4578
|
+
vNotchPaths.push(line6(xb + NOTCH_X, yNotchStart, xb, yFoldBottom));
|
|
4579
|
+
}
|
|
4580
|
+
}
|
|
4581
|
+
let ci = 0;
|
|
4582
|
+
const sections = [
|
|
4583
|
+
{
|
|
4584
|
+
name: "Partial Outer Edges",
|
|
4585
|
+
color: DEBUG_PALETTE[ci++ % DEBUG_PALETTE.length],
|
|
4586
|
+
paths: [
|
|
4587
|
+
line6(0, 0, 0, yFoldBottom - kulak),
|
|
4588
|
+
line6(0, 0, totalWidth, 0),
|
|
4589
|
+
line6(totalWidth, 0, totalWidth, yFoldBottom)
|
|
4590
|
+
]
|
|
4591
|
+
},
|
|
4592
|
+
{
|
|
4593
|
+
name: "Glue Flap Diagonal",
|
|
4594
|
+
color: DEBUG_PALETTE[ci++ % DEBUG_PALETTE.length],
|
|
4595
|
+
paths: [
|
|
4596
|
+
line6(0, yFoldBottom - kulak, kulak, yFoldBottom)
|
|
4597
|
+
]
|
|
4598
|
+
},
|
|
4599
|
+
{
|
|
4600
|
+
name: "V-Notch Cuts",
|
|
4601
|
+
color: DEBUG_PALETTE[ci++ % DEBUG_PALETTE.length],
|
|
4602
|
+
paths: vNotchPaths
|
|
4603
|
+
},
|
|
4604
|
+
{
|
|
4605
|
+
name: "Bottom Segments",
|
|
4606
|
+
color: DEBUG_PALETTE[ci++ % DEBUG_PALETTE.length],
|
|
4607
|
+
paths: [
|
|
4608
|
+
line6(xFront + NOTCH_X, totalHeight, xSide1 - NOTCH_X, totalHeight),
|
|
4609
|
+
line6(xSide1 + NOTCH_X, totalHeight, xBack - NOTCH_X, totalHeight),
|
|
4610
|
+
line6(xBack + NOTCH_X, totalHeight, xSide2 - NOTCH_X, totalHeight),
|
|
4611
|
+
line6(xSide2 + NOTCH_X, totalHeight, xEnd - NOTCH_X, totalHeight)
|
|
4612
|
+
]
|
|
4613
|
+
},
|
|
4614
|
+
{
|
|
4615
|
+
name: "Front Rope Holes",
|
|
4616
|
+
color: DEBUG_PALETTE[ci++ % DEBUG_PALETTE.length],
|
|
4617
|
+
paths: [
|
|
4618
|
+
circlePath2(frontCx - X / 2, ropeTopY, ROPE_R2),
|
|
4619
|
+
circlePath2(frontCx - X / 2, ropeBotY, ROPE_R2),
|
|
4620
|
+
circlePath2(frontCx + X / 2, ropeTopY, ROPE_R2),
|
|
4621
|
+
circlePath2(frontCx + X / 2, ropeBotY, ROPE_R2)
|
|
4622
|
+
]
|
|
4623
|
+
},
|
|
4624
|
+
{
|
|
4625
|
+
name: "Back Rope Holes",
|
|
4626
|
+
color: DEBUG_PALETTE[ci++ % DEBUG_PALETTE.length],
|
|
4627
|
+
paths: [
|
|
4628
|
+
circlePath2(backCx - X / 2, ropeTopY, ROPE_R2),
|
|
4629
|
+
circlePath2(backCx - X / 2, ropeBotY, ROPE_R2),
|
|
4630
|
+
circlePath2(backCx + X / 2, ropeTopY, ROPE_R2),
|
|
4631
|
+
circlePath2(backCx + X / 2, ropeBotY, ROPE_R2)
|
|
4632
|
+
]
|
|
4633
|
+
}
|
|
4634
|
+
];
|
|
4635
|
+
return { sections, crease, viewBox: { width: totalWidth, height: totalHeight } };
|
|
4636
|
+
}
|
|
3758
4637
|
function generateOuterContour6(attr) {
|
|
3759
4638
|
const { length: A, width: B, height: C, glueArea } = attr;
|
|
3760
|
-
const D = calcD2(C
|
|
4639
|
+
const D = calcD2(C);
|
|
3761
4640
|
const kulak = glueArea ?? calcKulak2(B);
|
|
3762
4641
|
const xFront = kulak;
|
|
3763
4642
|
const xSide1 = kulak + A;
|
|
@@ -3850,7 +4729,7 @@ function contourToPath6(points) {
|
|
|
3850
4729
|
}
|
|
3851
4730
|
function generateDimensions6(attr, unit) {
|
|
3852
4731
|
const { length: A, width: B, height: C, glueArea } = attr;
|
|
3853
|
-
const D = calcD2(C
|
|
4732
|
+
const D = calcD2(C);
|
|
3854
4733
|
const kulak = glueArea ?? calcKulak2(B);
|
|
3855
4734
|
const factor = unit === "cm" ? 0.1 : unit === "in" ? 1 / 25.4 : 1;
|
|
3856
4735
|
const suffix = unit;
|
|
@@ -3859,11 +4738,12 @@ function generateDimensions6(attr, unit) {
|
|
|
3859
4738
|
const xSide1 = kulak + A;
|
|
3860
4739
|
const xBack = kulak + A + B;
|
|
3861
4740
|
const yFoldTop = D;
|
|
4741
|
+
const yFoldBottomStart = D + C - B / 2;
|
|
3862
4742
|
const yFoldBottom = D + C;
|
|
4743
|
+
const yBottomFlap = D + C + B / 2;
|
|
3863
4744
|
const yEnd = D + C + B / 2 + DIP2;
|
|
3864
4745
|
const totalWidth = kulak + 2 * A + 2 * B - 2;
|
|
3865
4746
|
const totalHeight = yEnd;
|
|
3866
|
-
const bottomSection = B / 2 + DIP2;
|
|
3867
4747
|
return [
|
|
3868
4748
|
// Overall dimensions (outside)
|
|
3869
4749
|
{
|
|
@@ -3884,7 +4764,17 @@ function generateDimensions6(attr, unit) {
|
|
|
3884
4764
|
orientation: "vertical",
|
|
3885
4765
|
offset: -12
|
|
3886
4766
|
},
|
|
3887
|
-
//
|
|
4767
|
+
// Top flap (D)
|
|
4768
|
+
{
|
|
4769
|
+
x1: xBack + A * 0.6,
|
|
4770
|
+
y1: 0,
|
|
4771
|
+
x2: xBack + A * 0.6,
|
|
4772
|
+
y2: yFoldTop,
|
|
4773
|
+
label: fmt(D),
|
|
4774
|
+
orientation: "vertical",
|
|
4775
|
+
offset: -10
|
|
4776
|
+
},
|
|
4777
|
+
// Body height (h = C)
|
|
3888
4778
|
{
|
|
3889
4779
|
x1: xBack + A * 0.6,
|
|
3890
4780
|
y1: yFoldTop,
|
|
@@ -3894,23 +4784,33 @@ function generateDimensions6(attr, unit) {
|
|
|
3894
4784
|
orientation: "vertical",
|
|
3895
4785
|
offset: -10
|
|
3896
4786
|
},
|
|
3897
|
-
//
|
|
4787
|
+
// W-fold upper (B/2) — yFoldBottomStart to yFoldBottom
|
|
3898
4788
|
{
|
|
3899
4789
|
x1: xBack + A * 0.6,
|
|
3900
|
-
y1:
|
|
4790
|
+
y1: yFoldBottomStart,
|
|
3901
4791
|
x2: xBack + A * 0.6,
|
|
3902
|
-
y2:
|
|
3903
|
-
label: fmt(
|
|
4792
|
+
y2: yFoldBottom,
|
|
4793
|
+
label: fmt(B / 2),
|
|
3904
4794
|
orientation: "vertical",
|
|
3905
4795
|
offset: -10
|
|
3906
4796
|
},
|
|
3907
|
-
//
|
|
4797
|
+
// W-fold lower (B/2) — yFoldBottom to yBottomFlap
|
|
3908
4798
|
{
|
|
3909
4799
|
x1: xBack + A * 0.6,
|
|
3910
4800
|
y1: yFoldBottom,
|
|
3911
4801
|
x2: xBack + A * 0.6,
|
|
4802
|
+
y2: yBottomFlap,
|
|
4803
|
+
label: fmt(B / 2),
|
|
4804
|
+
orientation: "vertical",
|
|
4805
|
+
offset: -10
|
|
4806
|
+
},
|
|
4807
|
+
// DIP — bottom glue tab
|
|
4808
|
+
{
|
|
4809
|
+
x1: xBack + A * 0.6,
|
|
4810
|
+
y1: yBottomFlap,
|
|
4811
|
+
x2: xBack + A * 0.6,
|
|
3912
4812
|
y2: yEnd,
|
|
3913
|
-
label: fmt(
|
|
4813
|
+
label: fmt(DIP2),
|
|
3914
4814
|
orientation: "vertical",
|
|
3915
4815
|
offset: -10
|
|
3916
4816
|
},
|
|
@@ -4004,7 +4904,8 @@ var DIE_LINE_BECF_12109 = forwardRef(
|
|
|
4004
4904
|
attributes,
|
|
4005
4905
|
unit = "mm",
|
|
4006
4906
|
isShowDimensions = false,
|
|
4007
|
-
renderAs = "svg"
|
|
4907
|
+
renderAs = "svg",
|
|
4908
|
+
debug = false
|
|
4008
4909
|
}, ref) => {
|
|
4009
4910
|
const theme = useMemo(
|
|
4010
4911
|
() => getModelTheme(),
|
|
@@ -4012,6 +4913,10 @@ var DIE_LINE_BECF_12109 = forwardRef(
|
|
|
4012
4913
|
);
|
|
4013
4914
|
const svgRef = useRef(null);
|
|
4014
4915
|
const dieline = useMemo(() => generateBecf12109(attributes), [attributes]);
|
|
4916
|
+
const debugData = useMemo(
|
|
4917
|
+
() => debug ? generateBecf12109DebugSections(attributes) : null,
|
|
4918
|
+
[attributes, debug]
|
|
4919
|
+
);
|
|
4015
4920
|
const dimensions = useMemo(
|
|
4016
4921
|
() => generateDimensions6(attributes, unit),
|
|
4017
4922
|
[attributes, unit]
|
|
@@ -4093,6 +4998,18 @@ var DIE_LINE_BECF_12109 = forwardRef(
|
|
|
4093
4998
|
factor,
|
|
4094
4999
|
theme
|
|
4095
5000
|
});
|
|
5001
|
+
},
|
|
5002
|
+
readyToPrint: async () => {
|
|
5003
|
+
const dimData = generateDimensions6(attributes, unit);
|
|
5004
|
+
return readyToPrintPdf({
|
|
5005
|
+
modelId: MODEL_ID6,
|
|
5006
|
+
dieline,
|
|
5007
|
+
dimensions: dimData,
|
|
5008
|
+
attributes,
|
|
5009
|
+
unit,
|
|
5010
|
+
factor,
|
|
5011
|
+
theme
|
|
5012
|
+
});
|
|
4096
5013
|
}
|
|
4097
5014
|
};
|
|
4098
5015
|
},
|
|
@@ -4103,7 +5020,8 @@ var DIE_LINE_BECF_12109 = forwardRef(
|
|
|
4103
5020
|
const vbY = -padding;
|
|
4104
5021
|
const vbW = dieline.viewBox.width + padding * 2;
|
|
4105
5022
|
const vbH = dieline.viewBox.height + padding * 2;
|
|
4106
|
-
const
|
|
5023
|
+
const debugFontSize = Math.max(3, dieline.viewBox.width / 80);
|
|
5024
|
+
const svgChildren = debug && debugData ? /* @__PURE__ */ jsx(DebugOverlay, { data: debugData, fontSize: debugFontSize }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4107
5025
|
/* @__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}`)) }),
|
|
4108
5026
|
/* @__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}`)) }),
|
|
4109
5027
|
isShowDimensions && /* @__PURE__ */ jsx("g", { id: "dimensions", children: dimensions.map((d, i) => renderDimension6(d, i, getFontDimensionSize())) })
|
|
@@ -4189,6 +5107,7 @@ var CANVAS_BECF_12109 = forwardRef(
|
|
|
4189
5107
|
});
|
|
4190
5108
|
},
|
|
4191
5109
|
exportDimension: () => dieLineRef.current.exportDimension(),
|
|
5110
|
+
readyToPrint: () => dieLineRef.current.readyToPrint(),
|
|
4192
5111
|
resetView: () => canvasRef.current?.resetView(),
|
|
4193
5112
|
fitView: () => canvasRef.current?.fitView()
|
|
4194
5113
|
}), [serializeCanvasSvg, dieline.viewBox.width, dieline.viewBox.height]);
|
|
@@ -4225,9 +5144,9 @@ var DIP3 = 15;
|
|
|
4225
5144
|
var RIBBON_HALF_W = 9;
|
|
4226
5145
|
var RIBBON_DX = 2;
|
|
4227
5146
|
var RIBBON_DY = 2;
|
|
4228
|
-
var
|
|
5147
|
+
var D_MAX = 40;
|
|
4229
5148
|
function calcD3(c, b) {
|
|
4230
|
-
return Math.min(c - 2 - b / 2,
|
|
5149
|
+
return Math.min(c - 2 - b / 2, D_MAX);
|
|
4231
5150
|
}
|
|
4232
5151
|
function calcKulak3(b) {
|
|
4233
5152
|
if (b <= 13) return b - 1;
|
|
@@ -4456,6 +5375,99 @@ function generateDimensions7(attr, unit) {
|
|
|
4456
5375
|
}
|
|
4457
5376
|
];
|
|
4458
5377
|
}
|
|
5378
|
+
function generateBecfC12101DebugSections(attr) {
|
|
5379
|
+
const { length: A, width: B, height: C, glueArea } = attr;
|
|
5380
|
+
const D = calcD3(C, B);
|
|
5381
|
+
const kulak = glueArea ?? calcKulak3(B);
|
|
5382
|
+
const X = calcX3(A);
|
|
5383
|
+
const xFront = kulak;
|
|
5384
|
+
const xSide1 = kulak + A;
|
|
5385
|
+
const xSide1Mid = kulak + A + B / 2;
|
|
5386
|
+
const xBack = kulak + A + B;
|
|
5387
|
+
const xSide2 = kulak + 2 * A + B;
|
|
5388
|
+
const xSide2Mid = kulak + 2 * A + B + B / 2;
|
|
5389
|
+
const xEnd = kulak + 2 * A + 2 * B - 2;
|
|
5390
|
+
const yFoldTop = D;
|
|
5391
|
+
const yFoldBottomStart = D + C - B / 2;
|
|
5392
|
+
const yFoldBottom = D + C;
|
|
5393
|
+
const yBottomFlap = D + C + B / 2;
|
|
5394
|
+
const yEnd = D + C + B / 2 + DIP3;
|
|
5395
|
+
const totalWidth = xEnd;
|
|
5396
|
+
const totalHeight = yEnd;
|
|
5397
|
+
const crease = [];
|
|
5398
|
+
crease.push(line7(0, yFoldTop, totalWidth, yFoldTop));
|
|
5399
|
+
crease.push(line7(0, yFoldBottomStart, totalWidth, yFoldBottomStart));
|
|
5400
|
+
crease.push(line7(0, yFoldBottom, totalWidth, yFoldBottom));
|
|
5401
|
+
crease.push(line7(xFront, 0, xFront, totalHeight));
|
|
5402
|
+
crease.push(line7(xSide1, 0, xSide1, totalHeight));
|
|
5403
|
+
crease.push(line7(xSide1Mid, 0, xSide1Mid, totalHeight));
|
|
5404
|
+
crease.push(line7(xBack, 0, xBack, totalHeight));
|
|
5405
|
+
crease.push(line7(xSide2, 0, xSide2, totalHeight));
|
|
5406
|
+
crease.push(line7(xSide2Mid, 0, xSide2Mid, totalHeight));
|
|
5407
|
+
crease.push(line7(0, yFoldBottom - kulak, kulak + B / 2, yBottomFlap));
|
|
5408
|
+
crease.push(line7(kulak + A - B / 2, yBottomFlap, xSide1Mid, yFoldBottomStart));
|
|
5409
|
+
crease.push(line7(xSide1Mid, yFoldBottomStart, kulak + A + B + B / 2, yBottomFlap));
|
|
5410
|
+
crease.push(line7(kulak + 2 * A + B - B / 2, yBottomFlap, xSide2Mid, yFoldBottomStart));
|
|
5411
|
+
crease.push(line7(xSide2Mid, yFoldBottomStart, xEnd, D + C - 2));
|
|
5412
|
+
const sections = [];
|
|
5413
|
+
let colorIdx = 0;
|
|
5414
|
+
sections.push({
|
|
5415
|
+
name: "Outer Rectangle",
|
|
5416
|
+
color: DEBUG_PALETTE[colorIdx++ % DEBUG_PALETTE.length],
|
|
5417
|
+
paths: [
|
|
5418
|
+
line7(0, 0, totalWidth, 0),
|
|
5419
|
+
line7(totalWidth, 0, totalWidth, totalHeight),
|
|
5420
|
+
line7(totalWidth, totalHeight, 0, totalHeight),
|
|
5421
|
+
line7(0, totalHeight, 0, 0)
|
|
5422
|
+
]
|
|
5423
|
+
});
|
|
5424
|
+
sections.push({
|
|
5425
|
+
name: "Bottom Zone Verticals",
|
|
5426
|
+
color: DEBUG_PALETTE[colorIdx++ % DEBUG_PALETTE.length],
|
|
5427
|
+
paths: [
|
|
5428
|
+
line7(kulak + B / 2, yBottomFlap, kulak + B / 2, yEnd),
|
|
5429
|
+
line7(kulak + A - B / 2, yBottomFlap, kulak + A - B / 2, yEnd),
|
|
5430
|
+
line7(kulak + A + B + B / 2, yBottomFlap, kulak + A + B + B / 2, yEnd),
|
|
5431
|
+
line7(kulak + 2 * A + B - B / 2, yBottomFlap, kulak + 2 * A + B - B / 2, yEnd)
|
|
5432
|
+
]
|
|
5433
|
+
});
|
|
5434
|
+
const frontCx = kulak + A / 2;
|
|
5435
|
+
const yNotchTop = yFoldTop - RIBBON_DY / 2;
|
|
5436
|
+
const yNotchBot = yFoldTop + RIBBON_DY / 2;
|
|
5437
|
+
function ribbonNotchPaths(cx) {
|
|
5438
|
+
return [
|
|
5439
|
+
line7(cx - RIBBON_HALF_W, yNotchBot, cx + RIBBON_HALF_W, yNotchBot),
|
|
5440
|
+
line7(cx - RIBBON_HALF_W - RIBBON_DX, yNotchTop, cx - RIBBON_HALF_W, yNotchBot),
|
|
5441
|
+
line7(cx + RIBBON_HALF_W + RIBBON_DX, yNotchTop, cx + RIBBON_HALF_W, yNotchBot)
|
|
5442
|
+
];
|
|
5443
|
+
}
|
|
5444
|
+
sections.push({
|
|
5445
|
+
name: "Front Left Ribbon",
|
|
5446
|
+
color: DEBUG_PALETTE[colorIdx++ % DEBUG_PALETTE.length],
|
|
5447
|
+
paths: ribbonNotchPaths(frontCx - X / 2)
|
|
5448
|
+
});
|
|
5449
|
+
sections.push({
|
|
5450
|
+
name: "Front Right Ribbon",
|
|
5451
|
+
color: DEBUG_PALETTE[colorIdx++ % DEBUG_PALETTE.length],
|
|
5452
|
+
paths: ribbonNotchPaths(frontCx + X / 2)
|
|
5453
|
+
});
|
|
5454
|
+
const backCx = kulak + A + B + A / 2;
|
|
5455
|
+
sections.push({
|
|
5456
|
+
name: "Back Left Ribbon",
|
|
5457
|
+
color: DEBUG_PALETTE[colorIdx++ % DEBUG_PALETTE.length],
|
|
5458
|
+
paths: ribbonNotchPaths(backCx - X / 2)
|
|
5459
|
+
});
|
|
5460
|
+
sections.push({
|
|
5461
|
+
name: "Back Right Ribbon",
|
|
5462
|
+
color: DEBUG_PALETTE[colorIdx++ % DEBUG_PALETTE.length],
|
|
5463
|
+
paths: ribbonNotchPaths(backCx + X / 2)
|
|
5464
|
+
});
|
|
5465
|
+
return {
|
|
5466
|
+
sections,
|
|
5467
|
+
crease,
|
|
5468
|
+
viewBox: { width: totalWidth, height: totalHeight }
|
|
5469
|
+
};
|
|
5470
|
+
}
|
|
4459
5471
|
var MODEL_ID7 = "BECF-C-12101";
|
|
4460
5472
|
var UNIT_FACTOR7 = {
|
|
4461
5473
|
mm: 1,
|
|
@@ -4514,7 +5526,8 @@ var DIE_LINE_BECF_C_12101 = forwardRef(
|
|
|
4514
5526
|
attributes,
|
|
4515
5527
|
unit = "mm",
|
|
4516
5528
|
isShowDimensions = false,
|
|
4517
|
-
renderAs = "svg"
|
|
5529
|
+
renderAs = "svg",
|
|
5530
|
+
debug = false
|
|
4518
5531
|
}, ref) => {
|
|
4519
5532
|
const theme = useMemo(
|
|
4520
5533
|
() => getModelTheme(),
|
|
@@ -4526,6 +5539,10 @@ var DIE_LINE_BECF_C_12101 = forwardRef(
|
|
|
4526
5539
|
() => generateDimensions7(attributes, unit),
|
|
4527
5540
|
[attributes, unit]
|
|
4528
5541
|
);
|
|
5542
|
+
const debugData = useMemo(
|
|
5543
|
+
() => debug ? generateBecfC12101DebugSections(attributes) : null,
|
|
5544
|
+
[attributes, debug]
|
|
5545
|
+
);
|
|
4529
5546
|
const factor = UNIT_FACTOR7[unit] ?? 1;
|
|
4530
5547
|
const serializeSvg = useCallback(
|
|
4531
5548
|
(showDimensions) => {
|
|
@@ -4604,6 +5621,18 @@ var DIE_LINE_BECF_C_12101 = forwardRef(
|
|
|
4604
5621
|
factor,
|
|
4605
5622
|
theme
|
|
4606
5623
|
});
|
|
5624
|
+
},
|
|
5625
|
+
readyToPrint: async () => {
|
|
5626
|
+
const dimData = generateDimensions7(attributes, unit);
|
|
5627
|
+
return readyToPrintPdf({
|
|
5628
|
+
modelId: MODEL_ID7,
|
|
5629
|
+
dieline,
|
|
5630
|
+
dimensions: dimData,
|
|
5631
|
+
attributes,
|
|
5632
|
+
unit,
|
|
5633
|
+
factor,
|
|
5634
|
+
theme
|
|
5635
|
+
});
|
|
4607
5636
|
}
|
|
4608
5637
|
};
|
|
4609
5638
|
},
|
|
@@ -4614,7 +5643,8 @@ var DIE_LINE_BECF_C_12101 = forwardRef(
|
|
|
4614
5643
|
const vbY = -padding;
|
|
4615
5644
|
const vbW = dieline.viewBox.width + padding * 2;
|
|
4616
5645
|
const vbH = dieline.viewBox.height + padding * 2;
|
|
4617
|
-
const
|
|
5646
|
+
const debugFontSize = Math.max(3, dieline.viewBox.width / 80);
|
|
5647
|
+
const svgChildren = debug && debugData ? /* @__PURE__ */ jsx(DebugOverlay, { data: debugData, fontSize: debugFontSize }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4618
5648
|
/* @__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
5649
|
/* @__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
5650
|
isShowDimensions && /* @__PURE__ */ jsx("g", { id: "dimensions", children: dimensions.map((d, i) => renderDimension7(d, i, getFontDimensionSize())) })
|
|
@@ -4700,6 +5730,7 @@ var CANVAS_BECF_C_12101 = forwardRef(
|
|
|
4700
5730
|
});
|
|
4701
5731
|
},
|
|
4702
5732
|
exportDimension: () => dieLineRef.current.exportDimension(),
|
|
5733
|
+
readyToPrint: () => dieLineRef.current.readyToPrint(),
|
|
4703
5734
|
resetView: () => canvasRef.current?.resetView(),
|
|
4704
5735
|
fitView: () => canvasRef.current?.fitView()
|
|
4705
5736
|
}), [serializeCanvasSvg, dieline.viewBox.width, dieline.viewBox.height]);
|
|
@@ -4736,11 +5767,11 @@ var DIP4 = 13;
|
|
|
4736
5767
|
var RIBBON_HALF_W2 = 9;
|
|
4737
5768
|
var RIBBON_DX2 = 2;
|
|
4738
5769
|
var RIBBON_DY2 = 2;
|
|
4739
|
-
var
|
|
5770
|
+
var D_MAX2 = 40;
|
|
4740
5771
|
var NOTCH_X2 = 3;
|
|
4741
5772
|
var NOTCH_Y2 = 5;
|
|
4742
5773
|
function calcD4(c, b) {
|
|
4743
|
-
return Math.min(c - 2 - b / 2,
|
|
5774
|
+
return Math.min(c - 2 - b / 2, D_MAX2);
|
|
4744
5775
|
}
|
|
4745
5776
|
function calcKulak4(b) {
|
|
4746
5777
|
if (b <= 13) return b - 1;
|
|
@@ -5008,6 +6039,148 @@ function generateDimensions8(attr, unit) {
|
|
|
5008
6039
|
}
|
|
5009
6040
|
];
|
|
5010
6041
|
}
|
|
6042
|
+
function generateBecfC12109DebugSections(attr) {
|
|
6043
|
+
const { length: A, width: B, height: C, glueArea } = attr;
|
|
6044
|
+
const D = calcD4(C, B);
|
|
6045
|
+
const kulak = glueArea ?? calcKulak4(B);
|
|
6046
|
+
const X = calcX4(A);
|
|
6047
|
+
const xFront = kulak;
|
|
6048
|
+
const xSide1 = kulak + A;
|
|
6049
|
+
const xSide1Mid = kulak + A + B / 2;
|
|
6050
|
+
const xBack = kulak + A + B;
|
|
6051
|
+
const xSide2 = kulak + 2 * A + B;
|
|
6052
|
+
const xSide2Mid = kulak + 2 * A + B + B / 2;
|
|
6053
|
+
const xEnd = kulak + 2 * A + 2 * B - 2;
|
|
6054
|
+
const yFoldTop = D;
|
|
6055
|
+
const yFoldBottomStart = D + C - B / 2;
|
|
6056
|
+
const yFoldBottom = D + C;
|
|
6057
|
+
const yNotchStart = yFoldBottom + NOTCH_Y2;
|
|
6058
|
+
const yEnd = D + C + B / 2 + DIP4;
|
|
6059
|
+
const totalWidth = xEnd;
|
|
6060
|
+
const totalHeight = yEnd;
|
|
6061
|
+
const crease = [];
|
|
6062
|
+
crease.push(line8(0, yFoldTop, totalWidth, yFoldTop));
|
|
6063
|
+
crease.push(line8(0, yFoldBottomStart, totalWidth, yFoldBottomStart));
|
|
6064
|
+
crease.push(line8(kulak, yFoldBottom, xEnd, yFoldBottom));
|
|
6065
|
+
crease.push(line8(xFront, 0, xFront, yFoldBottom));
|
|
6066
|
+
crease.push(line8(xSide1, 0, xSide1, yFoldBottom));
|
|
6067
|
+
crease.push(line8(xBack, 0, xBack, yFoldBottom));
|
|
6068
|
+
crease.push(line8(xSide2, 0, xSide2, yFoldBottom));
|
|
6069
|
+
crease.push(line8(xSide1Mid, 0, xSide1Mid, totalHeight));
|
|
6070
|
+
crease.push(line8(xSide2Mid, 0, xSide2Mid, totalHeight));
|
|
6071
|
+
crease.push(line8(xBack, yFoldBottom, xSide1Mid, yFoldBottomStart));
|
|
6072
|
+
crease.push(line8(xSide1Mid, yFoldBottomStart, xSide1, yFoldBottom));
|
|
6073
|
+
crease.push(line8(xSide2Mid, yFoldBottomStart, xSide2, yFoldBottom));
|
|
6074
|
+
crease.push(line8(xSide2Mid, yFoldBottomStart, xEnd, D + C - 2));
|
|
6075
|
+
const sections = [];
|
|
6076
|
+
let colorIdx = 0;
|
|
6077
|
+
sections.push({
|
|
6078
|
+
name: "Outer Edges",
|
|
6079
|
+
color: DEBUG_PALETTE[colorIdx++ % DEBUG_PALETTE.length],
|
|
6080
|
+
paths: [
|
|
6081
|
+
line8(0, 0, totalWidth, 0),
|
|
6082
|
+
line8(0, 0, 0, yFoldBottom - kulak),
|
|
6083
|
+
line8(totalWidth, 0, totalWidth, yFoldBottom)
|
|
6084
|
+
]
|
|
6085
|
+
});
|
|
6086
|
+
sections.push({
|
|
6087
|
+
name: "Glue Flap Diagonal",
|
|
6088
|
+
color: DEBUG_PALETTE[colorIdx++ % DEBUG_PALETTE.length],
|
|
6089
|
+
paths: [line8(0, yFoldBottom - kulak, kulak, yFoldBottom)]
|
|
6090
|
+
});
|
|
6091
|
+
sections.push({
|
|
6092
|
+
name: "V-Notch Front",
|
|
6093
|
+
color: DEBUG_PALETTE[colorIdx++ % DEBUG_PALETTE.length],
|
|
6094
|
+
paths: [
|
|
6095
|
+
line8(xFront + NOTCH_X2, yNotchStart, xFront + NOTCH_X2, totalHeight),
|
|
6096
|
+
line8(xFront + NOTCH_X2, yNotchStart, xFront, yFoldBottom)
|
|
6097
|
+
]
|
|
6098
|
+
});
|
|
6099
|
+
sections.push({
|
|
6100
|
+
name: "V-Notch Side1",
|
|
6101
|
+
color: DEBUG_PALETTE[colorIdx++ % DEBUG_PALETTE.length],
|
|
6102
|
+
paths: [
|
|
6103
|
+
line8(xSide1 - NOTCH_X2, yNotchStart, xSide1 - NOTCH_X2, totalHeight),
|
|
6104
|
+
line8(xSide1 - NOTCH_X2, yNotchStart, xSide1, yFoldBottom),
|
|
6105
|
+
line8(xSide1 + NOTCH_X2, yNotchStart, xSide1 + NOTCH_X2, totalHeight),
|
|
6106
|
+
line8(xSide1 + NOTCH_X2, yNotchStart, xSide1, yFoldBottom)
|
|
6107
|
+
]
|
|
6108
|
+
});
|
|
6109
|
+
sections.push({
|
|
6110
|
+
name: "V-Notch Back",
|
|
6111
|
+
color: DEBUG_PALETTE[colorIdx++ % DEBUG_PALETTE.length],
|
|
6112
|
+
paths: [
|
|
6113
|
+
line8(xBack - NOTCH_X2, yNotchStart, xBack - NOTCH_X2, totalHeight),
|
|
6114
|
+
line8(xBack - NOTCH_X2, yNotchStart, xBack, yFoldBottom),
|
|
6115
|
+
line8(xBack + NOTCH_X2, yNotchStart, xBack + NOTCH_X2, totalHeight),
|
|
6116
|
+
line8(xBack + NOTCH_X2, yNotchStart, xBack, yFoldBottom)
|
|
6117
|
+
]
|
|
6118
|
+
});
|
|
6119
|
+
sections.push({
|
|
6120
|
+
name: "V-Notch Side2",
|
|
6121
|
+
color: DEBUG_PALETTE[colorIdx++ % DEBUG_PALETTE.length],
|
|
6122
|
+
paths: [
|
|
6123
|
+
line8(xSide2 - NOTCH_X2, yNotchStart, xSide2 - NOTCH_X2, totalHeight),
|
|
6124
|
+
line8(xSide2 - NOTCH_X2, yNotchStart, xSide2, yFoldBottom),
|
|
6125
|
+
line8(xSide2 + NOTCH_X2, yNotchStart, xSide2 + NOTCH_X2, totalHeight),
|
|
6126
|
+
line8(xSide2 + NOTCH_X2, yNotchStart, xSide2, yFoldBottom)
|
|
6127
|
+
]
|
|
6128
|
+
});
|
|
6129
|
+
sections.push({
|
|
6130
|
+
name: "V-Notch End",
|
|
6131
|
+
color: DEBUG_PALETTE[colorIdx++ % DEBUG_PALETTE.length],
|
|
6132
|
+
paths: [
|
|
6133
|
+
line8(xEnd - NOTCH_X2, yNotchStart, xEnd - NOTCH_X2, totalHeight),
|
|
6134
|
+
line8(xEnd - NOTCH_X2, yNotchStart, xEnd, yFoldBottom)
|
|
6135
|
+
]
|
|
6136
|
+
});
|
|
6137
|
+
sections.push({
|
|
6138
|
+
name: "Bottom Segments",
|
|
6139
|
+
color: DEBUG_PALETTE[colorIdx++ % DEBUG_PALETTE.length],
|
|
6140
|
+
paths: [
|
|
6141
|
+
line8(xFront + NOTCH_X2, totalHeight, xSide1 - NOTCH_X2, totalHeight),
|
|
6142
|
+
line8(xSide1 + NOTCH_X2, totalHeight, xBack - NOTCH_X2, totalHeight),
|
|
6143
|
+
line8(xBack + NOTCH_X2, totalHeight, xSide2 - NOTCH_X2, totalHeight),
|
|
6144
|
+
line8(xSide2 + NOTCH_X2, totalHeight, xEnd - NOTCH_X2, totalHeight)
|
|
6145
|
+
]
|
|
6146
|
+
});
|
|
6147
|
+
const frontCx = kulak + A / 2;
|
|
6148
|
+
const backCx = kulak + A + B + A / 2;
|
|
6149
|
+
const yRibbonTop = yFoldTop - RIBBON_DY2 / 2;
|
|
6150
|
+
const yRibbonBot = yFoldTop + RIBBON_DY2 / 2;
|
|
6151
|
+
function ribbonNotchPaths(cx) {
|
|
6152
|
+
return [
|
|
6153
|
+
line8(cx - RIBBON_HALF_W2, yRibbonBot, cx + RIBBON_HALF_W2, yRibbonBot),
|
|
6154
|
+
line8(cx - RIBBON_HALF_W2 - RIBBON_DX2, yRibbonTop, cx - RIBBON_HALF_W2, yRibbonBot),
|
|
6155
|
+
line8(cx + RIBBON_HALF_W2 + RIBBON_DX2, yRibbonTop, cx + RIBBON_HALF_W2, yRibbonBot)
|
|
6156
|
+
];
|
|
6157
|
+
}
|
|
6158
|
+
sections.push({
|
|
6159
|
+
name: "Front Left Ribbon",
|
|
6160
|
+
color: DEBUG_PALETTE[colorIdx++ % DEBUG_PALETTE.length],
|
|
6161
|
+
paths: ribbonNotchPaths(frontCx - X / 2)
|
|
6162
|
+
});
|
|
6163
|
+
sections.push({
|
|
6164
|
+
name: "Front Right Ribbon",
|
|
6165
|
+
color: DEBUG_PALETTE[colorIdx++ % DEBUG_PALETTE.length],
|
|
6166
|
+
paths: ribbonNotchPaths(frontCx + X / 2)
|
|
6167
|
+
});
|
|
6168
|
+
sections.push({
|
|
6169
|
+
name: "Back Left Ribbon",
|
|
6170
|
+
color: DEBUG_PALETTE[colorIdx++ % DEBUG_PALETTE.length],
|
|
6171
|
+
paths: ribbonNotchPaths(backCx - X / 2)
|
|
6172
|
+
});
|
|
6173
|
+
sections.push({
|
|
6174
|
+
name: "Back Right Ribbon",
|
|
6175
|
+
color: DEBUG_PALETTE[colorIdx++ % DEBUG_PALETTE.length],
|
|
6176
|
+
paths: ribbonNotchPaths(backCx + X / 2)
|
|
6177
|
+
});
|
|
6178
|
+
return {
|
|
6179
|
+
sections,
|
|
6180
|
+
crease,
|
|
6181
|
+
viewBox: { width: totalWidth, height: totalHeight }
|
|
6182
|
+
};
|
|
6183
|
+
}
|
|
5011
6184
|
var MODEL_ID8 = "BECF-C-12109";
|
|
5012
6185
|
var UNIT_FACTOR8 = {
|
|
5013
6186
|
mm: 1,
|
|
@@ -5066,7 +6239,8 @@ var DIE_LINE_BECF_C_12109 = forwardRef(
|
|
|
5066
6239
|
attributes,
|
|
5067
6240
|
unit = "mm",
|
|
5068
6241
|
isShowDimensions = false,
|
|
5069
|
-
renderAs = "svg"
|
|
6242
|
+
renderAs = "svg",
|
|
6243
|
+
debug = false
|
|
5070
6244
|
}, ref) => {
|
|
5071
6245
|
const theme = useMemo(
|
|
5072
6246
|
() => getModelTheme(),
|
|
@@ -5078,6 +6252,10 @@ var DIE_LINE_BECF_C_12109 = forwardRef(
|
|
|
5078
6252
|
() => generateDimensions8(attributes, unit),
|
|
5079
6253
|
[attributes, unit]
|
|
5080
6254
|
);
|
|
6255
|
+
const debugData = useMemo(
|
|
6256
|
+
() => debug ? generateBecfC12109DebugSections(attributes) : null,
|
|
6257
|
+
[attributes, debug]
|
|
6258
|
+
);
|
|
5081
6259
|
const factor = UNIT_FACTOR8[unit] ?? 1;
|
|
5082
6260
|
const serializeSvg = useCallback(
|
|
5083
6261
|
(showDimensions) => {
|
|
@@ -5156,6 +6334,18 @@ var DIE_LINE_BECF_C_12109 = forwardRef(
|
|
|
5156
6334
|
factor,
|
|
5157
6335
|
theme
|
|
5158
6336
|
});
|
|
6337
|
+
},
|
|
6338
|
+
readyToPrint: async () => {
|
|
6339
|
+
const dimData = generateDimensions8(attributes, unit);
|
|
6340
|
+
return readyToPrintPdf({
|
|
6341
|
+
modelId: MODEL_ID8,
|
|
6342
|
+
dieline,
|
|
6343
|
+
dimensions: dimData,
|
|
6344
|
+
attributes,
|
|
6345
|
+
unit,
|
|
6346
|
+
factor,
|
|
6347
|
+
theme
|
|
6348
|
+
});
|
|
5159
6349
|
}
|
|
5160
6350
|
};
|
|
5161
6351
|
},
|
|
@@ -5166,7 +6356,8 @@ var DIE_LINE_BECF_C_12109 = forwardRef(
|
|
|
5166
6356
|
const vbY = -padding;
|
|
5167
6357
|
const vbW = dieline.viewBox.width + padding * 2;
|
|
5168
6358
|
const vbH = dieline.viewBox.height + padding * 2;
|
|
5169
|
-
const
|
|
6359
|
+
const debugFontSize = Math.max(3, dieline.viewBox.width / 80);
|
|
6360
|
+
const svgChildren = debug && debugData ? /* @__PURE__ */ jsx(DebugOverlay, { data: debugData, fontSize: debugFontSize }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
5170
6361
|
/* @__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
6362
|
/* @__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
6363
|
isShowDimensions && /* @__PURE__ */ jsx("g", { id: "dimensions", children: dimensions.map((d, i) => renderDimension8(d, i, getFontDimensionSize())) })
|
|
@@ -5252,6 +6443,7 @@ var CANVAS_BECF_C_12109 = forwardRef(
|
|
|
5252
6443
|
});
|
|
5253
6444
|
},
|
|
5254
6445
|
exportDimension: () => dieLineRef.current.exportDimension(),
|
|
6446
|
+
readyToPrint: () => dieLineRef.current.readyToPrint(),
|
|
5255
6447
|
resetView: () => canvasRef.current?.resetView(),
|
|
5256
6448
|
fitView: () => canvasRef.current?.fitView()
|
|
5257
6449
|
}), [serializeCanvasSvg, dieline.viewBox.width, dieline.viewBox.height]);
|
|
@@ -5341,6 +6533,61 @@ function generateBecfB12101(attr) {
|
|
|
5341
6533
|
crease.push(line9(xSide2Mid, yFoldBottomStart, xEnd, C - 2));
|
|
5342
6534
|
return { cut, crease, viewBox: { width: totalWidth, height: totalHeight } };
|
|
5343
6535
|
}
|
|
6536
|
+
function generateBecfB12101DebugSections(attr) {
|
|
6537
|
+
const { length: A, width: B, height: C, glueArea } = attr;
|
|
6538
|
+
const kulak = glueArea ?? calcKulak5(B);
|
|
6539
|
+
const xFront = kulak;
|
|
6540
|
+
const xSide1 = kulak + A;
|
|
6541
|
+
const xSide1Mid = kulak + A + B / 2;
|
|
6542
|
+
const xBack = kulak + A + B;
|
|
6543
|
+
const xSide2 = kulak + 2 * A + B;
|
|
6544
|
+
const xSide2Mid = kulak + 2 * A + B + B / 2;
|
|
6545
|
+
const xEnd = kulak + 2 * A + 2 * B - 2;
|
|
6546
|
+
const yFoldBottomStart = C - B / 2;
|
|
6547
|
+
const yFoldBottom = C;
|
|
6548
|
+
const yBottomFlap = C + B / 2;
|
|
6549
|
+
const yEnd = C + B / 2 + DIP5;
|
|
6550
|
+
const totalWidth = xEnd;
|
|
6551
|
+
const totalHeight = yEnd;
|
|
6552
|
+
const crease = [];
|
|
6553
|
+
crease.push(line9(0, yFoldBottomStart, totalWidth, yFoldBottomStart));
|
|
6554
|
+
crease.push(line9(0, yFoldBottom, totalWidth, yFoldBottom));
|
|
6555
|
+
crease.push(line9(xFront, 0, xFront, totalHeight));
|
|
6556
|
+
crease.push(line9(xSide1, 0, xSide1, totalHeight));
|
|
6557
|
+
crease.push(line9(xSide1Mid, 0, xSide1Mid, totalHeight));
|
|
6558
|
+
crease.push(line9(xBack, 0, xBack, totalHeight));
|
|
6559
|
+
crease.push(line9(xSide2, 0, xSide2, totalHeight));
|
|
6560
|
+
crease.push(line9(xSide2Mid, 0, xSide2Mid, totalHeight));
|
|
6561
|
+
crease.push(line9(0, yFoldBottom - kulak, kulak + B / 2, yBottomFlap));
|
|
6562
|
+
crease.push(line9(kulak + A - B / 2, yBottomFlap, xSide1Mid, yFoldBottomStart));
|
|
6563
|
+
crease.push(line9(xSide1Mid, yFoldBottomStart, kulak + A + B + B / 2, yBottomFlap));
|
|
6564
|
+
crease.push(line9(kulak + 2 * A + B - B / 2, yBottomFlap, xSide2Mid, yFoldBottomStart));
|
|
6565
|
+
crease.push(line9(xSide2Mid, yFoldBottomStart, xEnd, C - 2));
|
|
6566
|
+
let ci = 0;
|
|
6567
|
+
const sections = [
|
|
6568
|
+
{
|
|
6569
|
+
name: "Outer Rect",
|
|
6570
|
+
color: DEBUG_PALETTE[ci++ % DEBUG_PALETTE.length],
|
|
6571
|
+
paths: [
|
|
6572
|
+
line9(0, 0, totalWidth, 0),
|
|
6573
|
+
line9(totalWidth, 0, totalWidth, totalHeight),
|
|
6574
|
+
line9(totalWidth, totalHeight, 0, totalHeight),
|
|
6575
|
+
line9(0, totalHeight, 0, 0)
|
|
6576
|
+
]
|
|
6577
|
+
},
|
|
6578
|
+
{
|
|
6579
|
+
name: "Bottom Zone Cuts",
|
|
6580
|
+
color: DEBUG_PALETTE[ci++ % DEBUG_PALETTE.length],
|
|
6581
|
+
paths: [
|
|
6582
|
+
line9(kulak + B / 2, yBottomFlap, kulak + B / 2, yEnd),
|
|
6583
|
+
line9(kulak + A - B / 2, yBottomFlap, kulak + A - B / 2, yEnd),
|
|
6584
|
+
line9(kulak + A + B + B / 2, yBottomFlap, kulak + A + B + B / 2, yEnd),
|
|
6585
|
+
line9(kulak + 2 * A + B - B / 2, yBottomFlap, kulak + 2 * A + B - B / 2, yEnd)
|
|
6586
|
+
]
|
|
6587
|
+
}
|
|
6588
|
+
];
|
|
6589
|
+
return { sections, crease, viewBox: { width: totalWidth, height: totalHeight } };
|
|
6590
|
+
}
|
|
5344
6591
|
function generateOuterContour9(attr) {
|
|
5345
6592
|
const { length: A, width: B, height: C, glueArea } = attr;
|
|
5346
6593
|
const kulak = glueArea ?? calcKulak5(B);
|
|
@@ -5513,10 +6760,14 @@ function renderDimension9(dim, i, fs) {
|
|
|
5513
6760
|
] }, `dim-${i}`);
|
|
5514
6761
|
}
|
|
5515
6762
|
var DIE_LINE_BECF_B_12101 = forwardRef(
|
|
5516
|
-
({ attributes, unit = "mm", isShowDimensions = false, renderAs = "svg" }, ref) => {
|
|
6763
|
+
({ attributes, unit = "mm", isShowDimensions = false, renderAs = "svg", debug = false }, ref) => {
|
|
5517
6764
|
const theme = useMemo(() => getModelTheme(), []);
|
|
5518
6765
|
const svgRef = useRef(null);
|
|
5519
6766
|
const dieline = useMemo(() => generateBecfB12101(attributes), [attributes]);
|
|
6767
|
+
const debugData = useMemo(
|
|
6768
|
+
() => debug ? generateBecfB12101DebugSections(attributes) : null,
|
|
6769
|
+
[attributes, debug]
|
|
6770
|
+
);
|
|
5520
6771
|
const dimensions = useMemo(() => generateDimensions9(attributes, unit), [attributes, unit]);
|
|
5521
6772
|
const factor = UNIT_FACTOR9[unit] ?? 1;
|
|
5522
6773
|
const serializeSvg = useCallback((showDimensions) => {
|
|
@@ -5572,6 +6823,10 @@ var DIE_LINE_BECF_B_12101 = forwardRef(
|
|
|
5572
6823
|
exportDimension: async () => {
|
|
5573
6824
|
const dimData = generateDimensions9(attributes, unit);
|
|
5574
6825
|
return exportDimensionPdf({ modelId: MODEL_ID9, dieline, dimensions: dimData, attributes, unit, factor, theme });
|
|
6826
|
+
},
|
|
6827
|
+
readyToPrint: async () => {
|
|
6828
|
+
const dimData = generateDimensions9(attributes, unit);
|
|
6829
|
+
return readyToPrintPdf({ modelId: MODEL_ID9, dieline, dimensions: dimData, attributes, unit, factor, theme });
|
|
5575
6830
|
}
|
|
5576
6831
|
};
|
|
5577
6832
|
}, [attributes, dieline, factor, unit, serializeSvg, theme]);
|
|
@@ -5580,7 +6835,8 @@ var DIE_LINE_BECF_B_12101 = forwardRef(
|
|
|
5580
6835
|
const vbY = -padding;
|
|
5581
6836
|
const vbW = dieline.viewBox.width + padding * 2;
|
|
5582
6837
|
const vbH = dieline.viewBox.height + padding * 2;
|
|
5583
|
-
const
|
|
6838
|
+
const debugFontSize = Math.max(3, dieline.viewBox.width / 80);
|
|
6839
|
+
const svgChildren = debug && debugData ? /* @__PURE__ */ jsx(DebugOverlay, { data: debugData, fontSize: debugFontSize }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
5584
6840
|
/* @__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
6841
|
/* @__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
6842
|
isShowDimensions && /* @__PURE__ */ jsx("g", { id: "dimensions", children: dimensions.map((d, i) => renderDimension9(d, i, getFontDimensionSize())) })
|
|
@@ -5637,6 +6893,7 @@ var CANVAS_BECF_B_12101 = forwardRef(
|
|
|
5637
6893
|
});
|
|
5638
6894
|
},
|
|
5639
6895
|
exportDimension: () => dieLineRef.current.exportDimension(),
|
|
6896
|
+
readyToPrint: () => dieLineRef.current.readyToPrint(),
|
|
5640
6897
|
resetView: () => canvasRef.current?.resetView(),
|
|
5641
6898
|
fitView: () => canvasRef.current?.fitView()
|
|
5642
6899
|
}), [serializeCanvasSvg, dieline.viewBox.width, dieline.viewBox.height]);
|
|
@@ -5896,6 +7153,113 @@ function generateDimensions10(attr, unit) {
|
|
|
5896
7153
|
}
|
|
5897
7154
|
];
|
|
5898
7155
|
}
|
|
7156
|
+
function generateBecfB12109DebugSections(attr) {
|
|
7157
|
+
const { length: A, width: B, height: C, glueArea } = attr;
|
|
7158
|
+
const kulak = glueArea ?? calcKulak6(B);
|
|
7159
|
+
const xFront = kulak;
|
|
7160
|
+
const xSide1 = kulak + A;
|
|
7161
|
+
const xSide1Mid = kulak + A + B / 2;
|
|
7162
|
+
const xBack = kulak + A + B;
|
|
7163
|
+
const xSide2 = kulak + 2 * A + B;
|
|
7164
|
+
const xSide2Mid = kulak + 2 * A + B + B / 2;
|
|
7165
|
+
const xEnd = kulak + 2 * A + 2 * B - 2;
|
|
7166
|
+
const yFoldBottomStart = C - B / 2;
|
|
7167
|
+
const yFoldBottom = C;
|
|
7168
|
+
const yNotchStart = yFoldBottom + NOTCH_Y3;
|
|
7169
|
+
const yEnd = C + B / 2 + DIP6;
|
|
7170
|
+
const totalWidth = xEnd;
|
|
7171
|
+
const totalHeight = yEnd;
|
|
7172
|
+
const crease = [];
|
|
7173
|
+
crease.push(line10(0, yFoldBottomStart, totalWidth, yFoldBottomStart));
|
|
7174
|
+
crease.push(line10(kulak, yFoldBottom, xEnd, yFoldBottom));
|
|
7175
|
+
crease.push(line10(xFront, 0, xFront, yFoldBottom));
|
|
7176
|
+
crease.push(line10(xSide1, 0, xSide1, yFoldBottom));
|
|
7177
|
+
crease.push(line10(xBack, 0, xBack, yFoldBottom));
|
|
7178
|
+
crease.push(line10(xSide2, 0, xSide2, yFoldBottom));
|
|
7179
|
+
crease.push(line10(xSide1Mid, 0, xSide1Mid, totalHeight));
|
|
7180
|
+
crease.push(line10(xSide2Mid, 0, xSide2Mid, totalHeight));
|
|
7181
|
+
crease.push(line10(xBack, yFoldBottom, xSide1Mid, yFoldBottomStart));
|
|
7182
|
+
crease.push(line10(xSide1Mid, yFoldBottomStart, xSide1, yFoldBottom));
|
|
7183
|
+
crease.push(line10(xSide2Mid, yFoldBottomStart, xSide2, yFoldBottom));
|
|
7184
|
+
crease.push(line10(xSide2Mid, yFoldBottomStart, xEnd, C - 2));
|
|
7185
|
+
const sections = [];
|
|
7186
|
+
let colorIdx = 0;
|
|
7187
|
+
sections.push({
|
|
7188
|
+
name: "Outer Edges",
|
|
7189
|
+
color: DEBUG_PALETTE[colorIdx++ % DEBUG_PALETTE.length],
|
|
7190
|
+
paths: [
|
|
7191
|
+
line10(0, 0, totalWidth, 0),
|
|
7192
|
+
line10(0, 0, 0, yFoldBottom - kulak),
|
|
7193
|
+
line10(totalWidth, 0, totalWidth, yFoldBottom)
|
|
7194
|
+
]
|
|
7195
|
+
});
|
|
7196
|
+
sections.push({
|
|
7197
|
+
name: "Glue Flap Diagonal",
|
|
7198
|
+
color: DEBUG_PALETTE[colorIdx++ % DEBUG_PALETTE.length],
|
|
7199
|
+
paths: [line10(0, yFoldBottom - kulak, kulak, yFoldBottom)]
|
|
7200
|
+
});
|
|
7201
|
+
sections.push({
|
|
7202
|
+
name: "V-Notch Front",
|
|
7203
|
+
color: DEBUG_PALETTE[colorIdx++ % DEBUG_PALETTE.length],
|
|
7204
|
+
paths: [
|
|
7205
|
+
line10(xFront + NOTCH_X3, yNotchStart, xFront + NOTCH_X3, totalHeight),
|
|
7206
|
+
line10(xFront + NOTCH_X3, yNotchStart, xFront, yFoldBottom)
|
|
7207
|
+
]
|
|
7208
|
+
});
|
|
7209
|
+
sections.push({
|
|
7210
|
+
name: "V-Notch Side1",
|
|
7211
|
+
color: DEBUG_PALETTE[colorIdx++ % DEBUG_PALETTE.length],
|
|
7212
|
+
paths: [
|
|
7213
|
+
line10(xSide1 - NOTCH_X3, yNotchStart, xSide1 - NOTCH_X3, totalHeight),
|
|
7214
|
+
line10(xSide1 - NOTCH_X3, yNotchStart, xSide1, yFoldBottom),
|
|
7215
|
+
line10(xSide1 + NOTCH_X3, yNotchStart, xSide1 + NOTCH_X3, totalHeight),
|
|
7216
|
+
line10(xSide1 + NOTCH_X3, yNotchStart, xSide1, yFoldBottom)
|
|
7217
|
+
]
|
|
7218
|
+
});
|
|
7219
|
+
sections.push({
|
|
7220
|
+
name: "V-Notch Back",
|
|
7221
|
+
color: DEBUG_PALETTE[colorIdx++ % DEBUG_PALETTE.length],
|
|
7222
|
+
paths: [
|
|
7223
|
+
line10(xBack - NOTCH_X3, yNotchStart, xBack - NOTCH_X3, totalHeight),
|
|
7224
|
+
line10(xBack - NOTCH_X3, yNotchStart, xBack, yFoldBottom),
|
|
7225
|
+
line10(xBack + NOTCH_X3, yNotchStart, xBack + NOTCH_X3, totalHeight),
|
|
7226
|
+
line10(xBack + NOTCH_X3, yNotchStart, xBack, yFoldBottom)
|
|
7227
|
+
]
|
|
7228
|
+
});
|
|
7229
|
+
sections.push({
|
|
7230
|
+
name: "V-Notch Side2",
|
|
7231
|
+
color: DEBUG_PALETTE[colorIdx++ % DEBUG_PALETTE.length],
|
|
7232
|
+
paths: [
|
|
7233
|
+
line10(xSide2 - NOTCH_X3, yNotchStart, xSide2 - NOTCH_X3, totalHeight),
|
|
7234
|
+
line10(xSide2 - NOTCH_X3, yNotchStart, xSide2, yFoldBottom),
|
|
7235
|
+
line10(xSide2 + NOTCH_X3, yNotchStart, xSide2 + NOTCH_X3, totalHeight),
|
|
7236
|
+
line10(xSide2 + NOTCH_X3, yNotchStart, xSide2, yFoldBottom)
|
|
7237
|
+
]
|
|
7238
|
+
});
|
|
7239
|
+
sections.push({
|
|
7240
|
+
name: "V-Notch End",
|
|
7241
|
+
color: DEBUG_PALETTE[colorIdx++ % DEBUG_PALETTE.length],
|
|
7242
|
+
paths: [
|
|
7243
|
+
line10(xEnd - NOTCH_X3, yNotchStart, xEnd - NOTCH_X3, totalHeight),
|
|
7244
|
+
line10(xEnd - NOTCH_X3, yNotchStart, xEnd, yFoldBottom)
|
|
7245
|
+
]
|
|
7246
|
+
});
|
|
7247
|
+
sections.push({
|
|
7248
|
+
name: "Bottom Segments",
|
|
7249
|
+
color: DEBUG_PALETTE[colorIdx++ % DEBUG_PALETTE.length],
|
|
7250
|
+
paths: [
|
|
7251
|
+
line10(xFront + NOTCH_X3, totalHeight, xSide1 - NOTCH_X3, totalHeight),
|
|
7252
|
+
line10(xSide1 + NOTCH_X3, totalHeight, xBack - NOTCH_X3, totalHeight),
|
|
7253
|
+
line10(xBack + NOTCH_X3, totalHeight, xSide2 - NOTCH_X3, totalHeight),
|
|
7254
|
+
line10(xSide2 + NOTCH_X3, totalHeight, xEnd - NOTCH_X3, totalHeight)
|
|
7255
|
+
]
|
|
7256
|
+
});
|
|
7257
|
+
return {
|
|
7258
|
+
sections,
|
|
7259
|
+
crease,
|
|
7260
|
+
viewBox: { width: totalWidth, height: totalHeight }
|
|
7261
|
+
};
|
|
7262
|
+
}
|
|
5899
7263
|
var MODEL_ID10 = "BECF-B-12109";
|
|
5900
7264
|
var UNIT_FACTOR10 = {
|
|
5901
7265
|
mm: 1,
|
|
@@ -5926,11 +7290,15 @@ function renderDimension10(dim, i, fs) {
|
|
|
5926
7290
|
] }, `dim-${i}`);
|
|
5927
7291
|
}
|
|
5928
7292
|
var DIE_LINE_BECF_B_12109 = forwardRef(
|
|
5929
|
-
({ attributes, unit = "mm", isShowDimensions = false, renderAs = "svg" }, ref) => {
|
|
7293
|
+
({ attributes, unit = "mm", isShowDimensions = false, renderAs = "svg", debug = false }, ref) => {
|
|
5930
7294
|
const theme = useMemo(() => getModelTheme(), []);
|
|
5931
7295
|
const svgRef = useRef(null);
|
|
5932
7296
|
const dieline = useMemo(() => generateBecfB12109(attributes), [attributes]);
|
|
5933
7297
|
const dimensions = useMemo(() => generateDimensions10(attributes, unit), [attributes, unit]);
|
|
7298
|
+
const debugData = useMemo(
|
|
7299
|
+
() => debug ? generateBecfB12109DebugSections(attributes) : null,
|
|
7300
|
+
[attributes, debug]
|
|
7301
|
+
);
|
|
5934
7302
|
const factor = UNIT_FACTOR10[unit] ?? 1;
|
|
5935
7303
|
const serializeSvg = useCallback((showDimensions) => {
|
|
5936
7304
|
const svg = svgRef.current;
|
|
@@ -5985,6 +7353,10 @@ var DIE_LINE_BECF_B_12109 = forwardRef(
|
|
|
5985
7353
|
exportDimension: async () => {
|
|
5986
7354
|
const dimData = generateDimensions10(attributes, unit);
|
|
5987
7355
|
return exportDimensionPdf({ modelId: MODEL_ID10, dieline, dimensions: dimData, attributes, unit, factor, theme });
|
|
7356
|
+
},
|
|
7357
|
+
readyToPrint: async () => {
|
|
7358
|
+
const dimData = generateDimensions10(attributes, unit);
|
|
7359
|
+
return readyToPrintPdf({ modelId: MODEL_ID10, dieline, dimensions: dimData, attributes, unit, factor, theme });
|
|
5988
7360
|
}
|
|
5989
7361
|
};
|
|
5990
7362
|
}, [attributes, dieline, factor, unit, serializeSvg, theme]);
|
|
@@ -5993,7 +7365,8 @@ var DIE_LINE_BECF_B_12109 = forwardRef(
|
|
|
5993
7365
|
const vbY = -padding;
|
|
5994
7366
|
const vbW = dieline.viewBox.width + padding * 2;
|
|
5995
7367
|
const vbH = dieline.viewBox.height + padding * 2;
|
|
5996
|
-
const
|
|
7368
|
+
const debugFontSize = Math.max(3, dieline.viewBox.width / 80);
|
|
7369
|
+
const svgChildren = debug && debugData ? /* @__PURE__ */ jsx(DebugOverlay, { data: debugData, fontSize: debugFontSize }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
5997
7370
|
/* @__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
7371
|
/* @__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
7372
|
isShowDimensions && /* @__PURE__ */ jsx("g", { id: "dimensions", children: dimensions.map((d, i) => renderDimension10(d, i, getFontDimensionSize())) })
|
|
@@ -6050,6 +7423,7 @@ var CANVAS_BECF_B_12109 = forwardRef(
|
|
|
6050
7423
|
});
|
|
6051
7424
|
},
|
|
6052
7425
|
exportDimension: () => dieLineRef.current.exportDimension(),
|
|
7426
|
+
readyToPrint: () => dieLineRef.current.readyToPrint(),
|
|
6053
7427
|
resetView: () => canvasRef.current?.resetView(),
|
|
6054
7428
|
fitView: () => canvasRef.current?.fitView()
|
|
6055
7429
|
}), [serializeCanvasSvg, dieline.viewBox.width, dieline.viewBox.height]);
|
|
@@ -6081,31 +7455,22 @@ var TAPER = Math.tan(15 * Math.PI / 180);
|
|
|
6081
7455
|
var TAB_W = 8;
|
|
6082
7456
|
var CORNER = 3;
|
|
6083
7457
|
var NOTCH = 10;
|
|
6084
|
-
function
|
|
6085
|
-
|
|
6086
|
-
|
|
6087
|
-
if (b < 500) return 20;
|
|
6088
|
-
return 25;
|
|
7458
|
+
function calcDil(a, b) {
|
|
7459
|
+
const step = Math.max(0, Math.floor((a + b - 250) / 50));
|
|
7460
|
+
return Math.min(b - 1, 15 + 2.5 * step);
|
|
6089
7461
|
}
|
|
6090
|
-
function
|
|
6091
|
-
|
|
6092
|
-
return Math.max(9, Math.min(a / 2, b - 1, c / 2, base));
|
|
7462
|
+
function calcFlap(b, dil) {
|
|
7463
|
+
return Math.min(dil / 2 + b / 2 - 0.5, b / 2);
|
|
6093
7464
|
}
|
|
6094
7465
|
function calcDip(b) {
|
|
6095
|
-
if (b
|
|
6096
|
-
|
|
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;
|
|
7466
|
+
if (b < 30) return Math.max(9, b * 0.3 + 3);
|
|
7467
|
+
return Math.max(12, Math.min(20, Math.floor(b / 6)));
|
|
6104
7468
|
}
|
|
6105
7469
|
function generateBecf10a0a(attr) {
|
|
6106
|
-
const { length: A, width: B, height: C } = attr;
|
|
6107
|
-
const kulak =
|
|
6108
|
-
const dil = calcDil(A, B
|
|
7470
|
+
const { length: A, width: B, height: C, glueArea } = attr;
|
|
7471
|
+
const kulak = glueArea;
|
|
7472
|
+
const dil = calcDil(A, B);
|
|
7473
|
+
const flap = calcFlap(B, dil);
|
|
6109
7474
|
const dip = calcDip(B);
|
|
6110
7475
|
const glueTaper = kulak * TAPER;
|
|
6111
7476
|
const tuckH = B / 2 + ARC_R4;
|
|
@@ -6120,9 +7485,9 @@ function generateBecf10a0a(attr) {
|
|
|
6120
7485
|
const yTuckFlapTop = B + dil - 1 - tuckH;
|
|
6121
7486
|
const yFoldTop = B + dil - 1;
|
|
6122
7487
|
const yFoldBottom = yFoldTop + C;
|
|
6123
|
-
const
|
|
6124
|
-
const ySideBottom = yFoldBottom +
|
|
6125
|
-
const yBottom = yFoldBottom +
|
|
7488
|
+
const yFoldBottomFlap = yFoldBottom + flap;
|
|
7489
|
+
const ySideBottom = yFoldBottom + flap + dip + SNAP_R;
|
|
7490
|
+
const yBottom = yFoldBottom + flap + dip + SNAP_R;
|
|
6126
7491
|
const totalWidth = xEnd;
|
|
6127
7492
|
const totalHeight = yBottom;
|
|
6128
7493
|
const cut = [];
|
|
@@ -6161,10 +7526,10 @@ function generateBecf10a0a(attr) {
|
|
|
6161
7526
|
cut.push(...lockTab(xBack, xSide2, yTop, yTuckTop, yLockCrease, yFoldTop));
|
|
6162
7527
|
cut.push(...side1TuckFlap(xSide1, xBack, yFoldTop, yTuckFlapTop, tuckH));
|
|
6163
7528
|
cut.push(...side2TuckFlap(xSide2, xEnd, yFoldTop, yTuckFlapTop, tuckH));
|
|
6164
|
-
cut.push(...frontPanelBottom(xFront, xSide1, A, yFoldBottom,
|
|
6165
|
-
cut.push(...backPanelBottom(xBack, xSide2, A, yFoldBottom,
|
|
6166
|
-
cut.push(...side1Bottom(xSide1, xBack, B,
|
|
6167
|
-
cut.push(...side2Bottom(xSide2, xEnd, B,
|
|
7529
|
+
cut.push(...frontPanelBottom(xFront, xSide1, A, B, yFoldBottom, yFoldBottomFlap, yBottom, dip));
|
|
7530
|
+
cut.push(...backPanelBottom(xBack, xSide2, A, B, yFoldBottom, yFoldBottomFlap, yBottom, ySideBottom, dip));
|
|
7531
|
+
cut.push(...side1Bottom(xSide1, xBack, B, flap, yFoldBottom, ySideBottom, dip));
|
|
7532
|
+
cut.push(...side2Bottom(xSide2, xEnd, B, flap, yFoldBottom, ySideBottom, dip));
|
|
6168
7533
|
return { cut, crease, viewBox: { width: totalWidth, height: totalHeight } };
|
|
6169
7534
|
}
|
|
6170
7535
|
function line11(x1, y1, x2, y2) {
|
|
@@ -6207,46 +7572,44 @@ function side2TuckFlap(xSide2, xEnd, yFoldTop, yTuckFlapTop, tuckH) {
|
|
|
6207
7572
|
const rightPath = `M${rightTargetX} ${yTuckFlapTop} L${xEnd - CORNER} ${yFoldTop - TAB_W - CORNER} L${xEnd} ${yFoldTop - TAB_W} L${xEnd} ${yFoldTop}`;
|
|
6208
7573
|
return [leftTop, rightPath];
|
|
6209
7574
|
}
|
|
6210
|
-
function frontPanelBottom(xFront, xSide1,
|
|
7575
|
+
function frontPanelBottom(xFront, xSide1, _A, B, yFoldBottom, yFoldBottomFlap, yBottom, dip) {
|
|
6211
7576
|
const paths = [];
|
|
6212
7577
|
paths.push(line11(xFront, yFoldBottom, xFront, yBottom));
|
|
6213
7578
|
paths.push(line11(xSide1, yBottom, xSide1, yFoldBottom));
|
|
6214
|
-
const notchHalfTop = A / 4 + MT5;
|
|
6215
7579
|
const notchTaperH = (dip + SNAP_R) * TAPER;
|
|
6216
|
-
const
|
|
6217
|
-
const
|
|
6218
|
-
const nrt = center + notchHalfTop;
|
|
7580
|
+
const nlt = xFront + B / 2;
|
|
7581
|
+
const nrt = xSide1 - B / 2;
|
|
6219
7582
|
const nlb = nlt + notchTaperH;
|
|
6220
7583
|
const nrb = nrt - notchTaperH;
|
|
6221
7584
|
paths.push(line11(xFront, yBottom, nlb, yBottom));
|
|
6222
|
-
paths.push(line11(nlb, yBottom, nlt,
|
|
6223
|
-
paths.push(line11(nlt,
|
|
6224
|
-
paths.push(line11(nrt,
|
|
7585
|
+
paths.push(line11(nlb, yBottom, nlt, yFoldBottomFlap));
|
|
7586
|
+
paths.push(line11(nlt, yFoldBottomFlap, nrt, yFoldBottomFlap));
|
|
7587
|
+
paths.push(line11(nrt, yFoldBottomFlap, nrb, yBottom));
|
|
6225
7588
|
paths.push(line11(nrb, yBottom, xSide1, yBottom));
|
|
6226
7589
|
return paths;
|
|
6227
7590
|
}
|
|
6228
|
-
function backPanelBottom(xBack, xSide2,
|
|
7591
|
+
function backPanelBottom(xBack, xSide2, _A, B, yFoldBottom, yFoldBottomFlap, yBottom, ySideBottom, dip) {
|
|
6229
7592
|
const paths = [];
|
|
6230
|
-
const diagH =
|
|
7593
|
+
const diagH = B / 2;
|
|
6231
7594
|
paths.push(line11(xBack, yFoldBottom, xBack, ySideBottom));
|
|
6232
7595
|
paths.push(line11(xSide2, ySideBottom, xSide2, yFoldBottom));
|
|
6233
|
-
paths.push(line11(xBack, yFoldBottom, xBack + diagH,
|
|
6234
|
-
paths.push(line11(xSide2, yFoldBottom, xSide2 - diagH,
|
|
6235
|
-
paths.push(line11(xBack + diagH,
|
|
6236
|
-
paths.push(line11(xSide2 - diagH,
|
|
7596
|
+
paths.push(line11(xBack, yFoldBottom, xBack + diagH, yFoldBottomFlap));
|
|
7597
|
+
paths.push(line11(xSide2, yFoldBottom, xSide2 - diagH, yFoldBottomFlap));
|
|
7598
|
+
paths.push(line11(xBack + diagH, yFoldBottomFlap, xBack + diagH, yFoldBottomFlap + dip));
|
|
7599
|
+
paths.push(line11(xSide2 - diagH, yFoldBottomFlap + dip, xSide2 - diagH, yFoldBottomFlap));
|
|
6237
7600
|
paths.push(
|
|
6238
|
-
`M${xBack + diagH} ${
|
|
7601
|
+
`M${xBack + diagH} ${yFoldBottomFlap + dip} A${SNAP_R} ${SNAP_R} 0 0 0 ${xBack + diagH + SNAP_R} ${yBottom}`
|
|
6239
7602
|
);
|
|
6240
7603
|
paths.push(
|
|
6241
|
-
`M${xSide2 - diagH - SNAP_R} ${yBottom} A${SNAP_R} ${SNAP_R} 0 0 0 ${xSide2 - diagH} ${
|
|
7604
|
+
`M${xSide2 - diagH - SNAP_R} ${yBottom} A${SNAP_R} ${SNAP_R} 0 0 0 ${xSide2 - diagH} ${yFoldBottomFlap + dip}`
|
|
6242
7605
|
);
|
|
6243
7606
|
paths.push(line11(xBack + diagH + SNAP_R, yBottom, xSide2 - diagH - SNAP_R, yBottom));
|
|
6244
7607
|
return paths;
|
|
6245
7608
|
}
|
|
6246
|
-
function side1Bottom(xSide1, xBack, B,
|
|
7609
|
+
function side1Bottom(xSide1, xBack, B, flap, yFoldBottom, ySideBottom, dip) {
|
|
6247
7610
|
const paths = [];
|
|
6248
7611
|
const diagEndX = xSide1 + B / 2;
|
|
6249
|
-
const diagEndY = yFoldBottom +
|
|
7612
|
+
const diagEndY = yFoldBottom + flap;
|
|
6250
7613
|
const taperV = dip + SNAP_R;
|
|
6251
7614
|
const taperH = taperV * TAPER;
|
|
6252
7615
|
paths.push(line11(xSide1, yFoldBottom, diagEndX, diagEndY));
|
|
@@ -6254,10 +7617,10 @@ function side1Bottom(xSide1, xBack, B, A, yFoldBottom, ySideBottom, dip) {
|
|
|
6254
7617
|
paths.push(line11(diagEndX - taperH, ySideBottom, xBack, ySideBottom));
|
|
6255
7618
|
return paths;
|
|
6256
7619
|
}
|
|
6257
|
-
function side2Bottom(xSide2, xEnd, B,
|
|
7620
|
+
function side2Bottom(xSide2, xEnd, B, flap, yFoldBottom, ySideBottom, dip) {
|
|
6258
7621
|
const paths = [];
|
|
6259
7622
|
const diagEndX = xSide2 + B / 2;
|
|
6260
|
-
const diagEndY = yFoldBottom +
|
|
7623
|
+
const diagEndY = yFoldBottom + flap;
|
|
6261
7624
|
const taperV = dip + SNAP_R;
|
|
6262
7625
|
const taperH = taperV * TAPER;
|
|
6263
7626
|
paths.push(line11(xEnd, yFoldBottom, diagEndX, diagEndY));
|
|
@@ -6266,23 +7629,29 @@ function side2Bottom(xSide2, xEnd, B, A, yFoldBottom, ySideBottom, dip) {
|
|
|
6266
7629
|
return paths;
|
|
6267
7630
|
}
|
|
6268
7631
|
function generateDimensions11(attr, unit) {
|
|
6269
|
-
const { length: A, width: B, height: C } = attr;
|
|
6270
|
-
const kulak =
|
|
6271
|
-
const dil = calcDil(A, B
|
|
7632
|
+
const { length: A, width: B, height: C, glueArea } = attr;
|
|
7633
|
+
const kulak = glueArea;
|
|
7634
|
+
const dil = calcDil(A, B);
|
|
7635
|
+
const flap = calcFlap(B, dil);
|
|
6272
7636
|
const dip = calcDip(B);
|
|
6273
7637
|
const xFront = kulak;
|
|
6274
7638
|
const xSide1 = kulak + A;
|
|
7639
|
+
const xBack = kulak + A + B;
|
|
6275
7640
|
const xSide2 = kulak + 2 * A + B;
|
|
6276
7641
|
const xEnd = kulak + 2 * A + 2 * B - 0.5;
|
|
7642
|
+
const yTop = 0;
|
|
7643
|
+
const yTuckTop = dil - 1;
|
|
6277
7644
|
const yFoldTop = B + dil - 1;
|
|
6278
7645
|
const yFoldBottom = yFoldTop + C;
|
|
6279
|
-
const yBottom = yFoldBottom +
|
|
7646
|
+
const yBottom = yFoldBottom + flap + dip + SNAP_R;
|
|
6280
7647
|
const totalWidth = xEnd;
|
|
6281
7648
|
const totalHeight = yBottom;
|
|
6282
7649
|
const factor = unit === "cm" ? 0.1 : unit === "in" ? 1 / 25.4 : 1;
|
|
6283
7650
|
const suffix = unit;
|
|
6284
7651
|
const fmt = (v) => `${(v * factor).toFixed(2)} ${suffix}`;
|
|
7652
|
+
const backMidX = (xBack + xSide2) / 2;
|
|
6285
7653
|
return [
|
|
7654
|
+
// Overall dimensions
|
|
6286
7655
|
{
|
|
6287
7656
|
x1: 0,
|
|
6288
7657
|
y1: 0,
|
|
@@ -6301,15 +7670,17 @@ function generateDimensions11(attr, unit) {
|
|
|
6301
7670
|
orientation: "horizontal",
|
|
6302
7671
|
offset: -12
|
|
6303
7672
|
},
|
|
7673
|
+
// Glue Area (horizontal, same row as A/B at yFoldBottom)
|
|
6304
7674
|
{
|
|
6305
|
-
x1:
|
|
6306
|
-
y1:
|
|
6307
|
-
x2:
|
|
7675
|
+
x1: 0,
|
|
7676
|
+
y1: yFoldBottom,
|
|
7677
|
+
x2: xFront,
|
|
6308
7678
|
y2: yFoldBottom,
|
|
6309
|
-
label: fmt(
|
|
6310
|
-
orientation: "
|
|
6311
|
-
offset: -
|
|
7679
|
+
label: fmt(kulak),
|
|
7680
|
+
orientation: "horizontal",
|
|
7681
|
+
offset: -20
|
|
6312
7682
|
},
|
|
7683
|
+
// A (length)
|
|
6313
7684
|
{
|
|
6314
7685
|
x1: xFront,
|
|
6315
7686
|
y1: yFoldBottom,
|
|
@@ -6319,6 +7690,7 @@ function generateDimensions11(attr, unit) {
|
|
|
6319
7690
|
orientation: "horizontal",
|
|
6320
7691
|
offset: -20
|
|
6321
7692
|
},
|
|
7693
|
+
// B (width)
|
|
6322
7694
|
{
|
|
6323
7695
|
x1: xSide1,
|
|
6324
7696
|
y1: yFoldBottom,
|
|
@@ -6327,9 +7699,233 @@ function generateDimensions11(attr, unit) {
|
|
|
6327
7699
|
label: fmt(B),
|
|
6328
7700
|
orientation: "horizontal",
|
|
6329
7701
|
offset: -20
|
|
7702
|
+
},
|
|
7703
|
+
// Lock Tab height (yTop → yTuckTop)
|
|
7704
|
+
{
|
|
7705
|
+
x1: backMidX,
|
|
7706
|
+
y1: yTop,
|
|
7707
|
+
x2: backMidX,
|
|
7708
|
+
y2: yTuckTop,
|
|
7709
|
+
label: fmt(yTuckTop - yTop),
|
|
7710
|
+
orientation: "vertical",
|
|
7711
|
+
offset: 0
|
|
7712
|
+
},
|
|
7713
|
+
// B / width (yTuckTop → yFoldTop, shows B - 1.5)
|
|
7714
|
+
{
|
|
7715
|
+
x1: backMidX,
|
|
7716
|
+
y1: yTuckTop,
|
|
7717
|
+
x2: backMidX,
|
|
7718
|
+
y2: yFoldTop,
|
|
7719
|
+
label: fmt(B - 1.5),
|
|
7720
|
+
orientation: "vertical",
|
|
7721
|
+
offset: 0
|
|
7722
|
+
},
|
|
7723
|
+
// C / height (yFoldTop → yFoldBottom)
|
|
7724
|
+
{
|
|
7725
|
+
x1: backMidX,
|
|
7726
|
+
y1: yFoldTop,
|
|
7727
|
+
x2: backMidX,
|
|
7728
|
+
y2: yFoldBottom,
|
|
7729
|
+
label: fmt(C),
|
|
7730
|
+
orientation: "vertical",
|
|
7731
|
+
offset: 0
|
|
7732
|
+
},
|
|
7733
|
+
// Back Bottom / Snap Lock (yFoldBottom → yBottom, shows B - 1.5)
|
|
7734
|
+
{
|
|
7735
|
+
x1: backMidX,
|
|
7736
|
+
y1: yFoldBottom,
|
|
7737
|
+
x2: backMidX,
|
|
7738
|
+
y2: yBottom,
|
|
7739
|
+
label: fmt(B - 1.5),
|
|
7740
|
+
orientation: "vertical",
|
|
7741
|
+
offset: 0
|
|
6330
7742
|
}
|
|
6331
7743
|
];
|
|
6332
7744
|
}
|
|
7745
|
+
function generateBecf10a0aDebug(attr) {
|
|
7746
|
+
const { length: A, width: B, height: C, glueArea } = attr;
|
|
7747
|
+
const kulak = glueArea;
|
|
7748
|
+
const dil = calcDil(A, B);
|
|
7749
|
+
const flap = calcFlap(B, dil);
|
|
7750
|
+
const dip = calcDip(B);
|
|
7751
|
+
const glueTaper = kulak * TAPER;
|
|
7752
|
+
const tuckH = B / 2 + ARC_R4;
|
|
7753
|
+
const xFront = kulak;
|
|
7754
|
+
const xSide1 = kulak + A;
|
|
7755
|
+
const xBack = kulak + A + B;
|
|
7756
|
+
const xSide2 = kulak + 2 * A + B;
|
|
7757
|
+
const xEnd = kulak + 2 * A + 2 * B - 0.5;
|
|
7758
|
+
const yTop = 0;
|
|
7759
|
+
const yTuckTop = dil - 1;
|
|
7760
|
+
const yLockCrease = dil;
|
|
7761
|
+
const yTuckFlapTop = B + dil - 1 - tuckH;
|
|
7762
|
+
const yFoldTop = B + dil - 1;
|
|
7763
|
+
const yFoldBottom = yFoldTop + C;
|
|
7764
|
+
const yFoldBottomFlap = yFoldBottom + flap;
|
|
7765
|
+
const ySideBottom = yFoldBottom + flap + dip + SNAP_R;
|
|
7766
|
+
const yBottom = yFoldBottom + flap + dip + SNAP_R;
|
|
7767
|
+
const totalWidth = xEnd;
|
|
7768
|
+
const totalHeight = yBottom;
|
|
7769
|
+
const crease = [];
|
|
7770
|
+
crease.push(
|
|
7771
|
+
line11(xFront, yFoldTop, xFront, yFoldBottom),
|
|
7772
|
+
line11(xSide1, yFoldTop, xSide1, yFoldBottom),
|
|
7773
|
+
line11(xBack, yFoldTop, xBack, yFoldBottom),
|
|
7774
|
+
line11(xSide2, yFoldTop, xSide2, yFoldBottom)
|
|
7775
|
+
);
|
|
7776
|
+
crease.push(
|
|
7777
|
+
line11(xFront, yFoldBottom, xSide1, yFoldBottom),
|
|
7778
|
+
line11(xSide1, yFoldBottom, xBack, yFoldBottom),
|
|
7779
|
+
line11(xBack, yFoldBottom, xSide2, yFoldBottom),
|
|
7780
|
+
line11(xSide2, yFoldBottom, xEnd, yFoldBottom)
|
|
7781
|
+
);
|
|
7782
|
+
crease.push(
|
|
7783
|
+
line11(xBack, yFoldTop, xSide1 + MT5, yFoldTop),
|
|
7784
|
+
line11(xBack, yFoldTop - MT5, xSide2, yFoldTop - MT5),
|
|
7785
|
+
line11(xSide2, yFoldTop, xEnd, yFoldTop)
|
|
7786
|
+
);
|
|
7787
|
+
crease.push(line11(xBack + NOTCH, yLockCrease, xSide2 - NOTCH, yLockCrease));
|
|
7788
|
+
const pt = (id, x, y, color) => ({ id, x, y, color });
|
|
7789
|
+
const groups = [];
|
|
7790
|
+
const notchTaperH = (dip + SNAP_R) * TAPER;
|
|
7791
|
+
const nlt = xFront + B / 2;
|
|
7792
|
+
const nrt = xSide1 - B / 2;
|
|
7793
|
+
const nlb = nlt + notchTaperH;
|
|
7794
|
+
const nrb = nrt - notchTaperH;
|
|
7795
|
+
const diagH = B / 2;
|
|
7796
|
+
const s1DiagEndX = xSide1 + B / 2;
|
|
7797
|
+
const s2DiagEndX = xSide2 + B / 2;
|
|
7798
|
+
const taperV = dip + SNAP_R;
|
|
7799
|
+
const sideTaperH = taperV * TAPER;
|
|
7800
|
+
groups.push({
|
|
7801
|
+
name: "Glue Flap",
|
|
7802
|
+
color: "#e74c3c",
|
|
7803
|
+
paths: [
|
|
7804
|
+
`M${xFront} ${yFoldBottom} L${0} ${yFoldBottom - glueTaper} L${0} ${yFoldTop + glueTaper} L${xFront} ${yFoldTop}`
|
|
7805
|
+
],
|
|
7806
|
+
points: [],
|
|
7807
|
+
labelX: kulak / 2,
|
|
7808
|
+
labelY: (yFoldTop + yFoldBottom) / 2
|
|
7809
|
+
});
|
|
7810
|
+
groups.push({
|
|
7811
|
+
name: "Front Panel",
|
|
7812
|
+
color: "#3498db",
|
|
7813
|
+
paths: [
|
|
7814
|
+
line11(xSide1, yFoldTop, xFront, yFoldTop),
|
|
7815
|
+
line11(xSide1, yFoldTop, xSide1 + MT5, yFoldTop)
|
|
7816
|
+
],
|
|
7817
|
+
points: [],
|
|
7818
|
+
labelX: (xFront + xSide1) / 2,
|
|
7819
|
+
labelY: (yFoldTop + yFoldBottom) / 2
|
|
7820
|
+
});
|
|
7821
|
+
groups.push({
|
|
7822
|
+
name: "Side1 Tuck Flap",
|
|
7823
|
+
color: "#2ecc71",
|
|
7824
|
+
paths: side1TuckFlap(xSide1, xBack, yFoldTop, yTuckFlapTop, tuckH),
|
|
7825
|
+
points: [],
|
|
7826
|
+
labelX: (xSide1 + xBack) / 2,
|
|
7827
|
+
labelY: (yTuckFlapTop + yFoldTop) / 2
|
|
7828
|
+
});
|
|
7829
|
+
groups.push({
|
|
7830
|
+
name: "Lock Tab",
|
|
7831
|
+
color: "#9b59b6",
|
|
7832
|
+
paths: lockTab(xBack, xSide2, yTop, yTuckTop, yLockCrease, yFoldTop),
|
|
7833
|
+
points: [],
|
|
7834
|
+
labelX: (xBack + xSide2) / 2,
|
|
7835
|
+
labelY: (yTop + yFoldTop) / 2
|
|
7836
|
+
});
|
|
7837
|
+
groups.push({
|
|
7838
|
+
name: "Back Panel",
|
|
7839
|
+
color: "#f39c12",
|
|
7840
|
+
paths: [],
|
|
7841
|
+
points: [],
|
|
7842
|
+
labelX: (xBack + xSide2) / 2,
|
|
7843
|
+
labelY: (yFoldTop + yFoldBottom) / 2
|
|
7844
|
+
});
|
|
7845
|
+
groups.push({
|
|
7846
|
+
name: "Side2 Tuck Flap",
|
|
7847
|
+
color: "#1abc9c",
|
|
7848
|
+
paths: side2TuckFlap(xSide2, xEnd, yFoldTop, yTuckFlapTop, tuckH),
|
|
7849
|
+
points: [],
|
|
7850
|
+
labelX: (xSide2 + xEnd) / 2,
|
|
7851
|
+
labelY: (yTuckFlapTop + yFoldTop) / 2
|
|
7852
|
+
});
|
|
7853
|
+
groups.push({
|
|
7854
|
+
name: "Side2 Panel",
|
|
7855
|
+
color: "#e67e22",
|
|
7856
|
+
paths: [line11(xEnd, yFoldTop, xEnd, yFoldBottom)],
|
|
7857
|
+
points: [],
|
|
7858
|
+
labelX: (xSide2 + xEnd) / 2,
|
|
7859
|
+
labelY: (yFoldTop + yFoldBottom) / 2
|
|
7860
|
+
});
|
|
7861
|
+
const cF = "#e74c3c";
|
|
7862
|
+
groups.push({
|
|
7863
|
+
name: "Front Bottom",
|
|
7864
|
+
color: cF,
|
|
7865
|
+
paths: frontPanelBottom(xFront, xSide1, A, B, yFoldBottom, yFoldBottomFlap, yBottom, dip),
|
|
7866
|
+
points: [
|
|
7867
|
+
pt("F1", xFront, yFoldBottom, cF),
|
|
7868
|
+
pt("F2", xFront, yBottom, cF),
|
|
7869
|
+
pt("F3", nlb, yBottom, cF),
|
|
7870
|
+
pt("F4", nlt, yFoldBottomFlap, cF),
|
|
7871
|
+
pt("F5", nrt, yFoldBottomFlap, cF),
|
|
7872
|
+
pt("F6", nrb, yBottom, cF),
|
|
7873
|
+
pt("F7", xSide1, yBottom, cF),
|
|
7874
|
+
pt("F8", xSide1, yFoldBottom, cF)
|
|
7875
|
+
],
|
|
7876
|
+
labelX: (xFront + xSide1) / 2,
|
|
7877
|
+
labelY: (yFoldBottom + yBottom) / 2
|
|
7878
|
+
});
|
|
7879
|
+
const cS1 = "#2ecc71";
|
|
7880
|
+
groups.push({
|
|
7881
|
+
name: "Side1 Bottom",
|
|
7882
|
+
color: cS1,
|
|
7883
|
+
paths: side1Bottom(xSide1, xBack, B, flap, yFoldBottom, ySideBottom, dip),
|
|
7884
|
+
points: [
|
|
7885
|
+
pt("S1-1", xSide1, yFoldBottom, cS1),
|
|
7886
|
+
pt("S1-2", s1DiagEndX, yFoldBottom + flap, cS1),
|
|
7887
|
+
pt("S1-3", s1DiagEndX - sideTaperH, ySideBottom, cS1),
|
|
7888
|
+
pt("S1-4", xBack, ySideBottom, cS1)
|
|
7889
|
+
],
|
|
7890
|
+
labelX: (xSide1 + xBack) / 2,
|
|
7891
|
+
labelY: (yFoldBottom + ySideBottom) / 2
|
|
7892
|
+
});
|
|
7893
|
+
const cB = "#9b59b6";
|
|
7894
|
+
groups.push({
|
|
7895
|
+
name: "Back Bottom\n(Snap Lock)",
|
|
7896
|
+
color: cB,
|
|
7897
|
+
paths: backPanelBottom(xBack, xSide2, A, B, yFoldBottom, yFoldBottomFlap, yBottom, ySideBottom, dip),
|
|
7898
|
+
points: [
|
|
7899
|
+
pt("B1", xBack, yFoldBottom, cB),
|
|
7900
|
+
pt("B2", xBack, ySideBottom, cB),
|
|
7901
|
+
pt("B3", xBack + diagH, yFoldBottomFlap, cB),
|
|
7902
|
+
pt("B4", xBack + diagH, yFoldBottomFlap + dip, cB),
|
|
7903
|
+
pt("B5", xBack + diagH + SNAP_R, yBottom, cB),
|
|
7904
|
+
pt("B6", xSide2 - diagH - SNAP_R, yBottom, cB),
|
|
7905
|
+
pt("B7", xSide2 - diagH, yFoldBottomFlap + dip, cB),
|
|
7906
|
+
pt("B8", xSide2 - diagH, yFoldBottomFlap, cB),
|
|
7907
|
+
pt("B9", xSide2, ySideBottom, cB),
|
|
7908
|
+
pt("B10", xSide2, yFoldBottom, cB)
|
|
7909
|
+
],
|
|
7910
|
+
labelX: (xBack + xSide2) / 2,
|
|
7911
|
+
labelY: (yFoldBottom + yBottom) / 2
|
|
7912
|
+
});
|
|
7913
|
+
const cS2 = "#1abc9c";
|
|
7914
|
+
groups.push({
|
|
7915
|
+
name: "Side2 Bottom",
|
|
7916
|
+
color: cS2,
|
|
7917
|
+
paths: side2Bottom(xSide2, xEnd, B, flap, yFoldBottom, ySideBottom, dip),
|
|
7918
|
+
points: [
|
|
7919
|
+
pt("S2-1", xEnd, yFoldBottom, cS2),
|
|
7920
|
+
pt("S2-2", s2DiagEndX, yFoldBottom + flap, cS2),
|
|
7921
|
+
pt("S2-3", s2DiagEndX + sideTaperH, ySideBottom, cS2),
|
|
7922
|
+
pt("S2-4", xSide2, ySideBottom, cS2)
|
|
7923
|
+
],
|
|
7924
|
+
labelX: (xSide2 + xEnd) / 2,
|
|
7925
|
+
labelY: (yFoldBottom + ySideBottom) / 2
|
|
7926
|
+
});
|
|
7927
|
+
return { groups, crease, viewBox: { width: totalWidth, height: totalHeight } };
|
|
7928
|
+
}
|
|
6333
7929
|
var MODEL_ID11 = "BECF-10A0A";
|
|
6334
7930
|
var UNIT_FACTOR11 = {
|
|
6335
7931
|
mm: 1,
|
|
@@ -6345,8 +7941,28 @@ function renderDimension11(dim, i, fs) {
|
|
|
6345
7941
|
const midX = (x1 + x2) / 2;
|
|
6346
7942
|
return /* @__PURE__ */ jsxs("g", { children: [
|
|
6347
7943
|
/* @__PURE__ */ jsx("line", { x1, y1: y, x2, y2: y, stroke: "#000", strokeWidth: 0.2 }),
|
|
6348
|
-
/* @__PURE__ */ jsx(
|
|
6349
|
-
|
|
7944
|
+
/* @__PURE__ */ jsx(
|
|
7945
|
+
"line",
|
|
7946
|
+
{
|
|
7947
|
+
x1,
|
|
7948
|
+
y1: y - tick,
|
|
7949
|
+
x2: x1,
|
|
7950
|
+
y2: y + tick,
|
|
7951
|
+
stroke: "#000",
|
|
7952
|
+
strokeWidth: 0.3
|
|
7953
|
+
}
|
|
7954
|
+
),
|
|
7955
|
+
/* @__PURE__ */ jsx(
|
|
7956
|
+
"line",
|
|
7957
|
+
{
|
|
7958
|
+
x1: x2,
|
|
7959
|
+
y1: y - tick,
|
|
7960
|
+
x2,
|
|
7961
|
+
y2: y + tick,
|
|
7962
|
+
stroke: "#000",
|
|
7963
|
+
strokeWidth: 0.3
|
|
7964
|
+
}
|
|
7965
|
+
),
|
|
6350
7966
|
/* @__PURE__ */ jsx(
|
|
6351
7967
|
"text",
|
|
6352
7968
|
{
|
|
@@ -6365,8 +7981,28 @@ function renderDimension11(dim, i, fs) {
|
|
|
6365
7981
|
const midY = (y1 + y2) / 2;
|
|
6366
7982
|
return /* @__PURE__ */ jsxs("g", { children: [
|
|
6367
7983
|
/* @__PURE__ */ jsx("line", { x1: x, y1, x2: x, y2, stroke: "#000", strokeWidth: 0.2 }),
|
|
6368
|
-
/* @__PURE__ */ jsx(
|
|
6369
|
-
|
|
7984
|
+
/* @__PURE__ */ jsx(
|
|
7985
|
+
"line",
|
|
7986
|
+
{
|
|
7987
|
+
x1: x - tick,
|
|
7988
|
+
y1,
|
|
7989
|
+
x2: x + tick,
|
|
7990
|
+
y2: y1,
|
|
7991
|
+
stroke: "#000",
|
|
7992
|
+
strokeWidth: 0.3
|
|
7993
|
+
}
|
|
7994
|
+
),
|
|
7995
|
+
/* @__PURE__ */ jsx(
|
|
7996
|
+
"line",
|
|
7997
|
+
{
|
|
7998
|
+
x1: x - tick,
|
|
7999
|
+
y1: y2,
|
|
8000
|
+
x2: x + tick,
|
|
8001
|
+
y2,
|
|
8002
|
+
stroke: "#000",
|
|
8003
|
+
strokeWidth: 0.3
|
|
8004
|
+
}
|
|
8005
|
+
),
|
|
6370
8006
|
/* @__PURE__ */ jsx(
|
|
6371
8007
|
"text",
|
|
6372
8008
|
{
|
|
@@ -6384,114 +8020,192 @@ function renderDimension11(dim, i, fs) {
|
|
|
6384
8020
|
] }, `dim-${i}`);
|
|
6385
8021
|
}
|
|
6386
8022
|
var DIE_LINE_BECF_10A0A = forwardRef(
|
|
6387
|
-
({
|
|
6388
|
-
|
|
6389
|
-
unit = "mm",
|
|
6390
|
-
isShowDimensions = false,
|
|
6391
|
-
renderAs = "svg"
|
|
6392
|
-
}, ref) => {
|
|
6393
|
-
const theme = useMemo(
|
|
6394
|
-
() => getModelTheme(),
|
|
6395
|
-
[]
|
|
6396
|
-
);
|
|
8023
|
+
({ attributes, unit = "mm", isShowDimensions = false, renderAs = "svg", debug = false }, ref) => {
|
|
8024
|
+
const theme = useMemo(() => getModelTheme(), []);
|
|
6397
8025
|
const svgRef = useRef(null);
|
|
6398
8026
|
const dieline = useMemo(() => generateBecf10a0a(attributes), [attributes]);
|
|
8027
|
+
const debugDieline = useMemo(
|
|
8028
|
+
() => debug ? generateBecf10a0aDebug(attributes) : null,
|
|
8029
|
+
[attributes, debug]
|
|
8030
|
+
);
|
|
6399
8031
|
const dimensions = useMemo(
|
|
6400
8032
|
() => generateDimensions11(attributes, unit),
|
|
6401
8033
|
[attributes, unit]
|
|
6402
8034
|
);
|
|
6403
8035
|
const factor = UNIT_FACTOR11[unit] ?? 1;
|
|
6404
|
-
const serializeSvg = useCallback(
|
|
6405
|
-
|
|
6406
|
-
|
|
6407
|
-
|
|
6408
|
-
|
|
6409
|
-
|
|
6410
|
-
|
|
6411
|
-
|
|
6412
|
-
|
|
6413
|
-
|
|
6414
|
-
|
|
6415
|
-
|
|
6416
|
-
|
|
6417
|
-
|
|
6418
|
-
|
|
6419
|
-
()
|
|
6420
|
-
|
|
6421
|
-
|
|
6422
|
-
|
|
6423
|
-
|
|
6424
|
-
|
|
6425
|
-
|
|
6426
|
-
|
|
6427
|
-
|
|
6428
|
-
|
|
6429
|
-
|
|
6430
|
-
|
|
6431
|
-
|
|
6432
|
-
|
|
6433
|
-
|
|
6434
|
-
|
|
6435
|
-
|
|
6436
|
-
|
|
6437
|
-
|
|
6438
|
-
|
|
6439
|
-
|
|
6440
|
-
|
|
6441
|
-
|
|
6442
|
-
|
|
6443
|
-
|
|
6444
|
-
|
|
6445
|
-
|
|
6446
|
-
|
|
6447
|
-
|
|
6448
|
-
|
|
6449
|
-
|
|
6450
|
-
|
|
6451
|
-
|
|
6452
|
-
|
|
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
|
-
});
|
|
8036
|
+
const serializeSvg = useCallback((showDimensions) => {
|
|
8037
|
+
const svg = svgRef.current;
|
|
8038
|
+
if (!svg) throw new Error("SVG not mounted");
|
|
8039
|
+
const clone = svg.cloneNode(true);
|
|
8040
|
+
if (!showDimensions) {
|
|
8041
|
+
const dimGroup = clone.querySelector("#dimensions");
|
|
8042
|
+
dimGroup?.remove();
|
|
8043
|
+
}
|
|
8044
|
+
return new XMLSerializer().serializeToString(clone);
|
|
8045
|
+
}, []);
|
|
8046
|
+
useImperativeHandle(ref, () => {
|
|
8047
|
+
const { length: A, width: B, height: C, glueArea } = attributes;
|
|
8048
|
+
const kulak = glueArea;
|
|
8049
|
+
const dil = calcDil(A, B);
|
|
8050
|
+
const flap = calcFlap(B, dil);
|
|
8051
|
+
const dip = calcDip(B);
|
|
8052
|
+
return {
|
|
8053
|
+
getAttributes: () => ({
|
|
8054
|
+
modelId: MODEL_ID11,
|
|
8055
|
+
overallWidth: dieline.viewBox.width * factor,
|
|
8056
|
+
overallHeight: dieline.viewBox.height * factor,
|
|
8057
|
+
length: A * factor,
|
|
8058
|
+
width: B * factor,
|
|
8059
|
+
height: C * factor,
|
|
8060
|
+
glueArea: glueArea * factor,
|
|
8061
|
+
kulak: kulak * factor,
|
|
8062
|
+
dil: dil * factor,
|
|
8063
|
+
flap: flap * factor,
|
|
8064
|
+
dip: dip * factor
|
|
8065
|
+
}),
|
|
8066
|
+
exportImage: async (options) => {
|
|
8067
|
+
const svgStr = serializeSvg(options.isShowDimension);
|
|
8068
|
+
const blob = new Blob([svgStr], {
|
|
8069
|
+
type: "image/svg+xml;charset=utf-8"
|
|
8070
|
+
});
|
|
8071
|
+
const url = URL.createObjectURL(blob);
|
|
8072
|
+
const img = new Image();
|
|
8073
|
+
await new Promise((resolve, reject) => {
|
|
8074
|
+
img.onload = () => resolve();
|
|
8075
|
+
img.onerror = reject;
|
|
8076
|
+
img.src = url;
|
|
8077
|
+
});
|
|
8078
|
+
const canvas = document.createElement("canvas");
|
|
8079
|
+
if (options.originalSize) {
|
|
8080
|
+
canvas.width = Math.round(dieline.viewBox.width * PX_PER_MM11);
|
|
8081
|
+
canvas.height = Math.round(dieline.viewBox.height * PX_PER_MM11);
|
|
8082
|
+
} else {
|
|
8083
|
+
canvas.width = 1920;
|
|
8084
|
+
canvas.height = 1080;
|
|
6481
8085
|
}
|
|
6482
|
-
|
|
6483
|
-
|
|
6484
|
-
|
|
6485
|
-
|
|
8086
|
+
const ctx = canvas.getContext("2d");
|
|
8087
|
+
ctx.fillStyle = "#ffffff";
|
|
8088
|
+
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
|
8089
|
+
ctx.drawImage(img, 0, 0, canvas.width, canvas.height);
|
|
8090
|
+
URL.revokeObjectURL(url);
|
|
8091
|
+
return new Promise((resolve, reject) => {
|
|
8092
|
+
canvas.toBlob(
|
|
8093
|
+
(b) => b ? resolve(b) : reject(new Error("Export failed")),
|
|
8094
|
+
"image/png"
|
|
8095
|
+
);
|
|
8096
|
+
});
|
|
8097
|
+
},
|
|
8098
|
+
exportDimension: async () => {
|
|
8099
|
+
const dimData = generateDimensions11(attributes, unit);
|
|
8100
|
+
return exportDimensionPdf({
|
|
8101
|
+
modelId: MODEL_ID11,
|
|
8102
|
+
dieline,
|
|
8103
|
+
dimensions: dimData,
|
|
8104
|
+
attributes,
|
|
8105
|
+
unit,
|
|
8106
|
+
factor,
|
|
8107
|
+
theme
|
|
8108
|
+
});
|
|
8109
|
+
},
|
|
8110
|
+
readyToPrint: async () => {
|
|
8111
|
+
const dimData = generateDimensions11(attributes, unit);
|
|
8112
|
+
return readyToPrintPdf({
|
|
8113
|
+
modelId: MODEL_ID11,
|
|
8114
|
+
dieline,
|
|
8115
|
+
dimensions: dimData,
|
|
8116
|
+
attributes,
|
|
8117
|
+
unit,
|
|
8118
|
+
factor,
|
|
8119
|
+
theme
|
|
8120
|
+
});
|
|
8121
|
+
}
|
|
8122
|
+
};
|
|
8123
|
+
}, [attributes, dieline, factor, unit, serializeSvg, theme]);
|
|
6486
8124
|
const padding = isShowDimensions ? 15 : 0;
|
|
6487
8125
|
const vbX = -padding;
|
|
6488
8126
|
const vbY = -padding;
|
|
6489
8127
|
const vbW = dieline.viewBox.width + padding * 2;
|
|
6490
8128
|
const vbH = dieline.viewBox.height + padding * 2;
|
|
6491
|
-
const
|
|
6492
|
-
|
|
6493
|
-
/* @__PURE__ */ jsx("g", { id: "
|
|
6494
|
-
|
|
8129
|
+
const debugFontSize = Math.max(3, dieline.viewBox.width / 80);
|
|
8130
|
+
const svgChildren = debug && debugDieline ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
8131
|
+
/* @__PURE__ */ jsx("g", { id: "crease", children: debugDieline.crease.map((d, i) => /* @__PURE__ */ jsx(
|
|
8132
|
+
"path",
|
|
8133
|
+
{
|
|
8134
|
+
d,
|
|
8135
|
+
fill: "none",
|
|
8136
|
+
stroke: "#999",
|
|
8137
|
+
strokeWidth: 0.3,
|
|
8138
|
+
strokeDasharray: "2,1"
|
|
8139
|
+
},
|
|
8140
|
+
`c-${i}`
|
|
8141
|
+
)) }),
|
|
8142
|
+
debugDieline.groups.map((group, gi) => /* @__PURE__ */ jsxs("g", { id: `debug-${group.name}`, children: [
|
|
8143
|
+
group.paths.map((d, pi) => /* @__PURE__ */ jsx(
|
|
8144
|
+
"path",
|
|
8145
|
+
{
|
|
8146
|
+
d,
|
|
8147
|
+
fill: "none",
|
|
8148
|
+
stroke: group.color,
|
|
8149
|
+
strokeWidth: 1
|
|
8150
|
+
},
|
|
8151
|
+
`dp-${gi}-${pi}`
|
|
8152
|
+
)),
|
|
8153
|
+
group.name.split("\n").map((ln, li) => /* @__PURE__ */ jsx(
|
|
8154
|
+
"text",
|
|
8155
|
+
{
|
|
8156
|
+
x: group.labelX,
|
|
8157
|
+
y: group.labelY + li * (debugFontSize + 1),
|
|
8158
|
+
textAnchor: "middle",
|
|
8159
|
+
dominantBaseline: "central",
|
|
8160
|
+
fontSize: debugFontSize,
|
|
8161
|
+
fontFamily: "sans-serif",
|
|
8162
|
+
fontWeight: "bold",
|
|
8163
|
+
fill: group.color,
|
|
8164
|
+
children: ln
|
|
8165
|
+
},
|
|
8166
|
+
`label-${gi}-${li}`
|
|
8167
|
+
)),
|
|
8168
|
+
group.points.map((p) => /* @__PURE__ */ jsxs("g", { children: [
|
|
8169
|
+
/* @__PURE__ */ jsx("circle", { cx: p.x, cy: p.y, r: 1.2, fill: p.color }),
|
|
8170
|
+
/* @__PURE__ */ jsx(
|
|
8171
|
+
"text",
|
|
8172
|
+
{
|
|
8173
|
+
x: p.x + 2,
|
|
8174
|
+
y: p.y - 1.5,
|
|
8175
|
+
fontSize: debugFontSize * 0.7,
|
|
8176
|
+
fontFamily: "monospace",
|
|
8177
|
+
fontWeight: "bold",
|
|
8178
|
+
fill: p.color,
|
|
8179
|
+
children: p.id
|
|
8180
|
+
}
|
|
8181
|
+
)
|
|
8182
|
+
] }, `pt-${p.id}`))
|
|
8183
|
+
] }, `debug-${gi}`))
|
|
8184
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
8185
|
+
/* @__PURE__ */ jsx("g", { id: "crease", children: dieline.crease.map((d, i) => /* @__PURE__ */ jsx(
|
|
8186
|
+
"path",
|
|
8187
|
+
{
|
|
8188
|
+
d,
|
|
8189
|
+
fill: "none",
|
|
8190
|
+
stroke: theme.colorFoldLine,
|
|
8191
|
+
strokeWidth: 0.5,
|
|
8192
|
+
strokeDasharray: "2,1"
|
|
8193
|
+
},
|
|
8194
|
+
`c-${i}`
|
|
8195
|
+
)) }),
|
|
8196
|
+
/* @__PURE__ */ jsx("g", { id: "cut", children: dieline.cut.map((d, i) => /* @__PURE__ */ jsx(
|
|
8197
|
+
"path",
|
|
8198
|
+
{
|
|
8199
|
+
d,
|
|
8200
|
+
fill: "none",
|
|
8201
|
+
stroke: theme.colorDieLine,
|
|
8202
|
+
strokeWidth: 0.5
|
|
8203
|
+
},
|
|
8204
|
+
`t-${i}`
|
|
8205
|
+
)) }),
|
|
8206
|
+
isShowDimensions && /* @__PURE__ */ jsx("g", { id: "dimensions", children: dimensions.map(
|
|
8207
|
+
(d, i) => renderDimension11(d, i, getFontDimensionSize())
|
|
8208
|
+
) })
|
|
6495
8209
|
] });
|
|
6496
8210
|
if (renderAs === "group") {
|
|
6497
8211
|
return /* @__PURE__ */ jsx("g", { children: svgChildren });
|
|
@@ -6509,41 +8223,41 @@ var DIE_LINE_BECF_10A0A = forwardRef(
|
|
|
6509
8223
|
);
|
|
6510
8224
|
}
|
|
6511
8225
|
);
|
|
6512
|
-
var CANVAS_BECF_10A0A = forwardRef(
|
|
6513
|
-
|
|
6514
|
-
|
|
6515
|
-
|
|
6516
|
-
|
|
6517
|
-
|
|
6518
|
-
|
|
6519
|
-
|
|
6520
|
-
)
|
|
6521
|
-
|
|
6522
|
-
|
|
6523
|
-
|
|
6524
|
-
|
|
6525
|
-
|
|
6526
|
-
|
|
6527
|
-
|
|
6528
|
-
|
|
6529
|
-
|
|
6530
|
-
|
|
6531
|
-
);
|
|
6532
|
-
|
|
6533
|
-
const
|
|
6534
|
-
|
|
6535
|
-
|
|
6536
|
-
|
|
6537
|
-
|
|
6538
|
-
|
|
6539
|
-
|
|
6540
|
-
|
|
6541
|
-
}, []);
|
|
6542
|
-
useImperativeHandle(ref, () => ({
|
|
8226
|
+
var CANVAS_BECF_10A0A = forwardRef((props, ref) => {
|
|
8227
|
+
const dieLineRef = useRef(null);
|
|
8228
|
+
const canvasRef = useRef(null);
|
|
8229
|
+
const { attributes } = props;
|
|
8230
|
+
const theme = useMemo(() => getModelTheme(), []);
|
|
8231
|
+
const dieline = useMemo(() => generateBecf10a0a(attributes), [attributes]);
|
|
8232
|
+
const stablePadding = 15;
|
|
8233
|
+
const viewBox = useMemo(
|
|
8234
|
+
() => ({
|
|
8235
|
+
x: -stablePadding,
|
|
8236
|
+
y: -stablePadding,
|
|
8237
|
+
width: dieline.viewBox.width + stablePadding * 2,
|
|
8238
|
+
height: dieline.viewBox.height + stablePadding * 2
|
|
8239
|
+
}),
|
|
8240
|
+
[dieline.viewBox.width, dieline.viewBox.height]
|
|
8241
|
+
);
|
|
8242
|
+
const serializeCanvasSvg = useCallback((showDimensions) => {
|
|
8243
|
+
const svg = canvasRef.current?.getSvgElement();
|
|
8244
|
+
if (!svg) throw new Error("SVG not mounted");
|
|
8245
|
+
const clone = svg.cloneNode(true);
|
|
8246
|
+
if (!showDimensions) {
|
|
8247
|
+
const dimGroup = clone.querySelector("#dimensions");
|
|
8248
|
+
dimGroup?.remove();
|
|
8249
|
+
}
|
|
8250
|
+
return new XMLSerializer().serializeToString(clone);
|
|
8251
|
+
}, []);
|
|
8252
|
+
useImperativeHandle(
|
|
8253
|
+
ref,
|
|
8254
|
+
() => ({
|
|
6543
8255
|
getAttributes: () => dieLineRef.current.getAttributes(),
|
|
6544
8256
|
exportImage: async (options) => {
|
|
6545
8257
|
const svgStr = serializeCanvasSvg(options.isShowDimension);
|
|
6546
|
-
const blob = new Blob([svgStr], {
|
|
8258
|
+
const blob = new Blob([svgStr], {
|
|
8259
|
+
type: "image/svg+xml;charset=utf-8"
|
|
8260
|
+
});
|
|
6547
8261
|
const url = URL.createObjectURL(blob);
|
|
6548
8262
|
const img = new Image();
|
|
6549
8263
|
await new Promise((resolve, reject) => {
|
|
@@ -6572,20 +8286,22 @@ var CANVAS_BECF_10A0A = forwardRef(
|
|
|
6572
8286
|
});
|
|
6573
8287
|
},
|
|
6574
8288
|
exportDimension: () => dieLineRef.current.exportDimension(),
|
|
8289
|
+
readyToPrint: () => dieLineRef.current.readyToPrint(),
|
|
6575
8290
|
resetView: () => canvasRef.current?.resetView(),
|
|
6576
8291
|
fitView: () => canvasRef.current?.fitView()
|
|
6577
|
-
}),
|
|
6578
|
-
|
|
6579
|
-
|
|
6580
|
-
|
|
6581
|
-
|
|
6582
|
-
|
|
6583
|
-
|
|
6584
|
-
|
|
6585
|
-
|
|
6586
|
-
|
|
6587
|
-
|
|
6588
|
-
);
|
|
8292
|
+
}),
|
|
8293
|
+
[serializeCanvasSvg, dieline.viewBox.width, dieline.viewBox.height]
|
|
8294
|
+
);
|
|
8295
|
+
return /* @__PURE__ */ jsx(
|
|
8296
|
+
BaseCanvas,
|
|
8297
|
+
{
|
|
8298
|
+
ref: canvasRef,
|
|
8299
|
+
viewBox,
|
|
8300
|
+
backgroundColor: theme.colorBackground,
|
|
8301
|
+
children: /* @__PURE__ */ jsx(DIE_LINE_BECF_10A0A, { ref: dieLineRef, ...props, renderAs: "group" })
|
|
8302
|
+
}
|
|
8303
|
+
);
|
|
8304
|
+
});
|
|
6589
8305
|
var MODEL_BECF_10A0A = forwardRef(
|
|
6590
8306
|
({ mode = "DIE_LINE", ...props }, ref) => {
|
|
6591
8307
|
return /* @__PURE__ */ jsx(Fragment, { children: (() => {
|
|
@@ -9925,12 +11641,12 @@ var AUTO_LAYOUT = forwardRef(
|
|
|
9925
11641
|
});
|
|
9926
11642
|
}
|
|
9927
11643
|
if (pdfGriper > 0) {
|
|
9928
|
-
const
|
|
11644
|
+
const hexToRgb3 = (hex) => ({
|
|
9929
11645
|
r: parseInt(hex.slice(1, 3), 16),
|
|
9930
11646
|
g: parseInt(hex.slice(3, 5), 16),
|
|
9931
11647
|
b: parseInt(hex.slice(5, 7), 16)
|
|
9932
11648
|
});
|
|
9933
|
-
const gc =
|
|
11649
|
+
const gc = hexToRgb3(theme.colorGriper);
|
|
9934
11650
|
doc.setFillColor(gc.r, gc.g, gc.b);
|
|
9935
11651
|
const depth = pdfGriper;
|
|
9936
11652
|
switch (gripperSide) {
|
|
@@ -9953,7 +11669,7 @@ var AUTO_LAYOUT = forwardRef(
|
|
|
9953
11669
|
const totalMarks = (ARROW_COLORS_HEX.length - 1) * ARROW_SPACING2;
|
|
9954
11670
|
const isHoriz = gripperSide === "top" || gripperSide === "bottom";
|
|
9955
11671
|
ARROW_COLORS_HEX.forEach((hex, idx) => {
|
|
9956
|
-
const ac =
|
|
11672
|
+
const ac = hexToRgb3(hex);
|
|
9957
11673
|
doc.setFillColor(ac.r, ac.g, ac.b);
|
|
9958
11674
|
if (isHoriz) {
|
|
9959
11675
|
const cx = (pw - totalMarks) / 2 + idx * ARROW_SPACING2;
|
|
@@ -10421,7 +12137,7 @@ var BECF_12101_DEFAULT_ATTRIBUTES = {
|
|
|
10421
12137
|
length: 100,
|
|
10422
12138
|
width: 50,
|
|
10423
12139
|
height: 150,
|
|
10424
|
-
glueArea:
|
|
12140
|
+
glueArea: 15
|
|
10425
12141
|
};
|
|
10426
12142
|
|
|
10427
12143
|
// src/statics/bags-pillows/becf-12109/DEFAULT_ATTRIBUTES.ts
|
|
@@ -10429,7 +12145,7 @@ var BECF_12109_DEFAULT_ATTRIBUTES = {
|
|
|
10429
12145
|
length: 100,
|
|
10430
12146
|
width: 50,
|
|
10431
12147
|
height: 150,
|
|
10432
|
-
glueArea:
|
|
12148
|
+
glueArea: 15
|
|
10433
12149
|
};
|
|
10434
12150
|
|
|
10435
12151
|
// src/statics/bags-pillows/becf-c-12101/DEFAULT_ATTRIBUTES.ts
|
|
@@ -10437,7 +12153,7 @@ var BECF_C_12101_DEFAULT_ATTRIBUTES = {
|
|
|
10437
12153
|
length: 100,
|
|
10438
12154
|
width: 50,
|
|
10439
12155
|
height: 150,
|
|
10440
|
-
glueArea:
|
|
12156
|
+
glueArea: 15
|
|
10441
12157
|
};
|
|
10442
12158
|
|
|
10443
12159
|
// src/statics/bags-pillows/becf-c-12109/DEFAULT_ATTRIBUTES.ts
|
|
@@ -10445,7 +12161,7 @@ var BECF_C_12109_DEFAULT_ATTRIBUTES = {
|
|
|
10445
12161
|
length: 100,
|
|
10446
12162
|
width: 50,
|
|
10447
12163
|
height: 150,
|
|
10448
|
-
glueArea:
|
|
12164
|
+
glueArea: 15
|
|
10449
12165
|
};
|
|
10450
12166
|
|
|
10451
12167
|
// src/statics/bags-pillows/becf-b-12101/DEFAULT_ATTRIBUTES.ts
|
|
@@ -10453,7 +12169,7 @@ var BECF_B_12101_DEFAULT_ATTRIBUTES = {
|
|
|
10453
12169
|
length: 100,
|
|
10454
12170
|
width: 50,
|
|
10455
12171
|
height: 150,
|
|
10456
|
-
glueArea:
|
|
12172
|
+
glueArea: 15
|
|
10457
12173
|
};
|
|
10458
12174
|
|
|
10459
12175
|
// src/statics/bags-pillows/becf-b-12109/DEFAULT_ATTRIBUTES.ts
|
|
@@ -10461,14 +12177,15 @@ var BECF_B_12109_DEFAULT_ATTRIBUTES = {
|
|
|
10461
12177
|
length: 100,
|
|
10462
12178
|
width: 50,
|
|
10463
12179
|
height: 150,
|
|
10464
|
-
glueArea:
|
|
12180
|
+
glueArea: 15
|
|
10465
12181
|
};
|
|
10466
12182
|
|
|
10467
12183
|
// src/statics/snap-lock-boxes/becf-10a0a/DEFAULT_ATTRIBUTES.ts
|
|
10468
12184
|
var BECF_10A0A_DEFAULT_ATTRIBUTES = {
|
|
10469
|
-
length:
|
|
12185
|
+
length: 100,
|
|
10470
12186
|
width: 50,
|
|
10471
|
-
height: 150
|
|
12187
|
+
height: 150,
|
|
12188
|
+
glueArea: 15
|
|
10472
12189
|
};
|
|
10473
12190
|
|
|
10474
12191
|
// src/statics/modelList.ts
|