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