desi77 0.1.9 → 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 +5 -1
- package/dist/index.js +590 -4
- 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/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_springWorm.svg +10 -0
- package/package.json +8 -7
package/dist/index.d.ts
CHANGED
|
@@ -12,4 +12,8 @@ declare const springTorqueBDef: tPageDef;
|
|
|
12
12
|
|
|
13
13
|
declare const springTorqueCDef: tPageDef;
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
declare const springWormDef: tPageDef;
|
|
16
|
+
|
|
17
|
+
declare const springOneDef: tPageDef;
|
|
18
|
+
|
|
19
|
+
export { door1arcDef, plugTorqueDef, springOneDef, springTorqueADef, springTorqueBDef, springTorqueCDef, springWormDef, stoneTowerDef };
|
package/dist/index.js
CHANGED
|
@@ -1922,7 +1922,7 @@ function pGeom6(t, param, suffix = "") {
|
|
|
1922
1922
|
} else {
|
|
1923
1923
|
const p3 = pts[ii].translatePolar(da3, iRk);
|
|
1924
1924
|
const p4 = calcZagP2(pts[ii], pts[ii + 1], iRk, iRk2, -aSign);
|
|
1925
|
-
if (ii > 0) {
|
|
1925
|
+
if (ii > 0 && aSpring > aArcMin) {
|
|
1926
1926
|
rCtr.addPointA(p3.cx, p3.cy).addPointA(p4.cx, p4.cy).addSegArc2();
|
|
1927
1927
|
} else {
|
|
1928
1928
|
rCtr.addPointA(p4.cx, p4.cy).addSegArc(iRk, false, iiParity3 === 0);
|
|
@@ -1972,7 +1972,7 @@ function pGeom6(t, param, suffix = "") {
|
|
|
1972
1972
|
} else {
|
|
1973
1973
|
const p3 = pts[ii].translatePolar(da3, iRk);
|
|
1974
1974
|
const p4 = calcZagP2(pts[ii], pts[ii - 1], iRk, iRk2, -aSign);
|
|
1975
|
-
if (ii < param.Nk - 1) {
|
|
1975
|
+
if (ii < param.Nk - 1 && aSpring > aArcMin) {
|
|
1976
1976
|
rCtr.addPointA(p3.cx, p3.cy).addPointA(p4.cx, p4.cy).addSegArc2();
|
|
1977
1977
|
} else {
|
|
1978
1978
|
rCtr.addPointA(p4.cx, p4.cy).addSegArc(iRk, false, iiParity3 === 1);
|
|
@@ -2045,7 +2045,7 @@ function pGeom6(t, param, suffix = "") {
|
|
|
2045
2045
|
const kap2 = ii % 2 === k2Parity2 ? ka : aSpring - ka;
|
|
2046
2046
|
pts1.push(point5(kl * Math.cos(kap2), kl * Math.sin(kap2)));
|
|
2047
2047
|
}
|
|
2048
|
-
const aArcMin =
|
|
2048
|
+
const aArcMin = Math.asin(Rk / (Rsi + Esi));
|
|
2049
2049
|
let zagArc = param.zag === 0;
|
|
2050
2050
|
const Wk2 = param.Wk / 2;
|
|
2051
2051
|
const a18 = Math.asin(Wk2 / Rsi);
|
|
@@ -2079,7 +2079,7 @@ function pGeom6(t, param, suffix = "") {
|
|
|
2079
2079
|
`;
|
|
2080
2080
|
rGeome.logstr += `Spring zigzag: Ek ${ffix7(Ek)}, Rk ${ffix7(Rk)} mm
|
|
2081
2081
|
`;
|
|
2082
|
-
if (aSpring < aArcMin) {
|
|
2082
|
+
if (aSpring < 2 * aArcMin) {
|
|
2083
2083
|
zagArc = false;
|
|
2084
2084
|
rGeome.logstr += `Spring zigzag forced to stroke because of aArcMin ${ffix7(radToDeg7(aArcMin))} degree
|
|
2085
2085
|
`;
|
|
@@ -2155,12 +2155,598 @@ var springTorqueCDef = {
|
|
|
2155
2155
|
pDef: pDef6,
|
|
2156
2156
|
pGeom: pGeom6
|
|
2157
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
|
+
};
|
|
2158
2742
|
export {
|
|
2159
2743
|
door1arcDef,
|
|
2160
2744
|
plugTorqueDef,
|
|
2745
|
+
springOneDef,
|
|
2161
2746
|
springTorqueADef,
|
|
2162
2747
|
springTorqueBDef,
|
|
2163
2748
|
springTorqueCDef,
|
|
2749
|
+
springWormDef,
|
|
2164
2750
|
stoneTowerDef
|
|
2165
2751
|
};
|
|
2166
2752
|
//# sourceMappingURL=index.js.map
|