desi77 0.1.8 → 0.1.10
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.ts +9 -1
- package/dist/index.js +1441 -40
- package/dist/pgdsvg/springOne_face.svg +10 -0
- package/dist/pgdsvg/springOne_side.svg +5 -0
- package/dist/pgdsvg/springOne_spring.svg +1 -0
- package/dist/pgdsvg/springOne_top.svg +5 -0
- package/dist/pgdsvg/springTorqueB_profile.svg +13 -0
- package/dist/pgdsvg/springTorqueC_profile.svg +13 -0
- package/dist/pgdsvg/springWorm_caps.svg +10 -0
- package/dist/pgdsvg/springWorm_mid.svg +1 -0
- package/dist/pgdsvg/springWorm_side.svg +1 -0
- package/dist/pgdsvg/src_springOne.svg +18 -0
- package/dist/pgdsvg/src_springTorqueB.svg +13 -0
- package/dist/pgdsvg/src_springTorqueC.svg +13 -0
- package/dist/pgdsvg/src_springWorm.svg +10 -0
- package/package.json +8 -7
package/dist/index.js
CHANGED
|
@@ -1040,14 +1040,14 @@ var springTorqueADef = {
|
|
|
1040
1040
|
|
|
1041
1041
|
// src/spring/plugTorque.ts
|
|
1042
1042
|
import {
|
|
1043
|
-
withinPiPi,
|
|
1043
|
+
withinPiPi as withinPiPi2,
|
|
1044
1044
|
point as point3,
|
|
1045
|
-
contour as
|
|
1045
|
+
contour as contour5,
|
|
1046
1046
|
contourCircle as contourCircle3,
|
|
1047
1047
|
figure as figure4,
|
|
1048
|
-
degToRad,
|
|
1049
|
-
radToDeg as
|
|
1050
|
-
ffix as
|
|
1048
|
+
degToRad as degToRad2,
|
|
1049
|
+
radToDeg as radToDeg5,
|
|
1050
|
+
ffix as ffix5,
|
|
1051
1051
|
pNumber as pNumber4,
|
|
1052
1052
|
pDropdown as pDropdown2,
|
|
1053
1053
|
pSectionSeparator as pSectionSeparator4,
|
|
@@ -1055,7 +1055,68 @@ import {
|
|
|
1055
1055
|
EBVolume as EBVolume4,
|
|
1056
1056
|
initGeom as initGeom4
|
|
1057
1057
|
} from "geometrix";
|
|
1058
|
+
import { triALLrLAA as triALLrLAA2 } from "triangule";
|
|
1059
|
+
|
|
1060
|
+
// src/spring/libPlugTorque.ts
|
|
1061
|
+
import {
|
|
1062
|
+
withinPiPi,
|
|
1063
|
+
contour as contour4,
|
|
1064
|
+
degToRad,
|
|
1065
|
+
radToDeg as radToDeg4,
|
|
1066
|
+
ffix as ffix4
|
|
1067
|
+
} from "geometrix";
|
|
1058
1068
|
import { triALLrLAA } from "triangule";
|
|
1069
|
+
function ctrPlugExtern(param, RbEmax) {
|
|
1070
|
+
let rLog = "";
|
|
1071
|
+
const aM = degToRad(param.aM);
|
|
1072
|
+
const Rt = param.Dt / 2;
|
|
1073
|
+
const aTooth = 2 * Math.PI / param.Nt;
|
|
1074
|
+
const aAddenE = param.ate * aTooth / 100;
|
|
1075
|
+
const Htde = param.Ht * param.dh / 100;
|
|
1076
|
+
const Htae = param.Ht * (param.ah + param.aeh) / 100;
|
|
1077
|
+
const RminE = Rt - Htde;
|
|
1078
|
+
const RbE = Rt + Htae;
|
|
1079
|
+
let aSlopeE = 0;
|
|
1080
|
+
let aAddE = aAddenE;
|
|
1081
|
+
if (Math.abs(aM) > 1e-3) {
|
|
1082
|
+
const tri3 = triALLrLAA(aM, Rt, RminE);
|
|
1083
|
+
const tri4 = triALLrLAA(withinPiPi(Math.PI + aM), Rt, RbE);
|
|
1084
|
+
const [, , a12e, , , , trilog3] = tri3;
|
|
1085
|
+
const [, , , , , a12h, trilog4] = tri4;
|
|
1086
|
+
rLog += trilog3 + trilog4;
|
|
1087
|
+
aSlopeE = -a12e + a12h;
|
|
1088
|
+
aAddE = aAddenE - 2 * a12h;
|
|
1089
|
+
}
|
|
1090
|
+
const aDedE = aTooth - 2 * aSlopeE - aAddE;
|
|
1091
|
+
if (RbE > RbEmax) {
|
|
1092
|
+
throw `err087: RbE ${RbE} is too large compare to RbEmax ${RbEmax}`;
|
|
1093
|
+
}
|
|
1094
|
+
const tooSmallAngle = 1e-4;
|
|
1095
|
+
if (aAddE < tooSmallAngle || aDedE < tooSmallAngle) {
|
|
1096
|
+
throw `err164: aAddE ${ffix4(radToDeg4(aAddE))} or aDedE ${ffix4(radToDeg4(aDedE))} are too small`;
|
|
1097
|
+
}
|
|
1098
|
+
const ctrToothE = contour4(RminE, 0);
|
|
1099
|
+
for (let ii = 0; ii < param.Nt; ii++) {
|
|
1100
|
+
const aRef = ii * aTooth;
|
|
1101
|
+
ctrToothE.addSegStrokeAP(aRef + aSlopeE, RbE).addCornerRounded(param.Rae);
|
|
1102
|
+
if (param.SnAae === 1) {
|
|
1103
|
+
ctrToothE.addPointAP(aRef + aSlopeE + aAddE / 2, RbE).addPointAP(aRef + aSlopeE + aAddE, RbE).addSegArc2();
|
|
1104
|
+
} else {
|
|
1105
|
+
ctrToothE.addSegStrokeAP(aRef + aSlopeE + aAddE, RbE);
|
|
1106
|
+
}
|
|
1107
|
+
ctrToothE.addCornerRounded(param.Rae);
|
|
1108
|
+
ctrToothE.addSegStrokeAP(aRef + 2 * aSlopeE + aAddE, RminE).addCornerRounded(param.Rde);
|
|
1109
|
+
if (param.SnAde === 1) {
|
|
1110
|
+
ctrToothE.addPointAP(aRef + aTooth - aDedE / 2, RminE).addPointAP(aRef + aTooth, RminE).addSegArc2();
|
|
1111
|
+
} else {
|
|
1112
|
+
ctrToothE.addSegStrokeAP(aRef + aTooth, RminE);
|
|
1113
|
+
}
|
|
1114
|
+
ctrToothE.addCornerRounded(param.Rde);
|
|
1115
|
+
}
|
|
1116
|
+
return [ctrToothE, rLog];
|
|
1117
|
+
}
|
|
1118
|
+
|
|
1119
|
+
// src/spring/plugTorque.ts
|
|
1059
1120
|
var pDef4 = {
|
|
1060
1121
|
partName: "plugTorque",
|
|
1061
1122
|
params: [
|
|
@@ -1137,7 +1198,7 @@ function pGeom4(t, param, suffix = "") {
|
|
|
1137
1198
|
rGeome.logstr += `${rGeome.partName} simTime: ${t}
|
|
1138
1199
|
`;
|
|
1139
1200
|
try {
|
|
1140
|
-
const aM =
|
|
1201
|
+
const aM = degToRad2(param.aM);
|
|
1141
1202
|
const Rt = param.Dt / 2;
|
|
1142
1203
|
const Ri = param.Di / 2;
|
|
1143
1204
|
const Re = param.De / 2;
|
|
@@ -1166,10 +1227,10 @@ function pGeom4(t, param, suffix = "") {
|
|
|
1166
1227
|
let aAddI = aAddenI;
|
|
1167
1228
|
let aAddE = aAddenE;
|
|
1168
1229
|
if (Math.abs(aM) > 1e-3) {
|
|
1169
|
-
const tri1 =
|
|
1170
|
-
const tri2 =
|
|
1171
|
-
const tri3 =
|
|
1172
|
-
const tri4 =
|
|
1230
|
+
const tri1 = triALLrLAA2(aM, Rt, RbI);
|
|
1231
|
+
const tri2 = triALLrLAA2(withinPiPi2(Math.PI + aM), Rt, RmaxI);
|
|
1232
|
+
const tri3 = triALLrLAA2(aM, Rt, RminE);
|
|
1233
|
+
const tri4 = triALLrLAA2(withinPiPi2(Math.PI + aM), Rt, RbE);
|
|
1173
1234
|
const [, , a12a, , , , trilog1] = tri1;
|
|
1174
1235
|
const [, , , , , a12d, trilog2] = tri2;
|
|
1175
1236
|
const [, , a12e, , , , trilog3] = tri3;
|
|
@@ -1183,14 +1244,15 @@ function pGeom4(t, param, suffix = "") {
|
|
|
1183
1244
|
const aDedI = aTooth - 2 * aSlopeI - aAddI;
|
|
1184
1245
|
const aDedE = aTooth - 2 * aSlopeE - aAddE;
|
|
1185
1246
|
const aSlack = (param.ate - param.ati) * aTooth / 100;
|
|
1247
|
+
const RbEmax = Re - RTe - param.Ee;
|
|
1186
1248
|
if (RminI < 0.1) {
|
|
1187
1249
|
throw `err087: RminI ${RminI} is too small because of Di ${param.Di}, DTi ${param.DTi} or Ei ${param.Ei}`;
|
|
1188
1250
|
}
|
|
1189
1251
|
if (adTi < 2 * aMindTi) {
|
|
1190
|
-
throw `err131: adTi ${
|
|
1252
|
+
throw `err131: adTi ${ffix5(radToDeg5(adTi))} is too small compare to aMindTi ${ffix5(radToDeg5(aMindTi))} degree`;
|
|
1191
1253
|
}
|
|
1192
1254
|
if (adTe < 2 * aMindTe) {
|
|
1193
|
-
throw `err134: adTe ${
|
|
1255
|
+
throw `err134: adTe ${ffix5(radToDeg5(adTe))} is too small compare to aMindTe ${ffix5(radToDeg5(aMindTe))} degree`;
|
|
1194
1256
|
}
|
|
1195
1257
|
if (param.ati > param.ate) {
|
|
1196
1258
|
throw `err145: ate ${param.ate} is too small compare to ati ${param.ati} %`;
|
|
@@ -1198,27 +1260,27 @@ function pGeom4(t, param, suffix = "") {
|
|
|
1198
1260
|
if (RbI < Ri + RTi + param.Ei) {
|
|
1199
1261
|
throw `err087: RbI ${RbI} is too small compare to Di ${param.Di}, DTi ${param.DTi} or Ei ${param.Ei}`;
|
|
1200
1262
|
}
|
|
1201
|
-
if (RbE >
|
|
1263
|
+
if (RbE > RbEmax) {
|
|
1202
1264
|
throw `err087: RbE ${RbE} is too large compare to De ${param.De}, DTe ${param.DTe} or Ee ${param.Ee}`;
|
|
1203
1265
|
}
|
|
1204
1266
|
const tooSmallAngle = 1e-4;
|
|
1205
1267
|
if (aAddI < tooSmallAngle || aDedI < tooSmallAngle) {
|
|
1206
|
-
throw `err161: aAddI ${
|
|
1268
|
+
throw `err161: aAddI ${ffix5(radToDeg5(aAddI))} or aDedI ${ffix5(radToDeg5(aDedI))} are too small`;
|
|
1207
1269
|
}
|
|
1208
1270
|
if (aAddE < tooSmallAngle || aDedE < tooSmallAngle) {
|
|
1209
|
-
throw `err164: aAddE ${
|
|
1271
|
+
throw `err164: aAddE ${ffix5(radToDeg5(aAddE))} or aDedE ${ffix5(radToDeg5(aDedE))} are too small`;
|
|
1210
1272
|
}
|
|
1211
|
-
rGeome.logstr += `Extern: Dmax ${
|
|
1273
|
+
rGeome.logstr += `Extern: Dmax ${ffix5(2 * RmaxE)}, Dmin ${ffix5(2 * RminE)} mm
|
|
1212
1274
|
`;
|
|
1213
|
-
rGeome.logstr += `Intern: Dmax ${
|
|
1275
|
+
rGeome.logstr += `Intern: Dmax ${ffix5(2 * RmaxI)}, Dmin ${ffix5(2 * RminI)} mm
|
|
1214
1276
|
`;
|
|
1215
|
-
rGeome.logstr += `aSlack: ${
|
|
1277
|
+
rGeome.logstr += `aSlack: ${ffix5(radToDeg5(aSlack))} degree
|
|
1216
1278
|
`;
|
|
1217
|
-
rGeome.logstr += `Tooth: Ht ${param.Ht}, moduli ${
|
|
1279
|
+
rGeome.logstr += `Tooth: Ht ${param.Ht}, moduli ${ffix5(moduli)}, Hti ${ffix5(Htai + Htdi)}, Hte ${ffix5(Htae + Htde)} mm
|
|
1218
1280
|
`;
|
|
1219
|
-
rGeome.logstr += `Tooth angle intern: aM ${param.aM}, aM[adden] ${
|
|
1281
|
+
rGeome.logstr += `Tooth angle intern: aM ${param.aM}, aM[adden] ${ffix5(radToDeg5(-aAddenI / 2))}, aM[deden] ${ffix5(radToDeg5((aTooth - aAddenI) / 2))} degree
|
|
1220
1282
|
`;
|
|
1221
|
-
rGeome.logstr += `Tooth angle extern: aM ${param.aM}, aM[adden] ${
|
|
1283
|
+
rGeome.logstr += `Tooth angle extern: aM ${param.aM}, aM[adden] ${ffix5(radToDeg5(-aAddenE / 2))}, aM[deden] ${ffix5(radToDeg5((aTooth - aAddenE) / 2))} degree
|
|
1222
1284
|
`;
|
|
1223
1285
|
const ctrsI = [];
|
|
1224
1286
|
ctrsI.push(contourCircle3(0, 0, RminI));
|
|
@@ -1226,7 +1288,7 @@ function pGeom4(t, param, suffix = "") {
|
|
|
1226
1288
|
const p1 = point3(0, 0).translatePolar(ii * adTi, Ri);
|
|
1227
1289
|
ctrsI.push(contourCircle3(p1.cx, p1.cy, RTi));
|
|
1228
1290
|
}
|
|
1229
|
-
const ctrToothI =
|
|
1291
|
+
const ctrToothI = contour5(RbI, 0);
|
|
1230
1292
|
for (let ii = 0; ii < param.Nt; ii++) {
|
|
1231
1293
|
const aRef = ii * aTooth;
|
|
1232
1294
|
ctrToothI.addSegStrokeAP(aRef + aSlopeI, RmaxI).addCornerRounded(param.Rai);
|
|
@@ -1250,24 +1312,8 @@ function pGeom4(t, param, suffix = "") {
|
|
|
1250
1312
|
const p1 = point3(0, 0).translatePolar(ii * adTe, Re);
|
|
1251
1313
|
ctrsE.push(contourCircle3(p1.cx, p1.cy, RTe));
|
|
1252
1314
|
}
|
|
1253
|
-
const ctrToothE =
|
|
1254
|
-
|
|
1255
|
-
const aRef = ii * aTooth;
|
|
1256
|
-
ctrToothE.addSegStrokeAP(aRef + aSlopeE, RbE).addCornerRounded(param.Rae);
|
|
1257
|
-
if (param.SnAae === 1) {
|
|
1258
|
-
ctrToothE.addPointAP(aRef + aSlopeE + aAddE / 2, RbE).addPointAP(aRef + aSlopeE + aAddE, RbE).addSegArc2();
|
|
1259
|
-
} else {
|
|
1260
|
-
ctrToothE.addSegStrokeAP(aRef + aSlopeE + aAddE, RbE);
|
|
1261
|
-
}
|
|
1262
|
-
ctrToothE.addCornerRounded(param.Rae);
|
|
1263
|
-
ctrToothE.addSegStrokeAP(aRef + 2 * aSlopeE + aAddE, RminE).addCornerRounded(param.Rde);
|
|
1264
|
-
if (param.SnAde === 1) {
|
|
1265
|
-
ctrToothE.addPointAP(aRef + aTooth - aDedE / 2, RminE).addPointAP(aRef + aTooth, RminE).addSegArc2();
|
|
1266
|
-
} else {
|
|
1267
|
-
ctrToothE.addSegStrokeAP(aRef + aTooth, RminE);
|
|
1268
|
-
}
|
|
1269
|
-
ctrToothE.addCornerRounded(param.Rde);
|
|
1270
|
-
}
|
|
1315
|
+
const [ctrToothE, logE] = ctrPlugExtern(param, RbEmax);
|
|
1316
|
+
rGeome.logstr += logE;
|
|
1271
1317
|
figIntern.addMainOI([ctrToothI, ...ctrsI]);
|
|
1272
1318
|
figIntern.addSecond(contourCircle3(0, 0, Rt));
|
|
1273
1319
|
figIntern.addSecond(ctrToothE);
|
|
@@ -1342,10 +1388,1365 @@ var plugTorqueDef = {
|
|
|
1342
1388
|
pDef: pDef4,
|
|
1343
1389
|
pGeom: pGeom4
|
|
1344
1390
|
};
|
|
1391
|
+
|
|
1392
|
+
// src/spring/springTorqueB.ts
|
|
1393
|
+
import {
|
|
1394
|
+
withinZeroPi,
|
|
1395
|
+
point as point4,
|
|
1396
|
+
contour as contour6,
|
|
1397
|
+
contourCircle as contourCircle4,
|
|
1398
|
+
figure as figure5,
|
|
1399
|
+
radToDeg as radToDeg6,
|
|
1400
|
+
ffix as ffix6,
|
|
1401
|
+
pNumber as pNumber5,
|
|
1402
|
+
pCheckbox as pCheckbox3,
|
|
1403
|
+
pDropdown as pDropdown3,
|
|
1404
|
+
pSectionSeparator as pSectionSeparator5,
|
|
1405
|
+
EExtrude as EExtrude5,
|
|
1406
|
+
EBVolume as EBVolume5,
|
|
1407
|
+
initGeom as initGeom5
|
|
1408
|
+
} from "geometrix";
|
|
1409
|
+
var pDef5 = {
|
|
1410
|
+
partName: "springTorqueB",
|
|
1411
|
+
params: [
|
|
1412
|
+
//pNumber(name, unit, init, min, max, step)
|
|
1413
|
+
pNumber5("De", "mm", 80, 1, 1e3, 1),
|
|
1414
|
+
pNumber5("Ne", "hole", 16, 0, 400, 1),
|
|
1415
|
+
pNumber5("DTe", "mm", 2, 0.1, 50, 0.1),
|
|
1416
|
+
pNumber5("Ee", "mm", 1, 0.1, 50, 0.1),
|
|
1417
|
+
pCheckbox3("Teeth", true),
|
|
1418
|
+
pNumber5("Th", "mm", 3, 0.1, 100, 0.1),
|
|
1419
|
+
pSectionSeparator5("Internal ring"),
|
|
1420
|
+
pNumber5("Di", "mm", 30, 1, 1e3, 1),
|
|
1421
|
+
pNumber5("Ni", "hole", 8, 0, 400, 1),
|
|
1422
|
+
pNumber5("DTi", "mm", 2, 0.1, 50, 0.1),
|
|
1423
|
+
pNumber5("Ei", "mm", 1, 0.1, 50, 0.1),
|
|
1424
|
+
pSectionSeparator5("Spring"),
|
|
1425
|
+
pNumber5("Ns", "spring", 6, 4, 60, 1),
|
|
1426
|
+
pNumber5("aEs", "%", 10, 1, 90, 1),
|
|
1427
|
+
pNumber5("Esi", "%", 10, 1, 90, 1),
|
|
1428
|
+
pNumber5("Ese", "%", 10, 1, 90, 1),
|
|
1429
|
+
pNumber5("Nk", "zigzag", 3, 1, 100, 1),
|
|
1430
|
+
pNumber5("Wk", "mm", 1, 0.1, 20, 0.1),
|
|
1431
|
+
pNumber5("Wc", "mm", 1, 0.1, 20, 0.1),
|
|
1432
|
+
pNumber5("Rrsi", "mm", 1, 0, 20, 0.1),
|
|
1433
|
+
pNumber5("Rrse", "mm", 1, 0, 20, 0.1),
|
|
1434
|
+
pSectionSeparator5("Tooth Profile"),
|
|
1435
|
+
pNumber5("Nt", "teeth", 8, 1, 1e3, 1),
|
|
1436
|
+
pNumber5("Dt", "mm", 20, 0.1, 1e3, 0.1),
|
|
1437
|
+
pNumber5("Ht", "mm", 2, 0.1, 100, 0.1),
|
|
1438
|
+
pNumber5("ate", "%", 52, 1, 99, 1),
|
|
1439
|
+
pNumber5("ah", "%", 100, 1, 400, 1),
|
|
1440
|
+
pNumber5("dh", "%", 100, 1, 400, 1),
|
|
1441
|
+
pNumber5("aeh", "%", 10, 0, 100, 1),
|
|
1442
|
+
pNumber5("aM", "degree", 0, -30, 30, 0.1),
|
|
1443
|
+
pSectionSeparator5("Tooth profile details"),
|
|
1444
|
+
pDropdown3("SnAae", ["stroke", "arc"]),
|
|
1445
|
+
pDropdown3("SnAde", ["stroke", "arc"]),
|
|
1446
|
+
pNumber5("Rae", "mm", 1, 0, 50, 0.1),
|
|
1447
|
+
pNumber5("Rde", "mm", 1, 0, 50, 0.1)
|
|
1448
|
+
],
|
|
1449
|
+
paramSvg: {
|
|
1450
|
+
De: "springTorqueB_profile.svg",
|
|
1451
|
+
Ne: "springTorqueB_profile.svg",
|
|
1452
|
+
DTe: "springTorqueB_profile.svg",
|
|
1453
|
+
Ee: "springTorqueB_profile.svg",
|
|
1454
|
+
Teeth: "springTorqueB_profile.svg",
|
|
1455
|
+
Th: "springTorqueB_profile.svg",
|
|
1456
|
+
Di: "springTorqueB_profile.svg",
|
|
1457
|
+
Ni: "springTorqueB_profile.svg",
|
|
1458
|
+
DTi: "springTorqueB_profile.svg",
|
|
1459
|
+
Ei: "springTorqueB_profile.svg",
|
|
1460
|
+
Ns: "springTorqueB_profile.svg",
|
|
1461
|
+
aEs: "springTorqueB_profile.svg",
|
|
1462
|
+
Esi: "springTorqueB_profile.svg",
|
|
1463
|
+
Ese: "springTorqueB_profile.svg",
|
|
1464
|
+
Nk: "springTorqueB_profile.svg",
|
|
1465
|
+
Wk: "springTorqueB_profile.svg",
|
|
1466
|
+
Wc: "springTorqueB_profile.svg",
|
|
1467
|
+
Rrsi: "springTorqueB_profile.svg",
|
|
1468
|
+
Rrse: "springTorqueB_profile.svg",
|
|
1469
|
+
Nt: "plugTorque_teeth_radial.svg",
|
|
1470
|
+
Dt: "plugTorque_teeth_radial.svg",
|
|
1471
|
+
Ht: "plugTorque_teeth_radial.svg",
|
|
1472
|
+
ate: "plugTorque_teeth_radial.svg",
|
|
1473
|
+
dh: "plugTorque_teeth_radial.svg",
|
|
1474
|
+
ah: "plugTorque_teeth_radial.svg",
|
|
1475
|
+
aeh: "plugTorque_teeth_radial.svg",
|
|
1476
|
+
aM: "plugTorque_teeth_adden.svg",
|
|
1477
|
+
SnAae: "plugTorque_teeth_radial.svg",
|
|
1478
|
+
SnAde: "plugTorque_teeth_radial.svg",
|
|
1479
|
+
Rae: "plugTorque_teeth_radial.svg",
|
|
1480
|
+
Rde: "plugTorque_teeth_radial.svg"
|
|
1481
|
+
},
|
|
1482
|
+
sim: {
|
|
1483
|
+
tMax: 180,
|
|
1484
|
+
tStep: 0.5,
|
|
1485
|
+
tUpdate: 500
|
|
1486
|
+
// every 0.5 second
|
|
1487
|
+
}
|
|
1488
|
+
};
|
|
1489
|
+
function calcAzig(cx1, cx2, r1, r2) {
|
|
1490
|
+
let ra12 = Math.PI / 2;
|
|
1491
|
+
let ra21 = -Math.PI / 2;
|
|
1492
|
+
if (cx2 > cx1) {
|
|
1493
|
+
const triOpp = cx2 - cx1;
|
|
1494
|
+
const triAdj = r1 + r2;
|
|
1495
|
+
const lDiag = Math.sqrt(triAdj ** 2 + triOpp ** 2);
|
|
1496
|
+
const aDiag = Math.atan2(triOpp, triAdj);
|
|
1497
|
+
const lDiag1 = lDiag * r1 / triAdj;
|
|
1498
|
+
const aTri1 = Math.acos(r1 / lDiag1);
|
|
1499
|
+
ra12 = Math.PI / 2 - aDiag - aTri1;
|
|
1500
|
+
ra21 = -Math.PI / 2 - aDiag - aTri1;
|
|
1501
|
+
}
|
|
1502
|
+
return [ra12, ra21];
|
|
1503
|
+
}
|
|
1504
|
+
function calcAzag(cx2, cx1, r2, r1) {
|
|
1505
|
+
let ra22 = Math.PI / 2;
|
|
1506
|
+
let ra11 = -Math.PI / 2;
|
|
1507
|
+
if (cx2 > cx1) {
|
|
1508
|
+
const triOpp = cx2 - cx1;
|
|
1509
|
+
const triAdj = r1 + r2;
|
|
1510
|
+
const lDiag = Math.sqrt(triAdj ** 2 + triOpp ** 2);
|
|
1511
|
+
const aDiag = Math.atan2(triOpp, triAdj);
|
|
1512
|
+
const lDiag2 = lDiag * r2 / triAdj;
|
|
1513
|
+
const aTri2 = Math.acos(r2 / lDiag2);
|
|
1514
|
+
ra22 = Math.PI / 2 + aDiag + aTri2;
|
|
1515
|
+
ra11 = -Math.PI / 2 + aDiag + aTri2;
|
|
1516
|
+
}
|
|
1517
|
+
return [ra22, ra11];
|
|
1518
|
+
}
|
|
1519
|
+
function pGeom5(t, param, suffix = "") {
|
|
1520
|
+
const rGeome = initGeom5(pDef5.partName + suffix);
|
|
1521
|
+
const figProfile = figure5();
|
|
1522
|
+
rGeome.logstr += `${rGeome.partName} simTime: ${t}
|
|
1523
|
+
`;
|
|
1524
|
+
try {
|
|
1525
|
+
const Re = param.De / 2;
|
|
1526
|
+
const RTe = param.DTe / 2;
|
|
1527
|
+
const Ri = param.Di / 2;
|
|
1528
|
+
const RTi = param.DTi / 2;
|
|
1529
|
+
const Rmax = Re + RTe + param.Ee;
|
|
1530
|
+
const Rmin1 = Ri - RTi - param.Ei;
|
|
1531
|
+
const Rse = Re - RTe - param.Ee;
|
|
1532
|
+
const Rsi = Ri + RTi + param.Ei;
|
|
1533
|
+
const dRs = Rse - Rsi;
|
|
1534
|
+
const Esi = dRs * param.Esi / 100;
|
|
1535
|
+
const Ese = dRs * param.Ese / 100;
|
|
1536
|
+
const dRLs = dRs - Esi - Ese;
|
|
1537
|
+
const aSpringStep = 2 * Math.PI / param.Ns;
|
|
1538
|
+
const aEs = aSpringStep * param.aEs / 100;
|
|
1539
|
+
const aSpring = aSpringStep - aEs;
|
|
1540
|
+
const HLs = (Rse - Ese) * Math.sin(aSpring);
|
|
1541
|
+
const iHLs = HLs / (2 * param.Nk);
|
|
1542
|
+
const Rk = iHLs / 2;
|
|
1543
|
+
const Ek = iHLs - param.Wk;
|
|
1544
|
+
if (Rmin1 < 0.1) {
|
|
1545
|
+
throw `err120: Di ${param.Di} is too small compare to DTi ${param.DTi}, Ei ${param.Ei}`;
|
|
1546
|
+
}
|
|
1547
|
+
if (dRLs < 2 * param.Ws) {
|
|
1548
|
+
throw `err133: dRLs ${dRLs} is too small compare to Ws ${param.Ws}`;
|
|
1549
|
+
}
|
|
1550
|
+
if (Esi < 0.6 * param.Ws) {
|
|
1551
|
+
throw `err136: Esi ${Esi} is too small compare to Ws ${param.Ws}`;
|
|
1552
|
+
}
|
|
1553
|
+
if (Ese < 0.6 * param.Ws) {
|
|
1554
|
+
throw `err139: Ese ${Ese} is too small compare to Ws ${param.Ws}`;
|
|
1555
|
+
}
|
|
1556
|
+
if (Ek < 0.1) {
|
|
1557
|
+
throw `err145: Ek ${Ek} is too small`;
|
|
1558
|
+
}
|
|
1559
|
+
if (dRLs < 2 * Rk) {
|
|
1560
|
+
throw `err148: dRLs ${dRLs} is too small compare to Rk ${Rk}. Increase Nk ${param.Nk}`;
|
|
1561
|
+
}
|
|
1562
|
+
const aHMinI = 2 * Math.asin((RTi + 0.5 * param.Ei) / Ri);
|
|
1563
|
+
const aHI = param.Ni > 0 ? 2 * Math.PI / param.Ni : 3.14;
|
|
1564
|
+
if (aHI < aHMinI) {
|
|
1565
|
+
throw `err126: aHI ${ffix6(radToDeg6(aHI))} is too small compare to aHMinI ${ffix6(radToDeg6(aHMinI))} degree`;
|
|
1566
|
+
}
|
|
1567
|
+
const aHMinE = 2 * Math.asin((RTe + 0.5 * param.Ee) / Re);
|
|
1568
|
+
const aHE = param.Ne > 0 ? 2 * Math.PI / param.Ne : 3.14;
|
|
1569
|
+
if (aHE < aHMinE) {
|
|
1570
|
+
throw `err131: aHE ${ffix6(radToDeg6(aHE))} is too small compare to aHMinE ${ffix6(radToDeg6(aHMinE))} degree`;
|
|
1571
|
+
}
|
|
1572
|
+
const pts1 = [];
|
|
1573
|
+
const Rk1 = Rsi + Esi + dRLs - Rk;
|
|
1574
|
+
for (let ii = 0; ii < param.Nk; ii++) {
|
|
1575
|
+
const ky = (ii * 4 + 1) * Rk;
|
|
1576
|
+
const kx = Math.sqrt(Rk1 ** 2 - ky ** 2);
|
|
1577
|
+
pts1.push(point4(kx, ky));
|
|
1578
|
+
}
|
|
1579
|
+
const pts2 = [];
|
|
1580
|
+
const Rk2 = Rsi + Esi + Rk;
|
|
1581
|
+
const ak2 = aSpring < Math.PI / 2 - 1e-4 ? 1 / Math.tan(aSpring) : 0;
|
|
1582
|
+
const kak2 = Rk / Math.sin(aSpring);
|
|
1583
|
+
for (let ii = 0; ii < param.Nk; ii++) {
|
|
1584
|
+
const ky = (ii * 4 + 3) * Rk;
|
|
1585
|
+
let kx = ak2 * ky + kak2;
|
|
1586
|
+
if (kx ** 2 + ky ** 2 < Rk2 ** 2) {
|
|
1587
|
+
kx = Math.sqrt(Rk2 ** 2 - ky ** 2);
|
|
1588
|
+
}
|
|
1589
|
+
pts2.push(point4(kx, ky));
|
|
1590
|
+
}
|
|
1591
|
+
const Wk2 = param.Wk / 2;
|
|
1592
|
+
const a14 = Math.asin(Wk2 / Rsi);
|
|
1593
|
+
const a23 = Math.asin(Wk2 / Rse);
|
|
1594
|
+
const pt1 = point4(0, 0).translatePolar(a14, Rsi);
|
|
1595
|
+
const pt2 = point4(0, 0).translatePolar(aSpring + a23, Rse);
|
|
1596
|
+
const pt3 = point4(0, 0).translatePolar(aSpring - a23, Rse);
|
|
1597
|
+
const pt4 = point4(0, 0).translatePolar(-a14, Rsi);
|
|
1598
|
+
const Rks = Rk - Wk2;
|
|
1599
|
+
const Rkl = Rk + Wk2;
|
|
1600
|
+
rGeome.logstr += `Dmax ${ffix6(2 * Rmax)}, Dmin1 ${ffix6(2 * Rmin1)} mm
|
|
1601
|
+
`;
|
|
1602
|
+
rGeome.logstr += `Spring area: aSpring ${ffix6(radToDeg6(aSpring))} degree, dRLs ${ffix6(dRLs)}, HLs ${ffix6(HLs)} mm
|
|
1603
|
+
`;
|
|
1604
|
+
rGeome.logstr += `Spring zigzag: Ek ${ffix6(Ek)}, Rk ${ffix6(Rk)} mm
|
|
1605
|
+
`;
|
|
1606
|
+
const ctrExt = contourCircle4(0, 0, Rmax);
|
|
1607
|
+
const ctrsH = [];
|
|
1608
|
+
if (param.Teeth === 1) {
|
|
1609
|
+
const [ctrToothE, logE] = ctrPlugExtern(param, Rmin1);
|
|
1610
|
+
rGeome.logstr += logE;
|
|
1611
|
+
ctrsH.push(ctrToothE);
|
|
1612
|
+
} else {
|
|
1613
|
+
ctrsH.push(contourCircle4(0, 0, Rmin1));
|
|
1614
|
+
}
|
|
1615
|
+
for (let ii = 0; ii < param.Ni; ii++) {
|
|
1616
|
+
const p1 = point4(0, 0).translatePolar(ii * aHI, Ri);
|
|
1617
|
+
ctrsH.push(contourCircle4(p1.cx, p1.cy, RTi));
|
|
1618
|
+
}
|
|
1619
|
+
for (let ii = 0; ii < param.Ne; ii++) {
|
|
1620
|
+
const p1 = point4(0, 0).translatePolar(ii * aHE, Re);
|
|
1621
|
+
ctrsH.push(contourCircle4(p1.cx, p1.cy, RTe));
|
|
1622
|
+
}
|
|
1623
|
+
const ctrSpringEnv = contour6(Rsi + Esi, 0).addSegStrokeAP(0, Rse - Ese).addPointAP(aSpring / 2, Rse - Ese).addPointAP(aSpring, Rse - Ese).addSegArc2().addSegStrokeAP(aSpring, Rsi + Esi).addPointAP(aSpring / 2, Rsi + Esi).addPointAP(0, Rsi + Esi).addSegArc2();
|
|
1624
|
+
figProfile.addSecond(ctrSpringEnv);
|
|
1625
|
+
figProfile.addSecond(ctrSpringEnv.rotate(0, 0, aSpringStep));
|
|
1626
|
+
figProfile.addSecond(ctrSpringEnv.rotate(0, 0, -aSpringStep));
|
|
1627
|
+
for (let ii = 0; ii < param.Nk; ii++) {
|
|
1628
|
+
figProfile.addSecond(contourCircle4(pts1[ii].cx, pts1[ii].cy, Rk));
|
|
1629
|
+
figProfile.addSecond(contourCircle4(pts2[ii].cx, pts2[ii].cy, Rk));
|
|
1630
|
+
}
|
|
1631
|
+
const ctrPartial1 = contour6(pt1.cx, pt1.cy);
|
|
1632
|
+
for (let ii = 0; ii < param.Nk; ii++) {
|
|
1633
|
+
let a11 = -Math.PI / 2;
|
|
1634
|
+
const [a12, a21] = calcAzig(pts1[ii].cx, pts2[ii].cx, Rks, Rkl);
|
|
1635
|
+
let a22 = Math.PI / 2;
|
|
1636
|
+
if (ii > 0) {
|
|
1637
|
+
const [, tmpa11] = calcAzag(pts2[ii - 1].cx, pts1[ii].cx, Rkl, Rks);
|
|
1638
|
+
a11 = tmpa11;
|
|
1639
|
+
}
|
|
1640
|
+
if (ii < param.Nk - 1) {
|
|
1641
|
+
const [tmpa22] = calcAzag(pts2[ii].cx, pts1[ii + 1].cx, Rkl, Rks);
|
|
1642
|
+
a22 = tmpa22;
|
|
1643
|
+
}
|
|
1644
|
+
const p11 = pts1[ii].translatePolar(a11, Rks);
|
|
1645
|
+
const p1b = pts1[ii].translatePolar(a11 + withinZeroPi((a12 - a11) / 2), Rks);
|
|
1646
|
+
const p12 = pts1[ii].translatePolar(a12, Rks);
|
|
1647
|
+
const p21 = pts2[ii].translatePolar(a21, Rkl);
|
|
1648
|
+
const p2b = pts2[ii].translatePolar(a21 - withinZeroPi((a21 - a22) / 2), Rkl);
|
|
1649
|
+
const p22 = pts2[ii].translatePolar(a22, Rkl);
|
|
1650
|
+
ctrPartial1.addSegStrokeA(p11.cx, p11.cy).addPointA(p1b.cx, p1b.cy).addPointA(p12.cx, p12.cy).addSegArc2().addSegStrokeA(p21.cx, p21.cy);
|
|
1651
|
+
if (ii < param.Nk - 1) {
|
|
1652
|
+
ctrPartial1.addPointA(p2b.cx, p2b.cy).addPointA(p22.cx, p22.cy).addSegArc2();
|
|
1653
|
+
}
|
|
1654
|
+
}
|
|
1655
|
+
const [, lasta21] = calcAzig(pts1[param.Nk - 1].cx, pts2[param.Nk - 1].cx, Rks, Rkl);
|
|
1656
|
+
const a2c = Math.PI / 2 + aSpring;
|
|
1657
|
+
const a2b = lasta21 - withinZeroPi((lasta21 - a2c) / 2);
|
|
1658
|
+
const pt2b = pts2[param.Nk - 1].translatePolar(a2b, Rkl);
|
|
1659
|
+
const pt2c = pts2[param.Nk - 1].translatePolar(a2c, Rkl);
|
|
1660
|
+
const pt3b = pts2[param.Nk - 1].translatePolar(a2b, Rks);
|
|
1661
|
+
const pt3c = pts2[param.Nk - 1].translatePolar(a2c, Rks);
|
|
1662
|
+
ctrPartial1.addPointA(pt2b.cx, pt2b.cy).addPointA(pt2c.cx, pt2c.cy).addSegArc2().addSegStrokeA(pt2.cx, pt2.cy);
|
|
1663
|
+
const [, firsta22] = calcAzig(pts1[param.Nk - 1].cx, pts2[param.Nk - 1].cx, Rkl, Rks);
|
|
1664
|
+
const firstp22 = pts2[param.Nk - 1].translatePolar(firsta22, Rks);
|
|
1665
|
+
const ctrPartial2 = contour6(pt3.cx, pt3.cy).addSegStrokeA(pt3c.cx, pt3c.cy).addPointA(pt3b.cx, pt3b.cy).addPointA(firstp22.cx, firstp22.cy).addSegArc2();
|
|
1666
|
+
for (let ii = param.Nk - 1; ii >= 0; ii--) {
|
|
1667
|
+
let a21 = Math.PI / 2;
|
|
1668
|
+
let a12 = -Math.PI / 2;
|
|
1669
|
+
const [a11, a22] = calcAzig(pts1[ii].cx, pts2[ii].cx, Rkl, Rks);
|
|
1670
|
+
if (ii > 0) {
|
|
1671
|
+
const [, tmpa12] = calcAzag(pts2[ii - 1].cx, pts1[ii].cx, Rks, Rkl);
|
|
1672
|
+
a12 = tmpa12;
|
|
1673
|
+
}
|
|
1674
|
+
if (ii < param.Nk - 1) {
|
|
1675
|
+
const [tmpa21] = calcAzag(pts2[ii].cx, pts1[ii + 1].cx, Rks, Rkl);
|
|
1676
|
+
a21 = tmpa21;
|
|
1677
|
+
}
|
|
1678
|
+
const p11 = pts1[ii].translatePolar(a11, Rkl);
|
|
1679
|
+
const p1b = pts1[ii].translatePolar(a11 - withinZeroPi((a11 - a12) / 2), Rkl);
|
|
1680
|
+
const p12 = pts1[ii].translatePolar(a12, Rkl);
|
|
1681
|
+
const p21 = pts2[ii].translatePolar(a21, Rks);
|
|
1682
|
+
const p2b = pts2[ii].translatePolar(a21 + withinZeroPi((a22 - a21) / 2), Rks);
|
|
1683
|
+
const p22 = pts2[ii].translatePolar(a22, Rks);
|
|
1684
|
+
if (ii < param.Nk - 1) {
|
|
1685
|
+
ctrPartial2.addSegStrokeA(p21.cx, p21.cy).addPointA(p2b.cx, p2b.cy).addPointA(p22.cx, p22.cy).addSegArc2();
|
|
1686
|
+
}
|
|
1687
|
+
ctrPartial2.addSegStrokeA(p11.cx, p11.cy).addPointA(p1b.cx, p1b.cy).addPointA(p12.cx, p12.cy).addSegArc2();
|
|
1688
|
+
}
|
|
1689
|
+
ctrPartial2.addSegStrokeA(pt4.cx, pt4.cy);
|
|
1690
|
+
const ctrSpringHollow = contour6(pt1.cx, pt1.cy).addCornerRounded(param.Rrsi).addPartial(ctrPartial1).addCornerRounded(param.Rrse).addPointAP(aSpring + aSpringStep / 2, Rse).addPointAP(aSpring + aSpringStep - a23, Rse).addSegArc2().addCornerRounded(param.Rrse).addPartial(ctrPartial2.rotate(0, 0, aSpringStep)).addCornerRounded(param.Rrsi).addPointAP(aSpringStep / 2, Rsi).addPointAP(a14, Rsi).addSegArc2();
|
|
1691
|
+
for (let ii = 0; ii < param.Ns; ii++) {
|
|
1692
|
+
ctrsH.push(ctrSpringHollow.rotate(0, 0, ii * aSpringStep));
|
|
1693
|
+
}
|
|
1694
|
+
figProfile.addMainOI([ctrExt, ...ctrsH]);
|
|
1695
|
+
rGeome.fig = {
|
|
1696
|
+
faceProfile: figProfile
|
|
1697
|
+
};
|
|
1698
|
+
const designName = rGeome.partName;
|
|
1699
|
+
rGeome.vol = {
|
|
1700
|
+
extrudes: [
|
|
1701
|
+
{
|
|
1702
|
+
outName: `subpax_${designName}_profile`,
|
|
1703
|
+
face: `${designName}_faceProfile`,
|
|
1704
|
+
extrudeMethod: EExtrude5.eLinearOrtho,
|
|
1705
|
+
length: param.Th,
|
|
1706
|
+
rotate: [0, 0, 0],
|
|
1707
|
+
translate: [0, 0, 0]
|
|
1708
|
+
}
|
|
1709
|
+
],
|
|
1710
|
+
volumes: [
|
|
1711
|
+
{
|
|
1712
|
+
outName: `pax_${designName}`,
|
|
1713
|
+
boolMethod: EBVolume5.eIdentity,
|
|
1714
|
+
inList: [`subpax_${designName}_profile`]
|
|
1715
|
+
}
|
|
1716
|
+
]
|
|
1717
|
+
};
|
|
1718
|
+
rGeome.sub = {};
|
|
1719
|
+
rGeome.logstr += "springTorqueB drawn successfully!\n";
|
|
1720
|
+
rGeome.calcErr = false;
|
|
1721
|
+
} catch (emsg) {
|
|
1722
|
+
rGeome.logstr += emsg;
|
|
1723
|
+
console.log(emsg);
|
|
1724
|
+
}
|
|
1725
|
+
return rGeome;
|
|
1726
|
+
}
|
|
1727
|
+
var springTorqueBDef = {
|
|
1728
|
+
pTitle: "springTorqueB",
|
|
1729
|
+
pDescription: "spring disc for smooth torque transmission",
|
|
1730
|
+
pDef: pDef5,
|
|
1731
|
+
pGeom: pGeom5
|
|
1732
|
+
};
|
|
1733
|
+
|
|
1734
|
+
// src/spring/springTorqueC.ts
|
|
1735
|
+
import {
|
|
1736
|
+
point as point5,
|
|
1737
|
+
contour as contour7,
|
|
1738
|
+
contourCircle as contourCircle5,
|
|
1739
|
+
figure as figure6,
|
|
1740
|
+
radToDeg as radToDeg7,
|
|
1741
|
+
ffix as ffix7,
|
|
1742
|
+
pNumber as pNumber6,
|
|
1743
|
+
pCheckbox as pCheckbox4,
|
|
1744
|
+
pDropdown as pDropdown4,
|
|
1745
|
+
pSectionSeparator as pSectionSeparator6,
|
|
1746
|
+
EExtrude as EExtrude6,
|
|
1747
|
+
EBVolume as EBVolume6,
|
|
1748
|
+
initGeom as initGeom6
|
|
1749
|
+
} from "geometrix";
|
|
1750
|
+
var pDef6 = {
|
|
1751
|
+
partName: "springTorqueC",
|
|
1752
|
+
params: [
|
|
1753
|
+
//pNumber(name, unit, init, min, max, step)
|
|
1754
|
+
pNumber6("De", "mm", 80, 1, 1e3, 1),
|
|
1755
|
+
pNumber6("Ne", "hole", 16, 0, 400, 1),
|
|
1756
|
+
pNumber6("DTe", "mm", 2, 0.1, 50, 0.1),
|
|
1757
|
+
pNumber6("Ee", "mm", 1, 0.1, 50, 0.1),
|
|
1758
|
+
pCheckbox4("Teeth", true),
|
|
1759
|
+
pNumber6("Th", "mm", 3, 0.1, 100, 0.1),
|
|
1760
|
+
pSectionSeparator6("Internal ring"),
|
|
1761
|
+
pNumber6("Di", "mm", 30, 1, 1e3, 1),
|
|
1762
|
+
pNumber6("Ni", "hole", 8, 0, 400, 1),
|
|
1763
|
+
pNumber6("DTi", "mm", 2, 0.1, 50, 0.1),
|
|
1764
|
+
pNumber6("Ei", "mm", 1, 0.1, 50, 0.1),
|
|
1765
|
+
pSectionSeparator6("Spring"),
|
|
1766
|
+
pNumber6("Ns", "spring", 6, 1, 60, 1),
|
|
1767
|
+
pDropdown4("zig", ["alt", "one", "two"]),
|
|
1768
|
+
pDropdown4("zag", ["arc", "stroke"]),
|
|
1769
|
+
pNumber6("aEs", "%", 20, 1, 99, 1),
|
|
1770
|
+
pNumber6("Esi", "%", 10, 0, 90, 1),
|
|
1771
|
+
pNumber6("Ese", "%", 10, 0, 90, 1),
|
|
1772
|
+
pNumber6("Nk", "zigzag", 4, 2, 100, 1),
|
|
1773
|
+
pNumber6("Wk", "mm", 1, 0.1, 20, 0.1),
|
|
1774
|
+
pNumber6("Rrsi", "mm", 0.1, 0, 20, 0.1),
|
|
1775
|
+
pNumber6("Rrse", "mm", 1, 0, 20, 0.1),
|
|
1776
|
+
pSectionSeparator6("Tooth Profile"),
|
|
1777
|
+
pNumber6("Nt", "teeth", 8, 1, 1e3, 1),
|
|
1778
|
+
pNumber6("Dt", "mm", 20, 0.1, 1e3, 0.1),
|
|
1779
|
+
pNumber6("Ht", "mm", 2, 0.1, 100, 0.1),
|
|
1780
|
+
pNumber6("ate", "%", 52, 1, 99, 1),
|
|
1781
|
+
pNumber6("ah", "%", 100, 1, 400, 1),
|
|
1782
|
+
pNumber6("dh", "%", 100, 1, 400, 1),
|
|
1783
|
+
pNumber6("aeh", "%", 10, 0, 100, 1),
|
|
1784
|
+
pNumber6("aM", "degree", 0, -30, 30, 0.1),
|
|
1785
|
+
pSectionSeparator6("Tooth profile details"),
|
|
1786
|
+
pDropdown4("SnAae", ["stroke", "arc"]),
|
|
1787
|
+
pDropdown4("SnAde", ["stroke", "arc"]),
|
|
1788
|
+
pNumber6("Rae", "mm", 1, 0, 50, 0.1),
|
|
1789
|
+
pNumber6("Rde", "mm", 1, 0, 50, 0.1)
|
|
1790
|
+
],
|
|
1791
|
+
paramSvg: {
|
|
1792
|
+
De: "springTorqueC_profile.svg",
|
|
1793
|
+
Ne: "springTorqueC_profile.svg",
|
|
1794
|
+
DTe: "springTorqueC_profile.svg",
|
|
1795
|
+
Ee: "springTorqueC_profile.svg",
|
|
1796
|
+
Teeth: "springTorqueC_profile.svg",
|
|
1797
|
+
Th: "springTorqueC_profile.svg",
|
|
1798
|
+
Di: "springTorqueC_profile.svg",
|
|
1799
|
+
Ni: "springTorqueC_profile.svg",
|
|
1800
|
+
DTi: "springTorqueC_profile.svg",
|
|
1801
|
+
Ei: "springTorqueC_profile.svg",
|
|
1802
|
+
Ns: "springTorqueC_profile.svg",
|
|
1803
|
+
zig: "springTorqueC_profile.svg",
|
|
1804
|
+
zag: "springTorqueC_profile.svg",
|
|
1805
|
+
aEs: "springTorqueC_profile.svg",
|
|
1806
|
+
Esi: "springTorqueC_profile.svg",
|
|
1807
|
+
Ese: "springTorqueC_profile.svg",
|
|
1808
|
+
Nk: "springTorqueC_profile.svg",
|
|
1809
|
+
Wk: "springTorqueC_profile.svg",
|
|
1810
|
+
Rrsi: "springTorqueC_profile.svg",
|
|
1811
|
+
Rrse: "springTorqueC_profile.svg",
|
|
1812
|
+
Nt: "plugTorque_teeth_radial.svg",
|
|
1813
|
+
Dt: "plugTorque_teeth_radial.svg",
|
|
1814
|
+
Ht: "plugTorque_teeth_radial.svg",
|
|
1815
|
+
ate: "plugTorque_teeth_radial.svg",
|
|
1816
|
+
dh: "plugTorque_teeth_radial.svg",
|
|
1817
|
+
ah: "plugTorque_teeth_radial.svg",
|
|
1818
|
+
aeh: "plugTorque_teeth_radial.svg",
|
|
1819
|
+
aM: "plugTorque_teeth_adden.svg",
|
|
1820
|
+
SnAae: "plugTorque_teeth_radial.svg",
|
|
1821
|
+
SnAde: "plugTorque_teeth_radial.svg",
|
|
1822
|
+
Rae: "plugTorque_teeth_radial.svg",
|
|
1823
|
+
Rde: "plugTorque_teeth_radial.svg"
|
|
1824
|
+
},
|
|
1825
|
+
sim: {
|
|
1826
|
+
tMax: 180,
|
|
1827
|
+
tStep: 0.5,
|
|
1828
|
+
tUpdate: 500
|
|
1829
|
+
// every 0.5 second
|
|
1830
|
+
}
|
|
1831
|
+
};
|
|
1832
|
+
function calcZagP2(pA, pE, lAB, lDE, iSign) {
|
|
1833
|
+
const xAE = pE.cx - pA.cx;
|
|
1834
|
+
const yAE = pE.cy - pA.cy;
|
|
1835
|
+
const lAE = Math.sqrt(xAE ** 2 + yAE ** 2);
|
|
1836
|
+
const aAE = Math.atan2(yAE, xAE);
|
|
1837
|
+
const lAC = lAB * lAE / (lAB + lDE);
|
|
1838
|
+
const aCAB = Math.acos(lAB / lAC);
|
|
1839
|
+
const rPt = pA.translatePolar(aAE + iSign * aCAB, lAB);
|
|
1840
|
+
return rPt;
|
|
1841
|
+
}
|
|
1842
|
+
function pGeom6(t, param, suffix = "") {
|
|
1843
|
+
const rGeome = initGeom6(pDef6.partName + suffix);
|
|
1844
|
+
const figProfile = figure6();
|
|
1845
|
+
rGeome.logstr += `${rGeome.partName} simTime: ${t}
|
|
1846
|
+
`;
|
|
1847
|
+
try {
|
|
1848
|
+
let prePoints2 = function(ll) {
|
|
1849
|
+
const ka = Math.asin(Rk / ll);
|
|
1850
|
+
const kx = ll * Math.cos(ka);
|
|
1851
|
+
const ra = Math.atan2(Wk2, kx);
|
|
1852
|
+
const rl = Math.sqrt(kx ** 2 + Wk2 ** 2);
|
|
1853
|
+
return [ra, rl];
|
|
1854
|
+
}, pppI2 = function(a1, iParity, l2) {
|
|
1855
|
+
const a2 = iParity === 0 ? a1 : aSpring + a1;
|
|
1856
|
+
return point5(0, 0).translatePolar(a2, l2);
|
|
1857
|
+
}, externParity2 = function(iParity) {
|
|
1858
|
+
const eeParity = (extParity + iParity + 1) % 2;
|
|
1859
|
+
return eeParity;
|
|
1860
|
+
}, pppE2 = function(a1, iParity, l2) {
|
|
1861
|
+
const a2 = externParity2(iParity) === 0 ? a1 : aSpring + a1;
|
|
1862
|
+
return point5(0, 0).translatePolar(a2, l2);
|
|
1863
|
+
}, iiParity2 = function(ii) {
|
|
1864
|
+
let ip0 = ii % 2;
|
|
1865
|
+
let ip1 = ii < param.Ns - 1 ? (ii + 1) % 2 : 0;
|
|
1866
|
+
if (param.zig === 1) {
|
|
1867
|
+
ip0 = 0;
|
|
1868
|
+
ip1 = 0;
|
|
1869
|
+
} else if (param.zig === 2) {
|
|
1870
|
+
ip0 = 1;
|
|
1871
|
+
ip1 = 1;
|
|
1872
|
+
}
|
|
1873
|
+
return [ip0, ip1];
|
|
1874
|
+
}, pppb2 = function(ip1, ip2) {
|
|
1875
|
+
const ai1 = ip1 === 0 ? 0 : aSpring;
|
|
1876
|
+
const ai2 = ip2 === 0 ? aSpringStep : aSpringStep + aSpring;
|
|
1877
|
+
const aib = ai1 + (ai2 - ai1) / 2;
|
|
1878
|
+
const ae1 = externParity2(ip1) === 0 ? 0 : aSpring;
|
|
1879
|
+
const ae2 = externParity2(ip2) === 0 ? aSpringStep : aSpringStep + aSpring;
|
|
1880
|
+
const aeb = ae1 + (ae2 - ae1) / 2;
|
|
1881
|
+
const rpib = point5(0, 0).translatePolar(aib, Rsi);
|
|
1882
|
+
const rpeb = point5(0, 0).translatePolar(aeb, Rse);
|
|
1883
|
+
return [rpib, rpeb];
|
|
1884
|
+
}, ctrPartial12 = function(iParity) {
|
|
1885
|
+
const pts = iParity === 0 ? pts0 : pts1;
|
|
1886
|
+
const aStart1 = iParity === 0 ? -Math.PI / 2 : Math.PI / 2 + aSpring;
|
|
1887
|
+
const siRk = iParity === 0 ? Rks : Rkl;
|
|
1888
|
+
const startPt1 = pts[0].translatePolar(aStart1, siRk);
|
|
1889
|
+
const rCtr = contour7(startPt1.cx, startPt1.cy);
|
|
1890
|
+
for (let ii = 0; ii < param.Nk; ii++) {
|
|
1891
|
+
const iiParity3 = (ii + iParity) % 2;
|
|
1892
|
+
const apt = Math.atan2(pts[ii].cy, pts[ii].cx);
|
|
1893
|
+
const aMid = iiParity3 === 0 ? apt - Math.PI / 2 : apt + Math.PI / 2;
|
|
1894
|
+
const aSign = iiParity3 === 0 ? 1 : -1;
|
|
1895
|
+
const iRk = iiParity3 === 0 ? Rks : Rkl;
|
|
1896
|
+
const iRk2 = iiParity3 === 0 ? Rkl : Rks;
|
|
1897
|
+
if (ii > 0) {
|
|
1898
|
+
if (zagArc) {
|
|
1899
|
+
const p1 = point5(0, 0).translatePolar(aSpring / 2, ptl[ii] - iRk);
|
|
1900
|
+
const p2 = pts[ii].translatePolar(aMid - aSign * Math.PI / 2, iRk);
|
|
1901
|
+
rCtr.addPointA(p1.cx, p1.cy).addPointA(p2.cx, p2.cy).addSegArc2();
|
|
1902
|
+
} else {
|
|
1903
|
+
const p2 = calcZagP2(pts[ii], pts[ii - 1], iRk, iRk2, aSign);
|
|
1904
|
+
rCtr.addSegStrokeA(p2.cx, p2.cy);
|
|
1905
|
+
}
|
|
1906
|
+
}
|
|
1907
|
+
let da3 = aMid;
|
|
1908
|
+
let da4 = aMid + aSign * Math.PI / 2;
|
|
1909
|
+
if (ii === 0) {
|
|
1910
|
+
da3 = aMid + aSign * Math.PI / 4;
|
|
1911
|
+
} else if (ii === param.Nk - 1) {
|
|
1912
|
+
da3 = aMid - aSign * Math.PI / 4;
|
|
1913
|
+
da4 = iiParity3 === 0 ? -Math.PI / 2 : Math.PI / 2 + aSpring;
|
|
1914
|
+
}
|
|
1915
|
+
if (ii === param.Nk - 1) {
|
|
1916
|
+
const p4 = pts[ii].translatePolar(da4, iRk);
|
|
1917
|
+
rCtr.addPointA(p4.cx, p4.cy).addSegArc(iRk, false, iiParity3 === 0);
|
|
1918
|
+
} else if (zagArc) {
|
|
1919
|
+
const p3 = pts[ii].translatePolar(da3, iRk);
|
|
1920
|
+
const p4 = pts[ii].translatePolar(da4, iRk);
|
|
1921
|
+
rCtr.addPointA(p3.cx, p3.cy).addPointA(p4.cx, p4.cy).addSegArc2();
|
|
1922
|
+
} else {
|
|
1923
|
+
const p3 = pts[ii].translatePolar(da3, iRk);
|
|
1924
|
+
const p4 = calcZagP2(pts[ii], pts[ii + 1], iRk, iRk2, -aSign);
|
|
1925
|
+
if (ii > 0 && aSpring > aArcMin) {
|
|
1926
|
+
rCtr.addPointA(p3.cx, p3.cy).addPointA(p4.cx, p4.cy).addSegArc2();
|
|
1927
|
+
} else {
|
|
1928
|
+
rCtr.addPointA(p4.cx, p4.cy).addSegArc(iRk, false, iiParity3 === 0);
|
|
1929
|
+
}
|
|
1930
|
+
}
|
|
1931
|
+
}
|
|
1932
|
+
return rCtr;
|
|
1933
|
+
}, ctrPartial22 = function(iParity) {
|
|
1934
|
+
const pts = iParity === 0 ? pts0 : pts1;
|
|
1935
|
+
const eParity = externParity2(iParity);
|
|
1936
|
+
const aStart1 = eParity === 0 ? -Math.PI / 2 : Math.PI / 2 + aSpring;
|
|
1937
|
+
const siRk = eParity === 0 ? Rkl : Rks;
|
|
1938
|
+
const startPt1 = pts[param.Nk - 1].translatePolar(aStart1, siRk);
|
|
1939
|
+
const rCtr = contour7(startPt1.cx, startPt1.cy);
|
|
1940
|
+
for (let ii = param.Nk - 1; ii >= 0; ii--) {
|
|
1941
|
+
const iiParity3 = (ii + iParity) % 2;
|
|
1942
|
+
const apt = Math.atan2(pts[ii].cy, pts[ii].cx);
|
|
1943
|
+
const aMid = iiParity3 === 0 ? apt - Math.PI / 2 : apt + Math.PI / 2;
|
|
1944
|
+
const aSign = iiParity3 === 0 ? -1 : 1;
|
|
1945
|
+
const iRk = iiParity3 === 0 ? Rkl : Rks;
|
|
1946
|
+
const iRk2 = iiParity3 === 0 ? Rks : Rkl;
|
|
1947
|
+
if (ii < param.Nk - 1) {
|
|
1948
|
+
if (zagArc) {
|
|
1949
|
+
const p1 = point5(0, 0).translatePolar(aSpring / 2, ptl[ii] + iRk);
|
|
1950
|
+
const p2 = pts[ii].translatePolar(aMid - aSign * Math.PI / 2, iRk);
|
|
1951
|
+
rCtr.addPointA(p1.cx, p1.cy).addPointA(p2.cx, p2.cy).addSegArc2();
|
|
1952
|
+
} else {
|
|
1953
|
+
const p2 = calcZagP2(pts[ii], pts[ii + 1], iRk, iRk2, aSign);
|
|
1954
|
+
rCtr.addSegStrokeA(p2.cx, p2.cy);
|
|
1955
|
+
}
|
|
1956
|
+
}
|
|
1957
|
+
let da3 = aMid;
|
|
1958
|
+
let da4 = aMid + aSign * Math.PI / 2;
|
|
1959
|
+
if (ii === param.Nk - 1) {
|
|
1960
|
+
da3 = aMid + aSign * Math.PI / 4;
|
|
1961
|
+
} else if (ii === 0) {
|
|
1962
|
+
da3 = aMid - aSign * Math.PI / 4;
|
|
1963
|
+
da4 = iiParity3 === 0 ? -Math.PI / 2 : Math.PI / 2 + aSpring;
|
|
1964
|
+
}
|
|
1965
|
+
if (ii === 0) {
|
|
1966
|
+
const p4 = pts[ii].translatePolar(da4, iRk);
|
|
1967
|
+
rCtr.addPointA(p4.cx, p4.cy).addSegArc(iRk, false, iiParity3 === 1);
|
|
1968
|
+
} else if (zagArc) {
|
|
1969
|
+
const p3 = pts[ii].translatePolar(da3, iRk);
|
|
1970
|
+
const p4 = pts[ii].translatePolar(da4, iRk);
|
|
1971
|
+
rCtr.addPointA(p3.cx, p3.cy).addPointA(p4.cx, p4.cy).addSegArc2();
|
|
1972
|
+
} else {
|
|
1973
|
+
const p3 = pts[ii].translatePolar(da3, iRk);
|
|
1974
|
+
const p4 = calcZagP2(pts[ii], pts[ii - 1], iRk, iRk2, -aSign);
|
|
1975
|
+
if (ii < param.Nk - 1 && aSpring > aArcMin) {
|
|
1976
|
+
rCtr.addPointA(p3.cx, p3.cy).addPointA(p4.cx, p4.cy).addSegArc2();
|
|
1977
|
+
} else {
|
|
1978
|
+
rCtr.addPointA(p4.cx, p4.cy).addSegArc(iRk, false, iiParity3 === 1);
|
|
1979
|
+
}
|
|
1980
|
+
}
|
|
1981
|
+
}
|
|
1982
|
+
return rCtr;
|
|
1983
|
+
}, ctrSpringHollow2 = function(ii) {
|
|
1984
|
+
const [ip1, ip2] = iiParity2(ii);
|
|
1985
|
+
const pp1 = ip1 === 0 ? ppp0 : ppp1;
|
|
1986
|
+
const pp2 = ip2 === 0 ? ppp0 : ppp1;
|
|
1987
|
+
const [ppib, ppeb] = pppb2(ip1, ip2);
|
|
1988
|
+
const ctr = contour7(pp1[0].cx, pp1[0].cy).addCornerRounded(param.Rrsi).addSegStrokeA(pp1[1].cx, pp1[1].cy).addPartial(ctrPartial12(ip1)).addSegStrokeA(pp1[3].cx, pp1[3].cy).addCornerRounded(param.Rrse).addPointA(ppeb.cx, ppeb.cy).addPointA(pp2[4].cx, pp2[4].cy).addSegArc2().addCornerRounded(param.Rrse).addSegStrokeA(pp2[5].cx, pp2[5].cy).addPartial(ctrPartial22(ip2).rotate(0, 0, aSpringStep)).addSegStrokeA(pp2[7].cx, pp2[7].cy).addCornerRounded(param.Rrsi).addPointA(ppib.cx, ppib.cy).addPointA(pp1[0].cx, pp1[0].cy).addSegArc2();
|
|
1989
|
+
return ctr.rotate(0, 0, ii * aSpringStep);
|
|
1990
|
+
};
|
|
1991
|
+
var prePoints = prePoints2, pppI = pppI2, externParity = externParity2, pppE = pppE2, iiParity = iiParity2, pppb = pppb2, ctrPartial1 = ctrPartial12, ctrPartial2 = ctrPartial22, ctrSpringHollow = ctrSpringHollow2;
|
|
1992
|
+
const Re = param.De / 2;
|
|
1993
|
+
const RTe = param.DTe / 2;
|
|
1994
|
+
const Ri = param.Di / 2;
|
|
1995
|
+
const RTi = param.DTi / 2;
|
|
1996
|
+
const Rmax = Re + RTe + param.Ee;
|
|
1997
|
+
const Rmin1 = Ri - RTi - param.Ei;
|
|
1998
|
+
const Rse = Re - RTe - param.Ee;
|
|
1999
|
+
const Rsi = Ri + RTi + param.Ei;
|
|
2000
|
+
const dRs = Rse - Rsi;
|
|
2001
|
+
const Esi = dRs * param.Esi / 100;
|
|
2002
|
+
const Ese = dRs * param.Ese / 100;
|
|
2003
|
+
const dRLs = dRs - Esi - Ese;
|
|
2004
|
+
const aSpringStep = 2 * Math.PI / param.Ns;
|
|
2005
|
+
const aEs = aSpringStep * param.aEs / 100;
|
|
2006
|
+
const aSpring = aSpringStep - aEs;
|
|
2007
|
+
const Rk = dRLs / (2 * (param.Nk - 1));
|
|
2008
|
+
const Ek = 2 * Rk - param.Wk;
|
|
2009
|
+
if (Rmin1 < 0.1) {
|
|
2010
|
+
throw `err120: Di ${param.Di} is too small compare to DTi ${param.DTi}, Ei ${param.Ei}`;
|
|
2011
|
+
}
|
|
2012
|
+
if (dRLs < 2 * param.Ws) {
|
|
2013
|
+
throw `err133: dRLs ${dRLs} is too small compare to Ws ${param.Ws}`;
|
|
2014
|
+
}
|
|
2015
|
+
if (Esi < 0.2 * param.Rrsi) {
|
|
2016
|
+
throw `err136: Esi ${Esi} is too small compare to Rrsi ${param.Rrsi}`;
|
|
2017
|
+
}
|
|
2018
|
+
if (Ese < 0.2 * param.Rrse) {
|
|
2019
|
+
throw `err139: Ese ${Ese} is too small compare to Rrse ${param.Rrse}`;
|
|
2020
|
+
}
|
|
2021
|
+
if (Ek < 0.1) {
|
|
2022
|
+
throw `err145: Ek ${Ek} is too small`;
|
|
2023
|
+
}
|
|
2024
|
+
const aHMinI = 2 * Math.asin((RTi + 0.5 * param.Ei) / Ri);
|
|
2025
|
+
const aHI = param.Ni > 0 ? 2 * Math.PI / param.Ni : 3.14;
|
|
2026
|
+
if (aHI < aHMinI) {
|
|
2027
|
+
throw `err126: aHI ${ffix7(radToDeg7(aHI))} is too small compare to aHMinI ${ffix7(radToDeg7(aHMinI))} degree`;
|
|
2028
|
+
}
|
|
2029
|
+
const aHMinE = 2 * Math.asin((RTe + 0.5 * param.Ee) / Re);
|
|
2030
|
+
const aHE = param.Ne > 0 ? 2 * Math.PI / param.Ne : 3.14;
|
|
2031
|
+
if (aHE < aHMinE) {
|
|
2032
|
+
throw `err131: aHE ${ffix7(radToDeg7(aHE))} is too small compare to aHMinE ${ffix7(radToDeg7(aHMinE))} degree`;
|
|
2033
|
+
}
|
|
2034
|
+
const pts0 = [];
|
|
2035
|
+
const pts1 = [];
|
|
2036
|
+
const ptl = [];
|
|
2037
|
+
const k2Parity1 = param.zig === 2 ? 1 : 0;
|
|
2038
|
+
for (let ii = 0; ii < param.Nk; ii++) {
|
|
2039
|
+
const k2Parity2 = param.zig === 1 ? 0 : 1;
|
|
2040
|
+
const kl = Rsi + Esi + 2 * ii * Rk;
|
|
2041
|
+
ptl.push(kl);
|
|
2042
|
+
const ka = Math.asin(Rk / kl);
|
|
2043
|
+
const kap1 = ii % 2 === k2Parity1 ? ka : aSpring - ka;
|
|
2044
|
+
pts0.push(point5(kl * Math.cos(kap1), kl * Math.sin(kap1)));
|
|
2045
|
+
const kap2 = ii % 2 === k2Parity2 ? ka : aSpring - ka;
|
|
2046
|
+
pts1.push(point5(kl * Math.cos(kap2), kl * Math.sin(kap2)));
|
|
2047
|
+
}
|
|
2048
|
+
const aArcMin = Math.asin(Rk / (Rsi + Esi));
|
|
2049
|
+
let zagArc = param.zag === 0;
|
|
2050
|
+
const Wk2 = param.Wk / 2;
|
|
2051
|
+
const a18 = Math.asin(Wk2 / Rsi);
|
|
2052
|
+
const [a27, l27] = prePoints2(Rsi + Esi);
|
|
2053
|
+
const [a36, l36] = prePoints2(Rse - Ese);
|
|
2054
|
+
const a45 = Math.asin(Wk2 / Rse);
|
|
2055
|
+
const extParity = param.Nk % 2;
|
|
2056
|
+
const ppp0 = [];
|
|
2057
|
+
ppp0.push(pppI2(a18, 0, Rsi));
|
|
2058
|
+
ppp0.push(pppI2(a27, 0, l27));
|
|
2059
|
+
ppp0.push(pppE2(a36, 0, l36));
|
|
2060
|
+
ppp0.push(pppE2(a45, 0, Rse));
|
|
2061
|
+
ppp0.push(pppE2(-a45, 0, Rse).rotateOrig(aSpringStep));
|
|
2062
|
+
ppp0.push(pppE2(-a36, 0, l36).rotateOrig(aSpringStep));
|
|
2063
|
+
ppp0.push(pppI2(-a27, 0, l27).rotateOrig(aSpringStep));
|
|
2064
|
+
ppp0.push(pppI2(-a18, 0, Rsi).rotateOrig(aSpringStep));
|
|
2065
|
+
const ppp1 = [];
|
|
2066
|
+
ppp1.push(pppI2(a18, 1, Rsi));
|
|
2067
|
+
ppp1.push(pppI2(a27, 1, l27));
|
|
2068
|
+
ppp1.push(pppE2(a36, 1, l36));
|
|
2069
|
+
ppp1.push(pppE2(a45, 1, Rse));
|
|
2070
|
+
ppp1.push(pppE2(-a45, 1, Rse).rotateOrig(aSpringStep));
|
|
2071
|
+
ppp1.push(pppE2(-a36, 1, l36).rotateOrig(aSpringStep));
|
|
2072
|
+
ppp1.push(pppI2(-a27, 1, l27).rotateOrig(aSpringStep));
|
|
2073
|
+
ppp1.push(pppI2(-a18, 1, Rsi).rotateOrig(aSpringStep));
|
|
2074
|
+
const Rks = Rk - Wk2;
|
|
2075
|
+
const Rkl = Rk + Wk2;
|
|
2076
|
+
rGeome.logstr += `Dmax ${ffix7(2 * Rmax)}, Dmin1 ${ffix7(2 * Rmin1)} mm
|
|
2077
|
+
`;
|
|
2078
|
+
rGeome.logstr += `Spring area: aSpring ${ffix7(radToDeg7(aSpring))} degree, dRLs ${ffix7(dRLs)} mm
|
|
2079
|
+
`;
|
|
2080
|
+
rGeome.logstr += `Spring zigzag: Ek ${ffix7(Ek)}, Rk ${ffix7(Rk)} mm
|
|
2081
|
+
`;
|
|
2082
|
+
if (aSpring < 2 * aArcMin) {
|
|
2083
|
+
zagArc = false;
|
|
2084
|
+
rGeome.logstr += `Spring zigzag forced to stroke because of aArcMin ${ffix7(radToDeg7(aArcMin))} degree
|
|
2085
|
+
`;
|
|
2086
|
+
}
|
|
2087
|
+
const ctrExt = contourCircle5(0, 0, Rmax);
|
|
2088
|
+
const ctrsH = [];
|
|
2089
|
+
if (param.Teeth === 1) {
|
|
2090
|
+
const [ctrToothE, logE] = ctrPlugExtern(param, Rmin1);
|
|
2091
|
+
rGeome.logstr += logE;
|
|
2092
|
+
ctrsH.push(ctrToothE);
|
|
2093
|
+
} else {
|
|
2094
|
+
ctrsH.push(contourCircle5(0, 0, Rmin1));
|
|
2095
|
+
}
|
|
2096
|
+
for (let ii = 0; ii < param.Ni; ii++) {
|
|
2097
|
+
const p1 = point5(0, 0).translatePolar(ii * aHI, Ri);
|
|
2098
|
+
ctrsH.push(contourCircle5(p1.cx, p1.cy, RTi));
|
|
2099
|
+
}
|
|
2100
|
+
for (let ii = 0; ii < param.Ne; ii++) {
|
|
2101
|
+
const p1 = point5(0, 0).translatePolar(ii * aHE, Re);
|
|
2102
|
+
ctrsH.push(contourCircle5(p1.cx, p1.cy, RTe));
|
|
2103
|
+
}
|
|
2104
|
+
const ctrSpringEnv = contour7(Rsi + Esi, 0).addSegStrokeAP(0, Rse - Ese).addPointAP(aSpring / 2, Rse - Ese).addPointAP(aSpring, Rse - Ese).addSegArc2().addSegStrokeAP(aSpring, Rsi + Esi).addPointAP(aSpring / 2, Rsi + Esi).addPointAP(0, Rsi + Esi).addSegArc2();
|
|
2105
|
+
figProfile.addSecond(ctrSpringEnv);
|
|
2106
|
+
figProfile.addSecond(ctrSpringEnv.rotate(0, 0, aSpringStep));
|
|
2107
|
+
figProfile.addSecond(ctrSpringEnv.rotate(0, 0, -aSpringStep));
|
|
2108
|
+
for (let ii = 0; ii < param.Nk; ii++) {
|
|
2109
|
+
figProfile.addSecond(contourCircle5(pts0[ii].cx, pts0[ii].cy, Rk));
|
|
2110
|
+
const pt1 = pts1[ii].rotateOrig(aSpringStep);
|
|
2111
|
+
figProfile.addSecond(contourCircle5(pt1.cx, pt1.cy, Rk));
|
|
2112
|
+
if (ii > 0) {
|
|
2113
|
+
figProfile.addSecond(contourCircle5(0, 0, ptl[ii] - Rk));
|
|
2114
|
+
}
|
|
2115
|
+
}
|
|
2116
|
+
for (let ii = 0; ii < param.Ns; ii++) {
|
|
2117
|
+
ctrsH.push(ctrSpringHollow2(ii));
|
|
2118
|
+
}
|
|
2119
|
+
figProfile.addMainOI([ctrExt, ...ctrsH]);
|
|
2120
|
+
rGeome.fig = {
|
|
2121
|
+
faceProfile: figProfile
|
|
2122
|
+
};
|
|
2123
|
+
const designName = rGeome.partName;
|
|
2124
|
+
rGeome.vol = {
|
|
2125
|
+
extrudes: [
|
|
2126
|
+
{
|
|
2127
|
+
outName: `subpax_${designName}_profile`,
|
|
2128
|
+
face: `${designName}_faceProfile`,
|
|
2129
|
+
extrudeMethod: EExtrude6.eLinearOrtho,
|
|
2130
|
+
length: param.Th,
|
|
2131
|
+
rotate: [0, 0, 0],
|
|
2132
|
+
translate: [0, 0, 0]
|
|
2133
|
+
}
|
|
2134
|
+
],
|
|
2135
|
+
volumes: [
|
|
2136
|
+
{
|
|
2137
|
+
outName: `pax_${designName}`,
|
|
2138
|
+
boolMethod: EBVolume6.eIdentity,
|
|
2139
|
+
inList: [`subpax_${designName}_profile`]
|
|
2140
|
+
}
|
|
2141
|
+
]
|
|
2142
|
+
};
|
|
2143
|
+
rGeome.sub = {};
|
|
2144
|
+
rGeome.logstr += "springTorqueC drawn successfully!\n";
|
|
2145
|
+
rGeome.calcErr = false;
|
|
2146
|
+
} catch (emsg) {
|
|
2147
|
+
rGeome.logstr += emsg;
|
|
2148
|
+
console.log(emsg);
|
|
2149
|
+
}
|
|
2150
|
+
return rGeome;
|
|
2151
|
+
}
|
|
2152
|
+
var springTorqueCDef = {
|
|
2153
|
+
pTitle: "springTorqueC",
|
|
2154
|
+
pDescription: "spring disc for smooth torque transmission",
|
|
2155
|
+
pDef: pDef6,
|
|
2156
|
+
pGeom: pGeom6
|
|
2157
|
+
};
|
|
2158
|
+
|
|
2159
|
+
// src/spring/springWorm.ts
|
|
2160
|
+
import {
|
|
2161
|
+
contour as contour8,
|
|
2162
|
+
contourCircle as contourCircle6,
|
|
2163
|
+
ctrRectangle as ctrRectangle3,
|
|
2164
|
+
figure as figure7,
|
|
2165
|
+
ffix as ffix8,
|
|
2166
|
+
pNumber as pNumber7,
|
|
2167
|
+
pDropdown as pDropdown5,
|
|
2168
|
+
pSectionSeparator as pSectionSeparator7,
|
|
2169
|
+
EExtrude as EExtrude7,
|
|
2170
|
+
EBVolume as EBVolume7,
|
|
2171
|
+
initGeom as initGeom7
|
|
2172
|
+
} from "geometrix";
|
|
2173
|
+
function makeCtrGroove(x0, y0, xl, yl, roundTop) {
|
|
2174
|
+
const xl2 = xl / 2;
|
|
2175
|
+
const yl2 = yl - xl2;
|
|
2176
|
+
if (roundTop) {
|
|
2177
|
+
const rCtr = contour8(x0, y0).addSegStrokeR(xl, 0).addSegStrokeR(0, yl2).addPointR(-xl2, xl2).addPointR(-xl, 0).addSegArc2().closeSegStroke();
|
|
2178
|
+
return rCtr;
|
|
2179
|
+
} else {
|
|
2180
|
+
const rCtr = contour8(x0, y0 + xl2).addPointR(xl2, -xl2).addPointR(xl, 0).addSegArc2().addSegStrokeR(0, yl2).addSegStrokeR(-xl, 0).closeSegStroke();
|
|
2181
|
+
return rCtr;
|
|
2182
|
+
}
|
|
2183
|
+
}
|
|
2184
|
+
var pDef7 = {
|
|
2185
|
+
partName: "springWorm",
|
|
2186
|
+
params: [
|
|
2187
|
+
//pNumber(name, unit, init, min, max, step)
|
|
2188
|
+
pNumber7("D1", "mm", 30, 2, 200, 1),
|
|
2189
|
+
pNumber7("E1", "mm", 2, 0.1, 50, 0.1),
|
|
2190
|
+
pNumber7("N1", "groove", 6, 2, 200, 1),
|
|
2191
|
+
pNumber7("W2", "mm", 2, 0.1, 50, 0.1),
|
|
2192
|
+
pNumber7("W3", "mm", 1, 0.1, 50, 0.1),
|
|
2193
|
+
pNumber7("S1", "mm", 1, 0.1, 50, 0.1),
|
|
2194
|
+
pSectionSeparator7("Extremity caps"),
|
|
2195
|
+
pDropdown5("leftCaps", ["ext", "int"]),
|
|
2196
|
+
pDropdown5("rightCaps", ["ext", "int"]),
|
|
2197
|
+
pNumber7("W1", "mm", 2, 0.1, 50, 0.1),
|
|
2198
|
+
pNumber7("W1b", "mm", 1, 0.1, 50, 0.1),
|
|
2199
|
+
pSectionSeparator7("Tooth Profile"),
|
|
2200
|
+
pNumber7("Nt", "teeth", 8, 1, 1e3, 1),
|
|
2201
|
+
pNumber7("Dt", "mm", 20, 0.1, 1e3, 0.1),
|
|
2202
|
+
pNumber7("Ht", "mm", 2, 0.1, 100, 0.1),
|
|
2203
|
+
pNumber7("ate", "%", 52, 1, 99, 1),
|
|
2204
|
+
pNumber7("ah", "%", 100, 1, 400, 1),
|
|
2205
|
+
pNumber7("dh", "%", 100, 1, 400, 1),
|
|
2206
|
+
pNumber7("aeh", "%", 10, 0, 100, 1),
|
|
2207
|
+
pNumber7("aM", "degree", 0, -30, 30, 0.1),
|
|
2208
|
+
pSectionSeparator7("Tooth profile details"),
|
|
2209
|
+
pDropdown5("SnAae", ["stroke", "arc"]),
|
|
2210
|
+
pDropdown5("SnAde", ["stroke", "arc"]),
|
|
2211
|
+
pNumber7("Rae", "mm", 1, 0, 50, 0.1),
|
|
2212
|
+
pNumber7("Rde", "mm", 1, 0, 50, 0.1)
|
|
2213
|
+
],
|
|
2214
|
+
paramSvg: {
|
|
2215
|
+
D1: "springWorm_mid.svg",
|
|
2216
|
+
E1: "springWorm_mid.svg",
|
|
2217
|
+
S1: "springWorm_mid.svg",
|
|
2218
|
+
W1: "springWorm_side.svg",
|
|
2219
|
+
W1b: "springWorm_side.svg",
|
|
2220
|
+
N1: "springWorm_side.svg",
|
|
2221
|
+
W2: "springWorm_side.svg",
|
|
2222
|
+
W3: "springWorm_side.svg",
|
|
2223
|
+
leftCaps: "springWorm_side.svg",
|
|
2224
|
+
rightCaps: "springWorm_caps.svg",
|
|
2225
|
+
Nt: "plugTorque_teeth_radial.svg",
|
|
2226
|
+
Dt: "plugTorque_teeth_radial.svg",
|
|
2227
|
+
Ht: "plugTorque_teeth_radial.svg",
|
|
2228
|
+
ate: "plugTorque_teeth_radial.svg",
|
|
2229
|
+
dh: "plugTorque_teeth_radial.svg",
|
|
2230
|
+
ah: "plugTorque_teeth_radial.svg",
|
|
2231
|
+
aeh: "plugTorque_teeth_radial.svg",
|
|
2232
|
+
aM: "plugTorque_teeth_adden.svg",
|
|
2233
|
+
SnAae: "plugTorque_teeth_radial.svg",
|
|
2234
|
+
SnAde: "plugTorque_teeth_radial.svg",
|
|
2235
|
+
Rae: "plugTorque_teeth_radial.svg",
|
|
2236
|
+
Rde: "plugTorque_teeth_radial.svg"
|
|
2237
|
+
},
|
|
2238
|
+
sim: {
|
|
2239
|
+
tMax: 180,
|
|
2240
|
+
tStep: 0.5,
|
|
2241
|
+
tUpdate: 500
|
|
2242
|
+
// every 0.5 second
|
|
2243
|
+
}
|
|
2244
|
+
};
|
|
2245
|
+
function pGeom7(t, param, suffix = "") {
|
|
2246
|
+
const rGeome = initGeom7(pDef7.partName + suffix);
|
|
2247
|
+
const figTube = figure7();
|
|
2248
|
+
const figGroove1 = figure7();
|
|
2249
|
+
const figGroove2 = figure7();
|
|
2250
|
+
const figLeft = figure7();
|
|
2251
|
+
const figRight = figure7();
|
|
2252
|
+
const figW1b = figure7();
|
|
2253
|
+
rGeome.logstr += `${rGeome.partName} simTime: ${t}
|
|
2254
|
+
`;
|
|
2255
|
+
try {
|
|
2256
|
+
const R1 = param.D1 / 2;
|
|
2257
|
+
const Ri = R1 - param.E1;
|
|
2258
|
+
const R12 = 1.2 * R1;
|
|
2259
|
+
const S12 = param.S1 / 2;
|
|
2260
|
+
const W32 = param.W3 / 2;
|
|
2261
|
+
const lenMid = (param.N1 + 1) * param.W2 + param.N1 * param.W3;
|
|
2262
|
+
const capsLeftExt = param.leftCaps === 0;
|
|
2263
|
+
const capsRightExt = param.rightCaps === 0;
|
|
2264
|
+
const lenLeft = capsLeftExt ? param.W1 : param.W1 + param.W1b;
|
|
2265
|
+
const lenRight = capsRightExt ? param.W1 : param.W1 + param.W1b;
|
|
2266
|
+
const lenTotal = lenLeft + lenMid + lenRight;
|
|
2267
|
+
if (Ri < 0.1) {
|
|
2268
|
+
throw `err079: D1 ${param.D1} is too small compare to E1 ${param.E1}`;
|
|
2269
|
+
}
|
|
2270
|
+
if (R1 - S12 < W32) {
|
|
2271
|
+
throw `err130: R1 ${R1} is too small compare to S12 ${S12} or W32 ${W32}`;
|
|
2272
|
+
}
|
|
2273
|
+
rGeome.logstr += `Dint ${ffix8(2 * Ri)} mm
|
|
2274
|
+
`;
|
|
2275
|
+
rGeome.logstr += `Total length ${ffix8(lenTotal)} mm
|
|
2276
|
+
`;
|
|
2277
|
+
const [ctrToothE, logE] = ctrPlugExtern(param, R1);
|
|
2278
|
+
rGeome.logstr += logE;
|
|
2279
|
+
figTube.addMainOI([contourCircle6(0, 0, R1), contourCircle6(0, 0, Ri)]);
|
|
2280
|
+
figTube.addSecond(ctrRectangle3(S12, -R12, R1, 2 * R12));
|
|
2281
|
+
figTube.addSecond(ctrRectangle3(-R1 - S12, -R12, R1, 2 * R12));
|
|
2282
|
+
figTube.addSecond(ctrRectangle3(-R12, S12, 2 * R12, R1));
|
|
2283
|
+
figTube.addSecond(ctrRectangle3(-R12, -R1 - S12, 2 * R12, R1));
|
|
2284
|
+
const ctrTubes = [];
|
|
2285
|
+
ctrTubes.push(ctrRectangle3(0, -R1, param.W1, param.D1));
|
|
2286
|
+
if (!capsLeftExt) {
|
|
2287
|
+
ctrTubes.push(ctrRectangle3(param.W1, -R1, param.W1b, param.D1));
|
|
2288
|
+
}
|
|
2289
|
+
ctrTubes.push(ctrRectangle3(lenLeft, -R1, lenMid, param.D1));
|
|
2290
|
+
if (!capsRightExt) {
|
|
2291
|
+
ctrTubes.push(ctrRectangle3(lenLeft + lenMid, -R1, param.W1b, param.D1));
|
|
2292
|
+
}
|
|
2293
|
+
ctrTubes.push(ctrRectangle3(lenTotal - param.W1, -R1, param.W1, param.D1));
|
|
2294
|
+
for (const iCtr of ctrTubes) {
|
|
2295
|
+
figGroove1.addSecond(iCtr);
|
|
2296
|
+
figGroove2.addSecond(iCtr);
|
|
2297
|
+
}
|
|
2298
|
+
const xStart = lenLeft + param.W2;
|
|
2299
|
+
const xStep = param.W3 + param.W2;
|
|
2300
|
+
for (let ii = 0; ii < param.N1; ii++) {
|
|
2301
|
+
const ctr1 = makeCtrGroove(xStart + ii * xStep, S12, param.W3, R1, false);
|
|
2302
|
+
const ctr2 = makeCtrGroove(xStart + ii * xStep, -R1 - S12, param.W3, R1, true);
|
|
2303
|
+
if (ii % 2 === 0) {
|
|
2304
|
+
figGroove1.addMainO(ctr1);
|
|
2305
|
+
figGroove1.addMainO(ctr2);
|
|
2306
|
+
figGroove2.addSecond(ctr1);
|
|
2307
|
+
figGroove2.addSecond(ctr2);
|
|
2308
|
+
} else {
|
|
2309
|
+
figGroove1.addSecond(ctr1);
|
|
2310
|
+
figGroove1.addSecond(ctr2);
|
|
2311
|
+
figGroove2.addMainO(ctr1);
|
|
2312
|
+
figGroove2.addMainO(ctr2);
|
|
2313
|
+
}
|
|
2314
|
+
}
|
|
2315
|
+
if (capsLeftExt) {
|
|
2316
|
+
figLeft.addMainOI([contourCircle6(0, 0, R1), ctrToothE]);
|
|
2317
|
+
} else {
|
|
2318
|
+
figLeft.addMainO(ctrToothE);
|
|
2319
|
+
figLeft.addSecond(contourCircle6(0, 0, R1));
|
|
2320
|
+
}
|
|
2321
|
+
figLeft.addSecond(contourCircle6(0, 0, Ri));
|
|
2322
|
+
if (capsRightExt) {
|
|
2323
|
+
figRight.addMainOI([contourCircle6(0, 0, R1), ctrToothE]);
|
|
2324
|
+
} else {
|
|
2325
|
+
figRight.addMainO(ctrToothE);
|
|
2326
|
+
figRight.addSecond(contourCircle6(0, 0, R1));
|
|
2327
|
+
}
|
|
2328
|
+
figRight.addSecond(contourCircle6(0, 0, Ri));
|
|
2329
|
+
figW1b.addMainO(contourCircle6(0, 0, R1));
|
|
2330
|
+
rGeome.fig = {
|
|
2331
|
+
faceTube: figTube,
|
|
2332
|
+
faceGroove1: figGroove1,
|
|
2333
|
+
faceGroove2: figGroove2,
|
|
2334
|
+
faceLeft: figLeft,
|
|
2335
|
+
faceRight: figRight,
|
|
2336
|
+
faceW1b: figW1b
|
|
2337
|
+
};
|
|
2338
|
+
const designName = rGeome.partName;
|
|
2339
|
+
const union_list = [
|
|
2340
|
+
`subpax_${designName}_tube`,
|
|
2341
|
+
`subpax_${designName}_left`,
|
|
2342
|
+
`subpax_${designName}_right`
|
|
2343
|
+
];
|
|
2344
|
+
if (!capsLeftExt) {
|
|
2345
|
+
union_list.push(`subpax_${designName}_leftB`);
|
|
2346
|
+
}
|
|
2347
|
+
if (!capsRightExt) {
|
|
2348
|
+
union_list.push(`subpax_${designName}_rightB`);
|
|
2349
|
+
}
|
|
2350
|
+
rGeome.vol = {
|
|
2351
|
+
extrudes: [
|
|
2352
|
+
{
|
|
2353
|
+
outName: `subpax_${designName}_tube`,
|
|
2354
|
+
face: `${designName}_faceTube`,
|
|
2355
|
+
extrudeMethod: EExtrude7.eLinearOrtho,
|
|
2356
|
+
length: lenMid,
|
|
2357
|
+
rotate: [0, 0, 0],
|
|
2358
|
+
translate: [0, 0, lenLeft]
|
|
2359
|
+
},
|
|
2360
|
+
{
|
|
2361
|
+
outName: `subpax_${designName}_left`,
|
|
2362
|
+
face: `${designName}_faceLeft`,
|
|
2363
|
+
extrudeMethod: EExtrude7.eLinearOrtho,
|
|
2364
|
+
length: param.W1,
|
|
2365
|
+
rotate: [0, 0, 0],
|
|
2366
|
+
translate: [0, 0, 0]
|
|
2367
|
+
},
|
|
2368
|
+
{
|
|
2369
|
+
outName: `subpax_${designName}_leftB`,
|
|
2370
|
+
face: `${designName}_faceW1b`,
|
|
2371
|
+
extrudeMethod: EExtrude7.eLinearOrtho,
|
|
2372
|
+
length: param.W1b,
|
|
2373
|
+
rotate: [0, 0, 0],
|
|
2374
|
+
translate: [0, 0, param.W1]
|
|
2375
|
+
},
|
|
2376
|
+
{
|
|
2377
|
+
outName: `subpax_${designName}_rightB`,
|
|
2378
|
+
face: `${designName}_faceW1b`,
|
|
2379
|
+
extrudeMethod: EExtrude7.eLinearOrtho,
|
|
2380
|
+
length: param.W1b,
|
|
2381
|
+
rotate: [0, 0, 0],
|
|
2382
|
+
translate: [0, 0, lenLeft + lenMid]
|
|
2383
|
+
},
|
|
2384
|
+
{
|
|
2385
|
+
outName: `subpax_${designName}_right`,
|
|
2386
|
+
face: `${designName}_faceRight`,
|
|
2387
|
+
extrudeMethod: EExtrude7.eLinearOrtho,
|
|
2388
|
+
length: param.W1,
|
|
2389
|
+
rotate: [0, 0, 0],
|
|
2390
|
+
translate: [0, 0, lenTotal - param.W1]
|
|
2391
|
+
},
|
|
2392
|
+
{
|
|
2393
|
+
outName: `subpax_${designName}_groove1`,
|
|
2394
|
+
face: `${designName}_faceGroove1`,
|
|
2395
|
+
extrudeMethod: EExtrude7.eLinearOrtho,
|
|
2396
|
+
length: 2 * R12,
|
|
2397
|
+
rotate: [0, -Math.PI / 2, 0],
|
|
2398
|
+
translate: [R12, 0, 0]
|
|
2399
|
+
},
|
|
2400
|
+
{
|
|
2401
|
+
outName: `subpax_${designName}_groove2`,
|
|
2402
|
+
face: `${designName}_faceGroove2`,
|
|
2403
|
+
extrudeMethod: EExtrude7.eLinearOrtho,
|
|
2404
|
+
length: 2 * R12,
|
|
2405
|
+
rotate: [0, -Math.PI / 2, -Math.PI / 2],
|
|
2406
|
+
translate: [0, -R12, 0]
|
|
2407
|
+
}
|
|
2408
|
+
],
|
|
2409
|
+
volumes: [
|
|
2410
|
+
{
|
|
2411
|
+
outName: `ipax_${designName}_plus`,
|
|
2412
|
+
boolMethod: EBVolume7.eUnion,
|
|
2413
|
+
inList: union_list
|
|
2414
|
+
},
|
|
2415
|
+
{
|
|
2416
|
+
outName: `ipax_${designName}_moins`,
|
|
2417
|
+
boolMethod: EBVolume7.eUnion,
|
|
2418
|
+
inList: [`subpax_${designName}_groove1`, `subpax_${designName}_groove2`]
|
|
2419
|
+
},
|
|
2420
|
+
{
|
|
2421
|
+
outName: `pax_${designName}`,
|
|
2422
|
+
boolMethod: EBVolume7.eSubstraction,
|
|
2423
|
+
inList: [`ipax_${designName}_plus`, `ipax_${designName}_moins`]
|
|
2424
|
+
}
|
|
2425
|
+
]
|
|
2426
|
+
};
|
|
2427
|
+
rGeome.sub = {};
|
|
2428
|
+
rGeome.logstr += "springWorm drawn successfully!\n";
|
|
2429
|
+
rGeome.calcErr = false;
|
|
2430
|
+
} catch (emsg) {
|
|
2431
|
+
rGeome.logstr += emsg;
|
|
2432
|
+
console.log(emsg);
|
|
2433
|
+
}
|
|
2434
|
+
return rGeome;
|
|
2435
|
+
}
|
|
2436
|
+
var springWormDef = {
|
|
2437
|
+
pTitle: "springWorm",
|
|
2438
|
+
pDescription: "Flex-part for unperfect coaxial transmission",
|
|
2439
|
+
pDef: pDef7,
|
|
2440
|
+
pGeom: pGeom7
|
|
2441
|
+
};
|
|
2442
|
+
|
|
2443
|
+
// src/spring/springOne.ts
|
|
2444
|
+
import {
|
|
2445
|
+
contour as contour9,
|
|
2446
|
+
contourCircle as contourCircle7,
|
|
2447
|
+
figure as figure8,
|
|
2448
|
+
degToRad as degToRad3,
|
|
2449
|
+
ffix as ffix9,
|
|
2450
|
+
pNumber as pNumber8,
|
|
2451
|
+
pCheckbox as pCheckbox5,
|
|
2452
|
+
pSectionSeparator as pSectionSeparator8,
|
|
2453
|
+
initGeom as initGeom8
|
|
2454
|
+
} from "geometrix";
|
|
2455
|
+
import {
|
|
2456
|
+
tJDir,
|
|
2457
|
+
tJSide,
|
|
2458
|
+
contourJ,
|
|
2459
|
+
facet,
|
|
2460
|
+
facet2figure,
|
|
2461
|
+
sheetFold
|
|
2462
|
+
} from "sheetfold";
|
|
2463
|
+
var pDef8 = {
|
|
2464
|
+
partName: "springOne",
|
|
2465
|
+
params: [
|
|
2466
|
+
//pNumber(name, unit, init, min, max, step)
|
|
2467
|
+
pNumber8("D1", "mm", 16, 1, 100, 0.1),
|
|
2468
|
+
pNumber8("Dbearing", "mm", 35, 1, 100, 0.1),
|
|
2469
|
+
pNumber8("H1", "mm", 5, 1, 100, 1),
|
|
2470
|
+
pNumber8("H2", "mm", 15, 1, 100, 1),
|
|
2471
|
+
pNumber8("R2", "mm", 15, 1, 100, 1),
|
|
2472
|
+
pNumber8("L1", "mm", 50, 1, 200, 1),
|
|
2473
|
+
pNumber8("Rc1", "mm", 5, 0, 50, 1),
|
|
2474
|
+
pSectionSeparator8("Spring zone"),
|
|
2475
|
+
pCheckbox5("spring", true),
|
|
2476
|
+
pNumber8("E1", "mm", 2, 1, 100, 1),
|
|
2477
|
+
pNumber8("E2", "mm", 2, 1, 100, 1),
|
|
2478
|
+
pNumber8("smEy", "mm", 1, 0.1, 10, 0.1),
|
|
2479
|
+
pNumber8("shEy", "mm", 1, 0.1, 10, 0.1),
|
|
2480
|
+
pNumber8("shPr", "%", 90, 0, 99, 1),
|
|
2481
|
+
pNumber8("sNx", "xHoles", 2, 2, 200, 1),
|
|
2482
|
+
pNumber8("smEx", "mm", 1, 0.1, 10, 0.1),
|
|
2483
|
+
pNumber8("smExS", "mm", 0.5, 0.1, 10, 0.1),
|
|
2484
|
+
pSectionSeparator8("Screw holes"),
|
|
2485
|
+
pNumber8("D3", "mm", 6, 1, 100, 1),
|
|
2486
|
+
pNumber8("P3", "mm", 70, 1, 200, 1),
|
|
2487
|
+
pNumber8("P4", "mm", 30, 1, 200, 1),
|
|
2488
|
+
pSectionSeparator8("Borders"),
|
|
2489
|
+
pNumber8("L2", "mm", 20, 1, 200, 1),
|
|
2490
|
+
pNumber8("E3", "mm", 1, 0, 20, 0.1),
|
|
2491
|
+
pNumber8("W1", "mm", 20, 1, 200, 1),
|
|
2492
|
+
pNumber8("W3", "mm", 50, 1, 400, 1),
|
|
2493
|
+
pNumber8("Rc3", "mm", 0.5, 0, 10, 0.1),
|
|
2494
|
+
pCheckbox5("B2", true),
|
|
2495
|
+
pNumber8("A2", "mm", 10, 1, 200, 1),
|
|
2496
|
+
pNumber8("Rc2", "mm", 5, 0, 50, 1),
|
|
2497
|
+
pSectionSeparator8("Folding"),
|
|
2498
|
+
pNumber8("Th", "mm", 1, 0.1, 10, 0.1),
|
|
2499
|
+
pNumber8("Jangle", "degree", 90, 0, 120, 1),
|
|
2500
|
+
pNumber8("Jradius", "mm", 2, 0.1, 10, 0.1),
|
|
2501
|
+
pNumber8("Jneutral", "%", 50, 0, 100, 1),
|
|
2502
|
+
pNumber8("Jmark", "mm", 1, 0.1, 10, 0.1)
|
|
2503
|
+
],
|
|
2504
|
+
paramSvg: {
|
|
2505
|
+
D1: "springOne_face.svg",
|
|
2506
|
+
Dbearing: "springOne_face.svg",
|
|
2507
|
+
H1: "springOne_face.svg",
|
|
2508
|
+
H2: "springOne_face.svg",
|
|
2509
|
+
R2: "springOne_face.svg",
|
|
2510
|
+
L1: "springOne_face.svg",
|
|
2511
|
+
Rc1: "springOne_face.svg",
|
|
2512
|
+
spring: "springOne_spring.svg",
|
|
2513
|
+
E1: "springOne_face.svg",
|
|
2514
|
+
E2: "springOne_face.svg",
|
|
2515
|
+
smEy: "springOne_spring.svg",
|
|
2516
|
+
shEy: "springOne_spring.svg",
|
|
2517
|
+
shPr: "springOne_spring.svg",
|
|
2518
|
+
sNx: "springOne_spring.svg",
|
|
2519
|
+
smEx: "springOne_spring.svg",
|
|
2520
|
+
smExS: "springOne_spring.svg",
|
|
2521
|
+
D3: "springOne_top.svg",
|
|
2522
|
+
P3: "springOne_top.svg",
|
|
2523
|
+
P4: "springOne_top.svg",
|
|
2524
|
+
L2: "springOne_top.svg",
|
|
2525
|
+
E3: "springOne_top.svg",
|
|
2526
|
+
W1: "springOne_top.svg",
|
|
2527
|
+
W3: "springOne_top.svg",
|
|
2528
|
+
Rc3: "springOne_top.svg",
|
|
2529
|
+
B2: "springOne_face.svg",
|
|
2530
|
+
A2: "springOne_face.svg",
|
|
2531
|
+
Rc2: "springOne_side.svg",
|
|
2532
|
+
Th: "springOne_side.svg",
|
|
2533
|
+
Jangle: "springOne_face.svg",
|
|
2534
|
+
Jradius: "springOne_face.svg",
|
|
2535
|
+
Jneutral: "springOne_face.svg",
|
|
2536
|
+
Jmark: "springOne_face.svg"
|
|
2537
|
+
},
|
|
2538
|
+
sim: {
|
|
2539
|
+
tMax: 180,
|
|
2540
|
+
tStep: 0.5,
|
|
2541
|
+
tUpdate: 500
|
|
2542
|
+
// every 0.5 second
|
|
2543
|
+
}
|
|
2544
|
+
};
|
|
2545
|
+
function pGeom8(t, param, suffix = "") {
|
|
2546
|
+
const rGeome = initGeom8(pDef8.partName + suffix);
|
|
2547
|
+
const figWallB = figure8();
|
|
2548
|
+
rGeome.logstr += `${rGeome.partName} simTime: ${t}
|
|
2549
|
+
`;
|
|
2550
|
+
try {
|
|
2551
|
+
let makeSpringHollow2 = function(iLen) {
|
|
2552
|
+
const rCtr = contour9(0, 0).addCornerRounded(sRc).addSegStrokeR(iLen, 0).addCornerRounded(sRc).addSegStrokeR(0, param.shEy).addCornerRounded(sRc).addSegStrokeR(-iLen, 0).addCornerRounded(sRc).closeSegStroke();
|
|
2553
|
+
return rCtr;
|
|
2554
|
+
}, calcXref2 = function(iyRef, iSel, idx) {
|
|
2555
|
+
const cotan = iSel === 0 ? cotanBAD : cotanBADb;
|
|
2556
|
+
const cL = iSel === 0 ? 2 * L12 : 2 * L12b;
|
|
2557
|
+
const cy = iyRef - Hfoot - param.H1;
|
|
2558
|
+
const cx = cy < 0 ? cL : cL - 2 * cy * cotan;
|
|
2559
|
+
const cx0 = param.L1 / 2 - cx / 2 + param.smExS;
|
|
2560
|
+
const nx = idx % 2 === 0 ? param.sNx + 1 : param.sNx;
|
|
2561
|
+
const lx = (cx - 2 * param.smExS + param.smEx) / (param.sNx + 1) - param.smEx;
|
|
2562
|
+
const lxAZpre = lx / 2 - param.smEx / 2;
|
|
2563
|
+
const lxAZ = idx % 2 === 0 ? lxAZpre : lx;
|
|
2564
|
+
if (lxAZ < 2 * sRc) {
|
|
2565
|
+
throw `err228: lxAZ ${ffix9(lxAZ)} is too small compare to ${param.sNx} or ${param.smEx}`;
|
|
2566
|
+
}
|
|
2567
|
+
return [cx0, lxAZ, lx, nx];
|
|
2568
|
+
}, makeCtrWall2 = function(iJunctionName) {
|
|
2569
|
+
const rCtr = contourJ(0, Hfoot).startJunction(iJunctionName, tJDir.eB, tJSide.eABRight).addSegStrokeR(param.L1, 0).addSegStrokeR(0, param.H1).addCornerRounded(param.Rc1).addSegStrokeR(-xAD, yAD).addPointA(L12, Hwall + Hfoot).addPointA(xAD, param.H1 + yAD + Hfoot).addSegArc2().addSegStrokeR(-xAD, -yAD).addCornerRounded(param.Rc1).closeSegStroke();
|
|
2570
|
+
return rCtr;
|
|
2571
|
+
}, makeCtrSide2 = function(iJunctionName) {
|
|
2572
|
+
const rCtr = contourJ(0, 0).startJunction(iJunctionName, tJDir.eB, tJSide.eABRight).addSegStrokeR(param.W3, 0).addSegStrokeR(0, param.A2).addCornerRounded(param.Rc2).addSegStrokeR(-param.W3, 0).addCornerRounded(param.Rc2).closeSegStroke();
|
|
2573
|
+
return rCtr;
|
|
2574
|
+
};
|
|
2575
|
+
var makeSpringHollow = makeSpringHollow2, calcXref = calcXref2, makeCtrWall = makeCtrWall2, makeCtrSide = makeCtrSide2;
|
|
2576
|
+
const R1 = param.D1 / 2;
|
|
2577
|
+
const R3 = param.D3 / 2;
|
|
2578
|
+
const Hwall = param.H1 + param.H2 + param.R2;
|
|
2579
|
+
const aJa = degToRad3(param.Jangle);
|
|
2580
|
+
const aJn = param.Jneutral / 100;
|
|
2581
|
+
const aJr = param.Jradius;
|
|
2582
|
+
const aJm = param.Jmark;
|
|
2583
|
+
const Hfoot = param.Jradius + (1 - aJn) * param.Th;
|
|
2584
|
+
const xFoot = 2 * param.E3;
|
|
2585
|
+
const L12 = param.L1 / 2;
|
|
2586
|
+
const aBAC = Math.atan2(param.H2, L12);
|
|
2587
|
+
const lAC = Math.sqrt(L12 ** 2 + param.H2 ** 2);
|
|
2588
|
+
if (param.R2 > lAC) {
|
|
2589
|
+
throw `err141: R2 ${param.R2} is too large comapre to lAC ${ffix9(lAC)} mm`;
|
|
2590
|
+
}
|
|
2591
|
+
const aCAD = Math.asin(param.R2 / lAC);
|
|
2592
|
+
const lAD = lAC * Math.cos(aCAD);
|
|
2593
|
+
const xAD = lAD * Math.cos(aBAC + aCAD);
|
|
2594
|
+
const yAD = lAD * Math.sin(aBAC + aCAD);
|
|
2595
|
+
const cotanBAD = xAD / yAD;
|
|
2596
|
+
const L12b = L12 + xFoot;
|
|
2597
|
+
const aBACb = Math.atan2(param.H2, L12b);
|
|
2598
|
+
const lACb = Math.sqrt(L12b ** 2 + param.H2 ** 2);
|
|
2599
|
+
const aCADb = Math.asin(param.R2 / lACb);
|
|
2600
|
+
const lADb = lACb * Math.cos(aCADb);
|
|
2601
|
+
const xADb = lADb * Math.cos(aBACb + aCADb);
|
|
2602
|
+
const yADb = lADb * Math.sin(aBACb + aCADb);
|
|
2603
|
+
const cotanBADb = xADb / yADb;
|
|
2604
|
+
const L2b = param.L2 - param.E3;
|
|
2605
|
+
const L1b = param.L1 + 2 * param.E3;
|
|
2606
|
+
const W3b = (param.W3 - param.W1) / 2;
|
|
2607
|
+
const midBottomX = L2b + L1b / 2;
|
|
2608
|
+
const midBottomY = param.W3 / 2;
|
|
2609
|
+
const P32 = param.P3 / 2;
|
|
2610
|
+
const P42 = param.P4 / 2;
|
|
2611
|
+
const L122 = param.L1 + 2 * param.L2;
|
|
2612
|
+
const sHeight = param.H1 + param.H2 - R1 - param.E1 - param.E2;
|
|
2613
|
+
const sStepY = param.smEy + param.shEy;
|
|
2614
|
+
const sNy = Math.floor((sHeight + param.smEy) / sStepY);
|
|
2615
|
+
const sRc = param.shEy * param.shPr / 200;
|
|
2616
|
+
if (R1 < 0.1) {
|
|
2617
|
+
throw `err087: R1 ${ffix9(R1)} is too small because of D1 ${param.D1}`;
|
|
2618
|
+
}
|
|
2619
|
+
if (L2b < 0.1) {
|
|
2620
|
+
throw `err165: L2b ${ffix9(L2b)} is too small because of E3 ${param.E3}`;
|
|
2621
|
+
}
|
|
2622
|
+
if (param.E3 < param.Rc3) {
|
|
2623
|
+
throw `err170: E3 ${param.E3} is too small compare to Rc3 ${param.Rc3}`;
|
|
2624
|
+
}
|
|
2625
|
+
if (W3b < param.Rc3) {
|
|
2626
|
+
throw `err174: W3b ${ffix9(W3b)} is too small compare to Rc3 ${param.Rc3}`;
|
|
2627
|
+
}
|
|
2628
|
+
if (param.spring === 1) {
|
|
2629
|
+
if (sHeight < 0.1) {
|
|
2630
|
+
throw `err189: sHeight ${ffix9(sHeight)} is too small because of E1 ${param.E1} or E2 ${param.E2}`;
|
|
2631
|
+
}
|
|
2632
|
+
}
|
|
2633
|
+
rGeome.logstr += `Bearing holder wall: Hwall ${ffix9(Hwall)}, Hfoot ${ffix9(Hfoot)} mm
|
|
2634
|
+
`;
|
|
2635
|
+
if (param.spring === 1) {
|
|
2636
|
+
rGeome.logstr += `spring: sNy ${sNy}, sRc ${ffix9(sRc)} mm
|
|
2637
|
+
`;
|
|
2638
|
+
} else {
|
|
2639
|
+
rGeome.logstr += `No spring
|
|
2640
|
+
`;
|
|
2641
|
+
}
|
|
2642
|
+
const sW1 = [];
|
|
2643
|
+
const sWB = [];
|
|
2644
|
+
if (param.spring === 1) {
|
|
2645
|
+
for (let jj = 0; jj < sNy; jj++) {
|
|
2646
|
+
const yy = Hfoot + param.E1 + jj * sStepY;
|
|
2647
|
+
const yRef = yy + param.shEy / 2;
|
|
2648
|
+
const [xRef, lxAZ, lx, nx] = calcXref2(yRef, 0, jj);
|
|
2649
|
+
const [xRefB, lxAZb, lxb] = calcXref2(yRef, 1, jj);
|
|
2650
|
+
let xx = xRef;
|
|
2651
|
+
let xxb = xRefB;
|
|
2652
|
+
sW1.push(makeSpringHollow2(lxAZ).translate(xx, yy));
|
|
2653
|
+
sWB.push(makeSpringHollow2(lxAZb).translate(xxb, yy));
|
|
2654
|
+
xx += lxAZ + param.smEx;
|
|
2655
|
+
xxb += lxAZb + param.smEx;
|
|
2656
|
+
for (let ii = 0; ii < nx - 1; ii++) {
|
|
2657
|
+
sW1.push(makeSpringHollow2(lx).translate(xx, yy));
|
|
2658
|
+
sWB.push(makeSpringHollow2(lxb).translate(xxb, yy));
|
|
2659
|
+
xx += lx + param.smEx;
|
|
2660
|
+
xxb += lxb + param.smEx;
|
|
2661
|
+
}
|
|
2662
|
+
sW1.push(makeSpringHollow2(lxAZ).translate(xx, yy));
|
|
2663
|
+
sWB.push(makeSpringHollow2(lxAZb).translate(xxb, yy));
|
|
2664
|
+
}
|
|
2665
|
+
}
|
|
2666
|
+
const ctrWall1 = makeCtrWall2("J1");
|
|
2667
|
+
const ctrWall2 = makeCtrWall2("J2");
|
|
2668
|
+
const ctrAxis = contourCircle7(L12, Hfoot + param.H1 + param.H2, R1);
|
|
2669
|
+
const ctrBearing = contourCircle7(L12, Hfoot + param.H1 + param.H2, param.Dbearing / 2);
|
|
2670
|
+
const faWall1 = facet([ctrWall1, ctrAxis, ...sW1]);
|
|
2671
|
+
const faWall2 = facet([ctrWall2, ctrAxis, ...sW1]);
|
|
2672
|
+
const ctrBottom = contourJ(0, 0).addSegStrokeR(L2b, 0).addSegStrokeR(0, W3b).addCornerRounded(param.Rc3).addSegStrokeR(param.E3, 0).startJunction("J1", tJDir.eA, tJSide.eABLeft).addSegStrokeR(param.L1, 0).addSegStrokeR(param.E3, 0).addCornerRounded(param.Rc3).addSegStrokeR(0, -W3b).addSegStrokeR(L2b, 0);
|
|
2673
|
+
if (param.B2 === 1) {
|
|
2674
|
+
ctrBottom.startJunction("J4", tJDir.eA, tJSide.eABLeft);
|
|
2675
|
+
}
|
|
2676
|
+
ctrBottom.addSegStrokeR(0, param.W3).addSegStrokeR(-L2b, 0).addSegStrokeR(0, -W3b).addCornerRounded(param.Rc3).addSegStrokeR(-param.E3, 0).startJunction("J2", tJDir.eA, tJSide.eABLeft).addSegStrokeR(-param.L1, 0).addSegStrokeR(-param.E3, 0).addCornerRounded(param.Rc3).addSegStrokeR(0, W3b).addSegStrokeR(-L2b, 0);
|
|
2677
|
+
if (param.B2 === 1) {
|
|
2678
|
+
ctrBottom.startJunction("J3", tJDir.eA, tJSide.eABLeft);
|
|
2679
|
+
}
|
|
2680
|
+
ctrBottom.closeSegStroke();
|
|
2681
|
+
const hollowBottom = [];
|
|
2682
|
+
hollowBottom.push(contourCircle7(midBottomX - P32, midBottomY - P42, R3));
|
|
2683
|
+
hollowBottom.push(contourCircle7(midBottomX - P32, midBottomY + P42, R3));
|
|
2684
|
+
hollowBottom.push(contourCircle7(midBottomX + P32, midBottomY - P42, R3));
|
|
2685
|
+
hollowBottom.push(contourCircle7(midBottomX + P32, midBottomY + P42, R3));
|
|
2686
|
+
const faBottom = facet([ctrBottom, ...hollowBottom]);
|
|
2687
|
+
const faSide = [];
|
|
2688
|
+
const junctionSide = {};
|
|
2689
|
+
if (param.B2 === 1) {
|
|
2690
|
+
faSide.push(facet([makeCtrSide2("J3")]));
|
|
2691
|
+
faSide.push(facet([makeCtrSide2("J4")]));
|
|
2692
|
+
junctionSide["J3"] = { angle: aJa, radius: aJr, neutral: aJn, mark: aJm };
|
|
2693
|
+
junctionSide["J4"] = { angle: aJa, radius: aJr, neutral: aJn, mark: aJm };
|
|
2694
|
+
}
|
|
2695
|
+
let half1 = [];
|
|
2696
|
+
let half2 = [];
|
|
2697
|
+
if (param.B2 === 1) {
|
|
2698
|
+
half1 = ["J3", param.A2];
|
|
2699
|
+
half2 = ["J4", param.A2];
|
|
2700
|
+
}
|
|
2701
|
+
const sFold = sheetFold(
|
|
2702
|
+
[faBottom, faWall1, faWall2, ...faSide],
|
|
2703
|
+
{
|
|
2704
|
+
J1: { angle: aJa, radius: aJr, neutral: aJn, mark: aJm },
|
|
2705
|
+
J2: { angle: aJa, radius: aJr, neutral: aJn, mark: aJm },
|
|
2706
|
+
...junctionSide
|
|
2707
|
+
},
|
|
2708
|
+
[
|
|
2709
|
+
{ x1: 0, y1: 0, a1: 0, l1: param.W1, ante: ["J1", Hwall], post: ["J2", Hwall] },
|
|
2710
|
+
{ x1: 0, y1: Hfoot + 1.5 * Hwall, a1: 0, l1: L122, ante: half1, post: half2 }
|
|
2711
|
+
],
|
|
2712
|
+
param.Th,
|
|
2713
|
+
rGeome.partName
|
|
2714
|
+
);
|
|
2715
|
+
const ctrWallB = contourJ(0, 0).addSegStrokeR(param.L1, 0).addSegStrokeR(0, Hfoot).addSegStrokeR(xFoot, 0).addSegStrokeR(0, param.H1).addCornerRounded(param.Rc1).addSegStrokeR(-xADb, yADb).addPointA(L12, Hwall + Hfoot).addPointA(xADb - xFoot, param.H1 + yADb + Hfoot).addSegArc2().addSegStrokeR(-xADb, -yADb).addCornerRounded(param.Rc1).addSegStrokeR(0, -param.H1).addSegStrokeR(xFoot, 0).closeSegStroke();
|
|
2716
|
+
figWallB.addMainOI([ctrWallB, ctrAxis, ...sWB]);
|
|
2717
|
+
figWallB.addSecond(ctrBearing);
|
|
2718
|
+
figWallB.mergeFigure(facet2figure(faWall1), true);
|
|
2719
|
+
rGeome.fig = {
|
|
2720
|
+
faceWallB: figWallB
|
|
2721
|
+
};
|
|
2722
|
+
const ffObj = sFold.makeFigures();
|
|
2723
|
+
for (const iFace of Object.keys(ffObj)) {
|
|
2724
|
+
rGeome.fig[iFace] = ffObj[iFace];
|
|
2725
|
+
}
|
|
2726
|
+
rGeome.vol = sFold.makeVolume();
|
|
2727
|
+
rGeome.sub = {};
|
|
2728
|
+
rGeome.logstr += "springOne drawn successfully!\n";
|
|
2729
|
+
rGeome.calcErr = false;
|
|
2730
|
+
} catch (emsg) {
|
|
2731
|
+
rGeome.logstr += emsg;
|
|
2732
|
+
console.log(emsg);
|
|
2733
|
+
}
|
|
2734
|
+
return rGeome;
|
|
2735
|
+
}
|
|
2736
|
+
var springOneDef = {
|
|
2737
|
+
pTitle: "springOne",
|
|
2738
|
+
pDescription: "bearing-holder with integated spring",
|
|
2739
|
+
pDef: pDef8,
|
|
2740
|
+
pGeom: pGeom8
|
|
2741
|
+
};
|
|
1345
2742
|
export {
|
|
1346
2743
|
door1arcDef,
|
|
1347
2744
|
plugTorqueDef,
|
|
2745
|
+
springOneDef,
|
|
1348
2746
|
springTorqueADef,
|
|
2747
|
+
springTorqueBDef,
|
|
2748
|
+
springTorqueCDef,
|
|
2749
|
+
springWormDef,
|
|
1349
2750
|
stoneTowerDef
|
|
1350
2751
|
};
|
|
1351
2752
|
//# sourceMappingURL=index.js.map
|