desi76 0.1.15 → 0.1.17

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 CHANGED
@@ -16,4 +16,6 @@ declare const scarabaseDef: tPageDef;
16
16
 
17
17
  declare const long2dDef: tPageDef;
18
18
 
19
- export { abriDef, catamaranDef, cuisineDef, long2dDef, scaraDef, scarabaseDef, stairsDef, voilaDef };
19
+ declare const losangeDef: tPageDef;
20
+
21
+ export { abriDef, catamaranDef, cuisineDef, long2dDef, losangeDef, scaraDef, scarabaseDef, stairsDef, voilaDef };
package/dist/index.js CHANGED
@@ -2581,9 +2581,6 @@ function pGeom6(t, param, suffix = "") {
2581
2581
  if (l6d <= 0 || l62d <= 0 || l63d <= 0) {
2582
2582
  throw `err170: S2 ${ffix5(param.S2)} is too small`;
2583
2583
  }
2584
- if (param.H3 === 0) {
2585
- rGeome.logstr += "warn167: Warning H3 is zero\n";
2586
- }
2587
2584
  rGeome.logstr += `length ${ffix5(Ltot)} height ${ffix5(Htot)}
2588
2585
  `;
2589
2586
  const p7e = point3(R12, 0).translatePolar(Math.PI - a1, R12);
@@ -2617,11 +2614,17 @@ function pGeom6(t, param, suffix = "") {
2617
2614
  figExtern.addMainO(ctrE1);
2618
2615
  const ctrE3 = contour6(p91.cx, p91.cy).addCornerRounded(param.R2i).addPointA(R12 - R91, 0).addPointA(p91.cx, -p91.cy).addSegArc2().addCornerRounded(param.R2i).addSegStrokeA(X2 - param.S2, -T32).addCornerRounded(param.R2e).addSegStrokeA(X2 - param.S2, T32).addCornerRounded(param.R2e).closeSegStroke();
2619
2616
  figExtern.addMainOI([ctrE3, contourCircle5(R12, 0, R11)]);
2620
- } else {
2617
+ } else if (pFirstEnd === 1 && pSecondEnd === 1) {
2621
2618
  const ctrE2 = contour6(p13.cx, p13.cy).addPointA(param.T3, 0).addPointA(p13.cx, -p13.cy).addSegArc2().addSegStrokeA(p63.cx, -p63.cy).addPointA(Ltot - param.T3, 0).addPointA(p63.cx, p63.cy).addSegArc2().closeSegStroke();
2622
2619
  figExtern.addMainOI([ctrPlate, ctrE2]);
2623
2620
  const ctrE3 = contour6(p91.cx, p91.cy).addCornerRounded(param.R2i).addPointA(R12 - R91, 0).addPointA(p91.cx, -p91.cy).addSegArc2().addCornerRounded(param.R2i).addSegStrokeA(p92.cx, -p92.cy).addCornerRounded(param.R2i).addPointA(X2 + R92, 0).addPointA(p92.cx, p92.cy).addSegArc2().addCornerRounded(param.R2i).closeSegStroke();
2624
2621
  figExtern.addMainOI([ctrE3, contourCircle5(R12, 0, R11), contourCircle5(X2, 0, R21)]);
2622
+ } else {
2623
+ figExtern.addMainOI([
2624
+ ctrPlate,
2625
+ contourCircle5(R12, 0, R11),
2626
+ contourCircle5(X2, 0, R21)
2627
+ ]);
2625
2628
  }
2626
2629
  } else {
2627
2630
  let ctrE52 = function(iX, iRe, iRi, iA, iP) {
@@ -2659,13 +2662,15 @@ function pGeom6(t, param, suffix = "") {
2659
2662
  } else if (pFirstEnd === 1 && pSecondEnd === 0) {
2660
2663
  const ctrE6 = contour6(p63d.cx, p63d.cy).addCornerRounded(param.R2e).addSegStrokeA(p13.cx, p13.cy).addPointA(p93.cx, p93.cy).addSegArc(R93, false, true).addCornerRounded(param.R2i).addSegStrokeA(p95.cx, p95.cy).addCornerRounded(param.R2i).addPointA(p91.cx, p91.cy).addSegArc(R91, false, false).addCornerRounded(param.R2i).addSegStrokeA(X2 - param.S2, T32).addCornerRounded(param.R2e).addSegStrokeA(X2 - param.S2, -T32).addCornerRounded(param.R2e).addSegStrokeA(p91.cx, -p91.cy).addCornerRounded(param.R2i).addPointA(p95.cx, -p95.cy).addSegArc(R91, false, false).addCornerRounded(param.R2i).addSegStrokeA(p93.cx, -p93.cy).addCornerRounded(param.R2i).addPointA(p13.cx, -p13.cy).addSegArc(R93, false, true).addSegStrokeA(p63d.cx, -p63d.cy).addCornerRounded(param.R2e).addSegStrokeA(p6d.cx, -p6d.cy).addCornerRounded(param.R2e).addSegStrokeA(p1.cx, -p1.cy).addPointA(0, 0).addPointA(p1.cx, p1.cy).addSegArc2().addSegStrokeA(p6d.cx, p6d.cy).addCornerRounded(param.R2e).closeSegStroke();
2661
2664
  figExtern.addMainOI([ctrE6, ...hollowL]);
2662
- } else {
2665
+ } else if (pFirstEnd === 1 && pSecondEnd === 1) {
2663
2666
  let ctrE42 = function(iyk) {
2664
2667
  const rCtr = contour6(p13.cx, iyk * p13.cy).addPointA(p93.cx, iyk * p93.cy).addSegArc(R93, false, iyk > 0 ? true : false).addCornerRounded(param.R2i).addSegStrokeA(p95.cx, iyk * p95.cy).addCornerRounded(param.R2i).addPointA(p91.cx, iyk * p91.cy).addSegArc(R91, false, iyk > 0 ? false : true).addCornerRounded(param.R2i).addSegStrokeA(p92.cx, iyk * p92.cy).addCornerRounded(param.R2i).addPointA(p96.cx, iyk * p96.cy).addSegArc(R92, false, iyk > 0 ? false : true).addCornerRounded(param.R2i).addSegStrokeA(p94.cx, iyk * p94.cy).addCornerRounded(param.R2i).addPointA(p63.cx, iyk * p63.cy).addSegArc(R94, false, iyk > 0 ? true : false).closeSegStroke();
2665
2668
  return rCtr;
2666
2669
  };
2667
2670
  var ctrE4 = ctrE42;
2668
2671
  figExtern.addMainOI([ctrPlate, ctrE42(1), ctrE42(-1), ...hollowL, ...hollowR]);
2672
+ } else {
2673
+ figExtern.addMainOI([ctrPlate, hollowL[0], hollowR[0]]);
2669
2674
  }
2670
2675
  }
2671
2676
  figExtern.mergeFigure(figPlate, true);
@@ -3156,8 +3161,6 @@ var pDef8 = {
3156
3161
  pNumber8("LB", "L-add", 0, -10, 100, 0.1),
3157
3162
  pNumber8("DA", "D-factor", 1, 0.1, 10, 0.1),
3158
3163
  pNumber8("DB", "D-add", 0, -10, 100, 0.1),
3159
- pNumber8("HA", "L-factor", 1, 0.1, 10, 0.1),
3160
- pNumber8("HB", "L-add", 0, -10, 100, 0.1),
3161
3164
  pSectionSeparator8("Ending parameters"),
3162
3165
  pNumber8("EL", "mm", 100, 1, 1e3, 1),
3163
3166
  pNumber8("ED2", "mm", 60, 1, 1e3, 1),
@@ -3169,8 +3172,8 @@ var pDef8 = {
3169
3172
  pNumber8("T1", "mm", 5, 1, 100, 1),
3170
3173
  pNumber8("T3", "mm", 3, 1, 100, 1),
3171
3174
  pNumber8("E1", "mm", 0.5, -10, 10, 0.1),
3172
- pNumber8("E2", "mm", 0.5, -10, 10, 0.1),
3173
- pNumber8("E3", "mm", 0.5, -10, 10, 0.1),
3175
+ pNumber8("E2", "mm", 0.4, -10, 10, 0.1),
3176
+ pNumber8("E3", "mm", 0.7, -10, 10, 0.1),
3174
3177
  pSectionSeparator8("Base"),
3175
3178
  pNumber8("L3", "mm", 30, 0, 1e3, 1),
3176
3179
  pNumber8("L4", "mm", 20, 1, 100, 1),
@@ -3196,7 +3199,7 @@ var pDef8 = {
3196
3199
  pNumber8("PA8", "degree", 0, -120, 120, 1),
3197
3200
  pNumber8("PA9", "degree", 0, -120, 120, 1),
3198
3201
  pNumber8("PA10", "degree", 0, -120, 120, 1),
3199
- pDropdown5("D3Enable", [
3202
+ pDropdown5("output3D", [
3200
3203
  "assembly",
3201
3204
  "parts",
3202
3205
  "axisall",
@@ -3219,8 +3222,6 @@ var pDef8 = {
3219
3222
  LB: "long2d_top.svg",
3220
3223
  DA: "long2d_top.svg",
3221
3224
  DB: "long2d_top.svg",
3222
- HA: "long2d_side.svg",
3223
- HB: "long2d_side.svg",
3224
3225
  EL: "long2d_top.svg",
3225
3226
  ED2: "long2d_top.svg",
3226
3227
  EH1: "long2d_side.svg",
@@ -3253,7 +3254,7 @@ var pDef8 = {
3253
3254
  PA8: "long2d_top.svg",
3254
3255
  PA9: "long2d_top.svg",
3255
3256
  PA10: "long2d_top.svg",
3256
- D3Enable: "long2d_top.svg"
3257
+ output3D: "long2d_top.svg"
3257
3258
  },
3258
3259
  sim: {
3259
3260
  tMax: 100,
@@ -3304,7 +3305,7 @@ function pGeom8(t, param, suffix = "") {
3304
3305
  const EH23 = 2 * (param.EH2 + param.EH3);
3305
3306
  for (let ii = param.NB - 1; ii >= 0; ii--) {
3306
3307
  BD2[ii] = BD2[ii + 1] * param.DA + param.DB;
3307
- BH1[ii] = BH1[ii + 1] * param.HA + param.HB + 2 * (param.EH2 + param.E1);
3308
+ BH1[ii] = BH1[ii + 1] + 2 * param.EH2 + param.E1;
3308
3309
  }
3309
3310
  const BR2 = BD2.map((aD1) => aD1 / 2);
3310
3311
  const CH1 = BH1[0];
@@ -3333,8 +3334,8 @@ function pGeom8(t, param, suffix = "") {
3333
3334
  if (param.H3 === 0) {
3334
3335
  rGeome.logstr += "warn125: Warning H3 is zero\n";
3335
3336
  }
3336
- if (param.D3Enable > param.NB + 3) {
3337
- rGeome.logstr += `warn238: Warning D3Enable ${param.D3Enable} select a not existing part for 3D
3337
+ if (param.output3D > param.NB + 3) {
3338
+ rGeome.logstr += `warn238: Warning output3D ${param.output3D} select a not existing part for 3D
3338
3339
  `;
3339
3340
  }
3340
3341
  rGeome.logstr += `length ${ffix7(Ltot)} height ${ffix7(Htot)}
@@ -3433,7 +3434,7 @@ function pGeom8(t, param, suffix = "") {
3433
3434
  }
3434
3435
  figSide.mergeFigure(figAxisCut2(posX + BR2[ii] - ER1, posY, BH1[ii] + EH23));
3435
3436
  axisT3d[ii].addTranslation(0, 0, posY);
3436
- posY += param.EH2 + param.E1;
3437
+ posY += param.EH2 + param.E1 / 2;
3437
3438
  legT3d[ii].addTranslation(0, 0, posY);
3438
3439
  figSide.mergeFigure(scaraLegGeom[ii].fig.faceSide.translate(posX, posY));
3439
3440
  }
@@ -3450,8 +3451,8 @@ function pGeom8(t, param, suffix = "") {
3450
3451
  const partInherit = [];
3451
3452
  const partExtrude = [];
3452
3453
  const partList = [];
3453
- if ([0, 1, 3].includes(param.D3Enable)) {
3454
- const fabStepY2 = param.D3Enable === 0 ? 0 : 4 * ER1;
3454
+ if ([0, 1, 3].includes(param.output3D)) {
3455
+ const fabStepY2 = param.output3D === 0 ? 0 : 4 * ER1;
3455
3456
  const partScarabase = {
3456
3457
  outName: `inpax_${designName}_base`,
3457
3458
  subdesign: "pax_scarabase",
@@ -3463,10 +3464,10 @@ function pGeom8(t, param, suffix = "") {
3463
3464
  partList.push(`inpax_${designName}_base`);
3464
3465
  }
3465
3466
  for (let ii = 0; ii < param.NB; ii++) {
3466
- if ([0, 1].includes(param.D3Enable) || ii - param.D3Enable === -4) {
3467
+ if ([0, 1].includes(param.output3D) || ii - param.output3D === -4) {
3467
3468
  const iiName = `inpax_${designName}_leg_${ii + 1}`;
3468
3469
  const iiLegT3d2 = transform3d().addRotation(0, 0, pi2).addTranslation((ii + 1.5) * fabStepX, 4 * ER1, 0);
3469
- const iiLegT3d = param.D3Enable === 0 ? legT3d[ii] : iiLegT3d2;
3470
+ const iiLegT3d = param.output3D === 0 ? legT3d[ii] : iiLegT3d2;
3470
3471
  const iiPartScaraLeg = {
3471
3472
  outName: iiName,
3472
3473
  subdesign: `pax_${scaraLegParam[ii].getPartNameSuffix()}`,
@@ -3478,11 +3479,11 @@ function pGeom8(t, param, suffix = "") {
3478
3479
  partList.push(iiName);
3479
3480
  }
3480
3481
  }
3481
- if ([0, 1, 2].includes(param.D3Enable)) {
3482
+ if ([0, 1, 2].includes(param.output3D)) {
3482
3483
  for (let ii = 0; ii < param.NB; ii++) {
3483
3484
  const iiName = `subpax_${designName}_axis_${ii + 1}`;
3484
3485
  const iiAxisT3d2 = transform3d().addTranslation((ii + 1) * 3 * ER1, 2 * ER1, 0);
3485
- const iiAxisT3d = param.D3Enable === 0 ? axisT3d[ii] : iiAxisT3d2;
3486
+ const iiAxisT3d = param.output3D === 0 ? axisT3d[ii] : iiAxisT3d2;
3486
3487
  const iiPartAxis = {
3487
3488
  outName: iiName,
3488
3489
  face: `${designName}_faceAxis`,
@@ -3538,11 +3539,509 @@ var long2dDef = {
3538
3539
  pDef: pDef8,
3539
3540
  pGeom: pGeom8
3540
3541
  };
3542
+
3543
+ // src/bot/losange.ts
3544
+ import {
3545
+ designParam as designParam2,
3546
+ checkGeom as checkGeom2,
3547
+ prefixLog as prefixLog2,
3548
+ point as point5,
3549
+ contourCircle as contourCircle8,
3550
+ ctrRectangle as ctrRectangle8,
3551
+ figure as figure9,
3552
+ degToRad as degToRad6,
3553
+ radToDeg as radToDeg7,
3554
+ ffix as ffix8,
3555
+ pNumber as pNumber9,
3556
+ pDropdown as pDropdown6,
3557
+ pSectionSeparator as pSectionSeparator9,
3558
+ initGeom as initGeom9,
3559
+ transform3d as transform3d2,
3560
+ EExtrude as EExtrude9,
3561
+ EBVolume as EBVolume9
3562
+ } from "geometrix";
3563
+ import { triLLLrAAA, triLLLrA } from "triangule";
3564
+ var pDef9 = {
3565
+ // partName is used in URL. Choose a name without slash, backslash and space.
3566
+ partName: "losange",
3567
+ params: [
3568
+ //pNumber(name, unit, init, min, max, step)
3569
+ //pNumber('L0', 'mm', 100, 1, 1000, 1),
3570
+ pNumber9("LA1", "mm", 200, 1, 1e3, 1),
3571
+ pNumber9("LA2", "mm", 200, 1, 1e3, 1),
3572
+ pNumber9("LB1", "mm", 200, 1, 1e3, 1),
3573
+ pNumber9("LB2", "mm", 200, 1, 1e3, 1),
3574
+ pSectionSeparator9("Joint diameters"),
3575
+ pNumber9("D0i", "mm", 50, 1, 1e3, 1),
3576
+ pNumber9("D0e", "mm", 90, 1, 1e3, 1),
3577
+ pNumber9("DAi", "mm", 30, 1, 1e3, 1),
3578
+ pNumber9("DAe", "mm", 70, 1, 1e3, 1),
3579
+ pNumber9("DBi", "mm", 30, 1, 1e3, 1),
3580
+ pNumber9("DBe", "mm", 70, 1, 1e3, 1),
3581
+ pNumber9("DEi", "mm", 10, 1, 1e3, 1),
3582
+ pNumber9("DEe", "mm", 30, 1, 1e3, 1),
3583
+ pSectionSeparator9("Wall thickness"),
3584
+ pNumber9("T1", "mm", 4, 1, 100, 1),
3585
+ pNumber9("T3", "mm", 3, 1, 100, 1),
3586
+ pNumber9("S12", "mm", 1, 0, 100, 1),
3587
+ pNumber9("Ri", "mm", 1, 0, 10, 0.1),
3588
+ pNumber9("Re", "mm", 0.4, 0, 10, 0.1),
3589
+ pNumber9("E2", "mm", 0.4, -10, 10, 0.1),
3590
+ pNumber9("E3", "mm", 0.7, -10, 10, 0.1),
3591
+ pSectionSeparator9("Heights"),
3592
+ pNumber9("EH1", "mm", 50, 1, 1e3, 1),
3593
+ pNumber9("EH2", "mm", 8, 1, 1e3, 1),
3594
+ pNumber9("EH3", "mm", 15, 0, 1e3, 1),
3595
+ pNumber9("E1", "mm", 0.5, -10, 10, 0.1),
3596
+ pSectionSeparator9("Base"),
3597
+ pNumber9("L3", "mm", 30, 0, 1e3, 1),
3598
+ pNumber9("L4", "mm", 20, 1, 100, 1),
3599
+ pNumber9("A5", "degree", 90, 0, 180, 1),
3600
+ pNumber9("W5", "mm", 40, 1, 1e3, 1),
3601
+ pNumber9("W6", "mm", 10, 0, 1e3, 1),
3602
+ pNumber9("R34", "mm", 2, 0, 10, 0.1),
3603
+ pNumber9("T4", "mm", 10, 1, 100, 1),
3604
+ pNumber9("W8", "mm", 20, 1, 1e3, 1),
3605
+ pNumber9("H8", "mm", 30, 1, 1e3, 1),
3606
+ pNumber9("D8", "mm", 5, 1, 1e3, 1),
3607
+ pSectionSeparator9("Assembly"),
3608
+ pDropdown6("positionDriver", ["angle0", "endXY"]),
3609
+ pNumber9("A0A", "degree", 0, -120, 120, 1),
3610
+ pNumber9("A0B", "degree", 0, -120, 120, 1),
3611
+ pNumber9("Ex", "mm", 0, -1e3, 1e3, 1),
3612
+ pNumber9("Ey", "mm", 0, -1e3, 1e3, 1),
3613
+ pDropdown6("output3D", [
3614
+ "assembly",
3615
+ "allParts",
3616
+ "allAxis",
3617
+ "base",
3618
+ "legA1",
3619
+ "legA2",
3620
+ "legB1",
3621
+ "legB2"
3622
+ ])
3623
+ ],
3624
+ paramSvg: {
3625
+ //L0: 'losange_top.svg',
3626
+ LA1: "losange_top.svg",
3627
+ LA2: "losange_top.svg",
3628
+ LB1: "losange_top.svg",
3629
+ LB2: "losange_top.svg",
3630
+ D0i: "losange_top.svg",
3631
+ D0e: "losange_top.svg",
3632
+ DAi: "losange_top.svg",
3633
+ DAe: "losange_top.svg",
3634
+ DBi: "losange_top.svg",
3635
+ DBe: "losange_top.svg",
3636
+ DEi: "losange_top.svg",
3637
+ DEe: "losange_top.svg",
3638
+ T1: "losange_axis.svg",
3639
+ T3: "losange_leg.svg",
3640
+ S12: "losange_leg.svg",
3641
+ Ri: "losange_leg.svg",
3642
+ Re: "losange_leg.svg",
3643
+ E2: "losange_top.svg",
3644
+ E3: "losange_axis.svg",
3645
+ EH1: "losange_heights.svg",
3646
+ EH2: "losange_heights.svg",
3647
+ EH3: "losange_heights.svg",
3648
+ E1: "losange_heights.svg",
3649
+ L3: "losange_base.svg",
3650
+ L4: "losange_base.svg",
3651
+ A5: "losange_base.svg",
3652
+ W5: "losange_base.svg",
3653
+ W6: "losange_base.svg",
3654
+ R34: "losange_base.svg",
3655
+ T4: "losange_heights.svg",
3656
+ W8: "losange_back.svg",
3657
+ H8: "losange_back.svg",
3658
+ D8: "losange_back.svg",
3659
+ positionDriver: "losange_top.svg",
3660
+ A0A: "losange_top.svg",
3661
+ A0B: "losange_top.svg",
3662
+ Ex: "losange_top.svg",
3663
+ Ey: "losange_top.svg",
3664
+ output3D: "losange_top.svg"
3665
+ },
3666
+ sim: {
3667
+ tMax: 100,
3668
+ tStep: 0.5,
3669
+ tUpdate: 500
3670
+ // every 0.5 second
3671
+ }
3672
+ };
3673
+ function pGeom9(t, param, suffix = "") {
3674
+ const rGeome = initGeom9(pDef9.partName + suffix);
3675
+ const figTop = figure9();
3676
+ const figSide = figure9();
3677
+ const figBack = figure9();
3678
+ const figAxis0 = figure9();
3679
+ const figAxisA = figure9();
3680
+ const figAxisB = figure9();
3681
+ const figAxisE = figure9();
3682
+ const figTopWithAxis = figure9();
3683
+ rGeome.logstr += `${rGeome.partName} simTime: ${t}
3684
+ `;
3685
+ try {
3686
+ let figAxisCut2 = function(ix, iy, ire, ih) {
3687
+ const rFig = figure9();
3688
+ rFig.addMainO(ctrRectangle8(ix, iy, param.T1, ih));
3689
+ rFig.addMainO(ctrRectangle8(ix + 2 * ire - param.T1, iy, param.T1, ih));
3690
+ return rFig;
3691
+ };
3692
+ var figAxisCut = figAxisCut2;
3693
+ const legNb = 4;
3694
+ const axisNb = 5;
3695
+ const H22 = 2 * param.EH2 + param.E1;
3696
+ const H122 = param.EH1 + H22;
3697
+ const H124 = H122 + H22;
3698
+ const LR1e = [param.D0e / 2, param.DAe / 2, param.D0e / 2, param.DBe / 2];
3699
+ const LR1i = [param.D0i / 2, param.DAi / 2, param.D0i / 2, param.DBi / 2];
3700
+ const LR2e = [param.DAe / 2, param.DEe / 2, param.DBe / 2, param.DEe / 2];
3701
+ const LR2i = [param.DAi / 2, param.DEi / 2, param.DBi / 2, param.DEi / 2];
3702
+ const LL = [param.LA1, param.LA2, param.LB1, param.LB2];
3703
+ const LH = [H124, H122, H124, param.EH1];
3704
+ const ARee = [param.D0e / 2, param.DAe / 2, param.DBe / 2, param.DEe / 2];
3705
+ const ARe = [param.D0i / 2, param.DAi / 2, param.DBi / 2, param.DEi / 2];
3706
+ const ARi = ARe.map((iR) => iR - param.T1);
3707
+ const R8 = param.D8 / 2;
3708
+ const pi2 = Math.PI / 2;
3709
+ const Ltot = Math.min(LL[0] + LL[1], LL[2] + LL[3]);
3710
+ const EH23 = 2 * (param.EH2 + param.EH3);
3711
+ const CH1 = H124 + H22;
3712
+ const cH41 = param.EH2 + param.E1 / 2;
3713
+ const Cidx = ["0", "A", "E", "0", "B", "E"];
3714
+ const axisHa = [CH1, LH[0], LH[1]];
3715
+ const axisHb = [CH1, LH[2], LH[3] + 2 * cH41];
3716
+ const axisHc = axisHa.concat(axisHb);
3717
+ const LR1eA = [LR1e[0], LR1e[1], LR2e[1]];
3718
+ const LR1eB = [LR1e[2], LR1e[3], LR2e[3]];
3719
+ const LR1iA = [LR1i[0], LR1i[1], LR2i[1]];
3720
+ const LR1iB = [LR1i[2], LR1i[3], LR2i[3]];
3721
+ const Htot = axisHa[0] + EH23;
3722
+ const a5 = degToRad6(param.A5) / 2;
3723
+ const W7 = 2 * param.W5 * Math.cos(a5) + param.W6;
3724
+ const X8 = (W7 - param.W8) / 2;
3725
+ const Y8 = (CH1 - param.H8) / 2;
3726
+ const pA0 = point5(0, param.L4).translatePolar(a5, param.W5 / 2).translatePolar(a5 + pi2, param.L3 + LR1e[0]);
3727
+ const pB0 = point5(W7, param.L4).translatePolar(Math.PI - a5, param.W5 / 2).translatePolar(pi2 - a5, param.L3 + LR1e[0]);
3728
+ let a0A = degToRad6(param.A0A);
3729
+ let a0B = degToRad6(param.A0B);
3730
+ if (param.positionDriver === 1) {
3731
+ const ba0A = Math.atan2(param.Ey - pA0.cy, param.Ex - pA0.cx);
3732
+ const ba0B = Math.atan2(param.Ey - pB0.cy, param.Ex - pB0.cx);
3733
+ const lA02 = Math.sqrt((param.Ey - pA0.cy) ** 2 + (param.Ex - pA0.cx) ** 2);
3734
+ const lB02 = Math.sqrt((param.Ey - pB0.cy) ** 2 + (param.Ex - pB0.cx) ** 2);
3735
+ const [aA0p, tStr2] = triLLLrA(lA02, param.LA2, param.LA1);
3736
+ const [aB0p, tStr3] = triLLLrA(param.LA1, param.LA2, lB02);
3737
+ a0A = ba0A + aA0p - pi2;
3738
+ a0B = ba0B - aB0p - pi2;
3739
+ rGeome.logstr += tStr2 + tStr3;
3740
+ }
3741
+ const LA = [pi2 + a0A, 0, pi2 + a0B, 0];
3742
+ const pA1 = pA0.translatePolar(LA[0], LL[0]);
3743
+ const pB1 = pB0.translatePolar(LA[2], LL[2]);
3744
+ const Lpt = [pA0, pA1, pB0, pB1];
3745
+ const L0 = pA0.distanceToPoint(pB0);
3746
+ const lAB = pA1.distanceToPoint(pB1);
3747
+ const aAB = pA1.angleToPoint(pB1);
3748
+ const [ta31, ta12, ta23, tStr1] = triLLLrAAA(LL[1], lAB, LL[3]);
3749
+ LA[1] = aAB + ta12;
3750
+ LA[3] = Math.PI + aAB - ta23;
3751
+ const pA2 = pA1.translatePolar(LA[1], LL[1]);
3752
+ const pB2 = pB1.translatePolar(LA[3], LL[3]);
3753
+ if (pA2.distanceToPoint(pB2) > 0.1) {
3754
+ throw `err215: pA2 x ${ffix8(pA2.cx)} y ${ffix8(pA2.cy)} is too far from pB2 x ${ffix8(pB2.cx)} y ${ffix8(pB2.cy)}`;
3755
+ }
3756
+ const eX = pA2.cx;
3757
+ const eY = pA2.cy;
3758
+ const eA = pA2.angleOrig();
3759
+ const eL = pA2.distanceOrig();
3760
+ const aA2B2 = ta31;
3761
+ const fabStepX = 2.4 * Math.max(...LR1e, ...LR2e);
3762
+ const fabY1 = fabStepX / 2;
3763
+ const fabY2 = fabY1 + fabStepX;
3764
+ const fabY3 = fabY2 + Math.max(...LL) + fabStepX;
3765
+ for (let ii = 0; ii < legNb; ii++) {
3766
+ if (LR1e[ii] < LR1i[ii] + 2 * param.T3) {
3767
+ throw `err197: idx ${ii} LR1e ${ffix8(2 * LR1e[ii])} is too small compare to LR1i ${ffix8(2 * LR1i[ii])} and T3 ${ffix8(param.T3)}`;
3768
+ }
3769
+ if (LR2e[ii] < LR2i[ii] + 2 * param.T3) {
3770
+ throw `err200: idx ${ii} LR2e[ii] ${ffix8(2 * LR2e[ii])} is too small compare to LR2i ${ffix8(2 * LR2i[ii])} and T3 ${ffix8(param.T3)}`;
3771
+ }
3772
+ if (LL[ii] < LR1e[ii] + LR2e[ii]) {
3773
+ throw `err203: idx ${ii} LL ${ffix8(LL[ii])} is too small compare to LR1e ${ffix8(LR1e[ii])} and LR2e ${ffix8(LR2e[ii])}`;
3774
+ }
3775
+ if (ARi[ii] < 0) {
3776
+ throw `err206: idx ${ii} ARe ${ffix8(2 * ARe[ii])} is too small compare to T1 ${ffix8(param.T1)}`;
3777
+ }
3778
+ }
3779
+ if (X8 < R8) {
3780
+ throw `err195: W5 ${ffix8(param.W5)} is too small compare to D8 ${ffix8(2 * R8)} and W8 ${ffix8(param.W8)}`;
3781
+ }
3782
+ if (Y8 < R8) {
3783
+ throw `err198: H1 ${ffix8(CH1)} is too small compare to D8 ${ffix8(2 * R8)} and H8 ${ffix8(param.H8)}`;
3784
+ }
3785
+ rGeome.logstr += tStr1;
3786
+ rGeome.logstr += `length ${ffix8(Ltot)} height ${ffix8(Htot)}
3787
+ `;
3788
+ rGeome.logstr += `Position: X ${ffix8(eX)} Y ${ffix8(eY)} mm
3789
+ `;
3790
+ rGeome.logstr += `Position: A ${ffix8(radToDeg7(eA))} degree L ${ffix8(eL)} mm
3791
+ `;
3792
+ rGeome.logstr += `L0 ${ffix8(L0)} mm aA2B2 ${ffix8(radToDeg7(aA2B2))} degree
3793
+ `;
3794
+ rGeome.logstr += `Angle0 A0A ${ffix8(radToDeg7(a0A))} A0B ${ffix8(radToDeg7(a0B))} degree
3795
+ `;
3796
+ const scarabaseParam = designParam2(scarabaseDef.pDef, "");
3797
+ scarabaseParam.setVal("D1", 2 * LR1i[0] + param.E3);
3798
+ scarabaseParam.setVal("D2", 2 * LR1e[0]);
3799
+ scarabaseParam.setVal("L3", param.L3);
3800
+ scarabaseParam.setVal("L4", param.L4);
3801
+ scarabaseParam.setVal("W5", param.W5);
3802
+ scarabaseParam.setVal("Nac", 1);
3803
+ scarabaseParam.setVal("R34", param.R34);
3804
+ scarabaseParam.setVal("A5", param.A5);
3805
+ scarabaseParam.setVal("W6", param.W6);
3806
+ scarabaseParam.setVal("T3", param.T3);
3807
+ scarabaseParam.setVal("T4", param.T4);
3808
+ scarabaseParam.setVal("H1", CH1);
3809
+ scarabaseParam.setVal("H2", param.EH2);
3810
+ scarabaseParam.setVal("H3", param.EH3);
3811
+ scarabaseParam.setVal("W8", param.W8);
3812
+ scarabaseParam.setVal("H8", param.H8);
3813
+ scarabaseParam.setVal("D8", param.D8);
3814
+ const scarabaseGeom = scarabaseDef.pGeom(
3815
+ 0,
3816
+ scarabaseParam.getParamVal(),
3817
+ scarabaseParam.getSuffix()
3818
+ );
3819
+ checkGeom2(scarabaseGeom);
3820
+ rGeome.logstr += prefixLog2(scarabaseGeom.logstr, scarabaseParam.getPartNameSuffix());
3821
+ const scaraLegParam = [];
3822
+ const scaraLegGeom = [];
3823
+ for (let ii = 0; ii < legNb; ii++) {
3824
+ const iiParam = designParam2(scaraDef.pDef, (ii + 1).toString());
3825
+ iiParam.setVal("L1", LL[ii]);
3826
+ iiParam.setVal("D11", 2 * LR1i[ii] + param.E2);
3827
+ iiParam.setVal("D12", 2 * LR1e[ii]);
3828
+ iiParam.setVal("D21", 2 * LR2i[ii] + (ii < 3 ? param.E3 : param.E2));
3829
+ iiParam.setVal("D22", 2 * LR2e[ii]);
3830
+ iiParam.setVal("firstEnd", 0);
3831
+ iiParam.setVal("secondEnd", ii < 3 ? 0 : 1);
3832
+ iiParam.setVal("A1", 90);
3833
+ iiParam.setVal("T1", param.T3);
3834
+ iiParam.setVal("T2", param.T3);
3835
+ iiParam.setVal("S2", LR2e[ii] + param.S12);
3836
+ iiParam.setVal("R1i", param.Ri);
3837
+ iiParam.setVal("R1e", param.Re);
3838
+ iiParam.setVal("iiEn", 1);
3839
+ iiParam.setVal("N2", 2);
3840
+ iiParam.setVal("S1", LR1e[ii] + param.S12);
3841
+ iiParam.setVal("T3", param.T3);
3842
+ iiParam.setVal("R2i", param.Ri);
3843
+ iiParam.setVal("R2e", param.Re);
3844
+ iiParam.setVal("H1", LH[ii]);
3845
+ iiParam.setVal("H2", param.EH2);
3846
+ iiParam.setVal("H3", ii < 3 ? param.EH3 : 0);
3847
+ iiParam.setVal("H41", ii < 3 ? 0 : cH41);
3848
+ iiParam.setVal("H42", 0);
3849
+ const iiGeom = scaraDef.pGeom(0, iiParam.getParamVal(), iiParam.getSuffix());
3850
+ checkGeom2(iiGeom);
3851
+ rGeome.logstr += prefixLog2(iiGeom.logstr, iiParam.getPartNameSuffix());
3852
+ scaraLegParam.push(iiParam);
3853
+ scaraLegGeom.push(iiGeom);
3854
+ }
3855
+ figTop.mergeFigure(scarabaseGeom.fig.faceT3);
3856
+ const legT3d = [];
3857
+ const axisT3d4 = [];
3858
+ for (let ii = 0; ii < legNb; ii++) {
3859
+ legT3d.push(
3860
+ transform3d2().addTranslation(-LR1e[ii], 0, 0).addRotation(0, 0, LA[ii]).addTranslation(Lpt[ii].cx, Lpt[ii].cy, 0)
3861
+ );
3862
+ axisT3d4.push(
3863
+ transform3d2().addRotation(0, 0, LA[ii]).addTranslation(Lpt[ii].cx, Lpt[ii].cy, 0)
3864
+ );
3865
+ figTop.mergeFigure(
3866
+ scaraLegGeom[ii].fig.faceExtern.translate(-LR1e[ii], 0).rotate(0, 0, LA[ii]).translate(Lpt[ii].cx, Lpt[ii].cy)
3867
+ );
3868
+ }
3869
+ const axisT3dE = transform3d2().addTranslation(pA2.cx, pA2.cy, 0);
3870
+ const axisT3dE2 = transform3d2().addTranslation(pA2.cx, pA2.cy, 0);
3871
+ const axisT3d6 = [axisT3d4[0], axisT3d4[1], axisT3dE, axisT3d4[2], axisT3d4[3], axisT3dE2];
3872
+ const Yoffset = Htot * 1.5;
3873
+ const lineNb = 2;
3874
+ const axisPerLine = axisHa.length;
3875
+ for (let jj = 0; jj < lineNb; jj++) {
3876
+ figSide.mergeFigure(scarabaseGeom.fig.faceSide.translate(0, jj * Yoffset));
3877
+ let posX = param.L4 + param.L3;
3878
+ const posYb = jj * Yoffset;
3879
+ let posY = 0;
3880
+ const jjAxisH = jj === 0 ? axisHa : axisHb;
3881
+ const jjLR1e = jj === 0 ? LR1eA : LR1eB;
3882
+ const jjLR1i = jj === 0 ? LR1iA : LR1iB;
3883
+ const jjLL = jj === 0 ? LL.slice(0, 2) : LL.slice(2, 4);
3884
+ for (let ii = 0; ii < axisPerLine; ii++) {
3885
+ if (ii > 0) {
3886
+ posX += jjLR1e[ii - 1] + jjLL[ii - 1] - jjLR1e[ii];
3887
+ }
3888
+ figSide.mergeFigure(
3889
+ figAxisCut2(
3890
+ posX + jjLR1e[ii] - jjLR1i[ii],
3891
+ posY + posYb,
3892
+ jjLR1i[ii],
3893
+ jjAxisH[ii] + EH23
3894
+ )
3895
+ );
3896
+ const jji6 = ii + jj * axisPerLine;
3897
+ axisT3d6[jji6].addTranslation(0, 0, posY);
3898
+ posY += param.EH2 + param.E1 / 2;
3899
+ const posY2 = jji6 === 4 ? posY + param.EH3 : posY;
3900
+ if (ii < axisPerLine - 1) {
3901
+ const jji4 = ii + jj * (axisPerLine - 1);
3902
+ legT3d[jji4].addTranslation(0, 0, posY2);
3903
+ figSide.mergeFigure(
3904
+ scaraLegGeom[jji4].fig.faceSide.translate(posX, posY2 + posYb)
3905
+ );
3906
+ }
3907
+ }
3908
+ }
3909
+ const checkZ2 = axisT3d6[2].getTranslation()[2];
3910
+ const checkZ5 = axisT3d6[5].getTranslation()[2];
3911
+ if (Math.abs(checkZ2 - checkZ5) > 1e-3) {
3912
+ throw `err396: axisT3d6[2] ${ffix8(checkZ2)} and axisT3d6[5] ${ffix8(checkZ5)} differ`;
3913
+ }
3914
+ figBack.mergeFigure(scarabaseGeom.fig.faceBack);
3915
+ figAxis0.addMainOI([contourCircle8(0, 0, ARe[0]), contourCircle8(0, 0, ARi[0])]);
3916
+ figAxis0.addSecond(contourCircle8(0, 0, ARe[0] + param.T3));
3917
+ figAxis0.addSecond(contourCircle8(0, 0, ARee[0] - param.T3));
3918
+ figAxis0.addSecond(contourCircle8(0, 0, ARee[0]));
3919
+ figTopWithAxis.mergeFigure(figAxis0.translate(Lpt[0].cx, Lpt[0].cy));
3920
+ figTopWithAxis.mergeFigure(figAxis0.translate(Lpt[2].cx, Lpt[2].cy));
3921
+ figAxisA.addMainOI([contourCircle8(0, 0, ARe[1]), contourCircle8(0, 0, ARi[1])]);
3922
+ figAxisA.addSecond(contourCircle8(0, 0, ARe[1] + param.T3));
3923
+ figAxisA.addSecond(contourCircle8(0, 0, ARee[1] - param.T3));
3924
+ figAxisA.addSecond(contourCircle8(0, 0, ARee[1]));
3925
+ figTopWithAxis.mergeFigure(figAxisA.translate(Lpt[1].cx, Lpt[1].cy));
3926
+ figAxisB.addMainOI([contourCircle8(0, 0, ARe[2]), contourCircle8(0, 0, ARi[2])]);
3927
+ figAxisB.addSecond(contourCircle8(0, 0, ARe[2] + param.T3));
3928
+ figAxisB.addSecond(contourCircle8(0, 0, ARee[2] - param.T3));
3929
+ figAxisB.addSecond(contourCircle8(0, 0, ARee[2]));
3930
+ figTopWithAxis.mergeFigure(figAxisB.translate(Lpt[3].cx, Lpt[3].cy));
3931
+ figAxisE.addMainOI([contourCircle8(0, 0, ARe[3]), contourCircle8(0, 0, ARi[3])]);
3932
+ figAxisE.addSecond(contourCircle8(0, 0, ARe[3] + param.T3));
3933
+ figAxisE.addSecond(contourCircle8(0, 0, ARee[3] - param.T3));
3934
+ figAxisE.addSecond(contourCircle8(0, 0, ARee[3]));
3935
+ figTopWithAxis.mergeFigure(figAxisE.translate(pA2.cx, pA2.cy));
3936
+ figTopWithAxis.mergeFigure(figTop);
3937
+ rGeome.fig = {
3938
+ faceTop: figTop,
3939
+ faceSide: figSide,
3940
+ faceBack: figBack,
3941
+ faceAxis0: figAxis0,
3942
+ faceAxisA: figAxisA,
3943
+ faceAxisB: figAxisB,
3944
+ faceAxisE: figAxisE,
3945
+ faceTopWithAxis: figTopWithAxis
3946
+ };
3947
+ const designName = rGeome.partName;
3948
+ const partInherit = [];
3949
+ const partExtrude = [];
3950
+ const partList = [];
3951
+ if ([0, 1, 3].includes(param.output3D)) {
3952
+ const baseY = param.output3D === 0 ? 0 : fabY3;
3953
+ const partScarabase = {
3954
+ outName: `inpax_${designName}_base`,
3955
+ subdesign: "pax_scarabase",
3956
+ subgeom: scarabaseGeom,
3957
+ rotate: [0, 0, 0],
3958
+ translate: [0, baseY, 0]
3959
+ };
3960
+ partInherit.push(partScarabase);
3961
+ partList.push(`inpax_${designName}_base`);
3962
+ }
3963
+ for (let ii = 0; ii < legNb; ii++) {
3964
+ if ([0, 1].includes(param.output3D) || ii - param.output3D === -4) {
3965
+ const iiName = `inpax_${designName}_leg_${ii + 1}`;
3966
+ const iiLegT3d2 = transform3d2().addRotation(0, 0, pi2).addTranslation(ii * fabStepX, fabY2, 0);
3967
+ const iiLegT3d = param.output3D === 0 ? legT3d[ii] : iiLegT3d2;
3968
+ const iiPartScaraLeg = {
3969
+ outName: iiName,
3970
+ subdesign: `pax_${scaraLegParam[ii].getPartNameSuffix()}`,
3971
+ subgeom: scaraLegGeom[ii],
3972
+ rotate: iiLegT3d.getRotation(),
3973
+ translate: iiLegT3d.getTranslation()
3974
+ };
3975
+ partInherit.push(iiPartScaraLeg);
3976
+ partList.push(iiName);
3977
+ }
3978
+ }
3979
+ if ([0, 1, 2].includes(param.output3D)) {
3980
+ for (let ii = 0; ii < axisNb; ii++) {
3981
+ const iiName = `subpax_${designName}_axis_${ii + 1}`;
3982
+ const iiAxisT3d2 = transform3d2().addTranslation(ii * fabStepX, fabY1, 0);
3983
+ const iiAxisT3d = param.output3D === 0 ? axisT3d6[ii] : iiAxisT3d2;
3984
+ const iiPartAxis = {
3985
+ outName: iiName,
3986
+ face: `${designName}_faceAxis${Cidx[ii]}`,
3987
+ extrudeMethod: EExtrude9.eLinearOrtho,
3988
+ length: axisHc[ii] + EH23,
3989
+ rotate: iiAxisT3d.getRotation(),
3990
+ translate: iiAxisT3d.getTranslation()
3991
+ };
3992
+ partExtrude.push(iiPartAxis);
3993
+ partList.push(iiName);
3994
+ }
3995
+ }
3996
+ rGeome.vol = {
3997
+ inherits: partInherit,
3998
+ extrudes: partExtrude,
3999
+ volumes: [
4000
+ {
4001
+ outName: `pax_${designName}`,
4002
+ boolMethod: EBVolume9.eUnion,
4003
+ inList: partList
4004
+ }
4005
+ ]
4006
+ };
4007
+ const subBase = {
4008
+ partName: scarabaseParam.getPartName(),
4009
+ dparam: scarabaseParam.getDesignParamList(),
4010
+ orientation: [0, 0, 0],
4011
+ position: [0, 0, 0]
4012
+ };
4013
+ rGeome.sub = {
4014
+ scaraBase: subBase
4015
+ };
4016
+ for (let ii = 0; ii < legNb; ii++) {
4017
+ const subLeg = {
4018
+ partName: scaraLegParam[ii].getPartName(),
4019
+ dparam: scaraLegParam[ii].getDesignParamList(),
4020
+ orientation: legT3d[ii].getRotation(),
4021
+ position: legT3d[ii].getTranslation()
4022
+ };
4023
+ rGeome.sub[`scaraLeg_${ii + 1}`] = subLeg;
4024
+ }
4025
+ rGeome.logstr += "Long2D drawn successfully!\n";
4026
+ rGeome.calcErr = false;
4027
+ } catch (emsg) {
4028
+ rGeome.logstr += emsg;
4029
+ console.log(emsg);
4030
+ }
4031
+ return rGeome;
4032
+ }
4033
+ var losangeDef = {
4034
+ pTitle: "losange",
4035
+ pDescription: "A losange geometry for a scara bot",
4036
+ pDef: pDef9,
4037
+ pGeom: pGeom9
4038
+ };
3541
4039
  export {
3542
4040
  abriDef,
3543
4041
  catamaranDef,
3544
4042
  cuisineDef,
3545
4043
  long2dDef,
4044
+ losangeDef,
3546
4045
  scaraDef,
3547
4046
  scarabaseDef,
3548
4047
  stairsDef,