desi76 0.1.18 → 0.1.19

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.js CHANGED
@@ -4550,6 +4550,747 @@ var liftDef = {
4550
4550
  pDef: pDef10,
4551
4551
  pGeom: pGeom10
4552
4552
  };
4553
+
4554
+ // src/rccar/pivot.ts
4555
+ import {
4556
+ contour as contour9,
4557
+ contourCircle as contourCircle10,
4558
+ ctrRectangle as ctrRectangle10,
4559
+ figure as figure11,
4560
+ degToRad as degToRad8,
4561
+ radToDeg as radToDeg9,
4562
+ ffix as ffix10,
4563
+ pNumber as pNumber11,
4564
+ pCheckbox as pCheckbox4,
4565
+ pSectionSeparator as pSectionSeparator11,
4566
+ EExtrude as EExtrude11,
4567
+ EBVolume as EBVolume11,
4568
+ initGeom as initGeom11
4569
+ } from "geometrix";
4570
+ var pDef11 = {
4571
+ partName: "pivot",
4572
+ params: [
4573
+ //pNumber(name, unit, init, min, max, step)
4574
+ pNumber11("D1", "mm", 60, 1, 1e3, 1),
4575
+ pNumber11("D2", "mm", 100, 1, 1e3, 1),
4576
+ pNumber11("D3", "mm", 20, 1, 500, 1),
4577
+ pNumber11("T1", "mm", 5, 1, 100, 1),
4578
+ pNumber11("T2", "mm", 2, 1, 100, 1),
4579
+ pNumber11("W4", "mm", 80, 1, 1e3, 1),
4580
+ pSectionSeparator11("top details"),
4581
+ pNumber11("S1", "mm", 2, 0, 500, 1),
4582
+ pNumber11("S2min", "mm", 30, 1, 500, 1),
4583
+ pNumber11("S3", "mm", 40, 1, 1e3, 1),
4584
+ pCheckbox4("hollowTop", true),
4585
+ pNumber11("RR2", "mm", 2, 0, 100, 1),
4586
+ pNumber11("RR3", "mm", 5, 0, 100, 1),
4587
+ pNumber11("A2", "degree", 100, 0, 200, 1),
4588
+ pSectionSeparator11("side"),
4589
+ pNumber11("T3a", "mm", 2, 1, 100, 1),
4590
+ pNumber11("T3b", "mm", 4, 0, 100, 1),
4591
+ pNumber11("T4a", "mm", 2, 1, 100, 1),
4592
+ pNumber11("T4b", "mm", 4, 0, 100, 1),
4593
+ pNumber11("T5a", "mm", 2, 1, 100, 1),
4594
+ pNumber11("T5b", "mm", 4, 0, 100, 1),
4595
+ pNumber11("S5a", "mm", 10, 1, 500, 1),
4596
+ pNumber11("S5b", "mm", 80, 1, 500, 1),
4597
+ pNumber11("RR4", "mm", 5, 0, 100, 1),
4598
+ pNumber11("RR5", "mm", 5, 0, 100, 1),
4599
+ pSectionSeparator11("heigths"),
4600
+ pNumber11("H11", "mm", 3, 1, 100, 1),
4601
+ pNumber11("H12", "mm", 10, 1, 1e3, 1),
4602
+ pNumber11("H13", "mm", 70, 1, 1e3, 1),
4603
+ pNumber11("H14", "mm", 10, 1, 1e3, 1),
4604
+ pNumber11("H15", "mm", 3, 1, 100, 1),
4605
+ pNumber11("H2", "mm", 40, 1, 500, 1),
4606
+ pNumber11("H31", "mm", 3, 1, 100, 1),
4607
+ pNumber11("H32", "mm", 30, 1, 500, 1),
4608
+ pNumber11("H33", "mm", 30, 1, 500, 1),
4609
+ pNumber11("H34", "mm", 0, 0, 500, 1),
4610
+ pNumber11("H35", "mm", 60, 1, 1e3, 1),
4611
+ pNumber11("H36", "mm", 30, 1, 1e3, 1),
4612
+ pSectionSeparator11("relief"),
4613
+ pNumber11("U31", "mm", 2, 1, 100, 1),
4614
+ pNumber11("U32", "mm", 2, 1, 100, 1),
4615
+ pNumber11("U33", "mm", 2, 0, 100, 1),
4616
+ pNumber11("RR31", "mm", 2, 0, 100, 1),
4617
+ pNumber11("U41", "mm", 2, 1, 100, 1),
4618
+ pNumber11("U42", "mm", 3, 1, 100, 1),
4619
+ pNumber11("U43", "mm", 4, 1, 100, 1),
4620
+ pNumber11("U51", "mm", 2, 1, 100, 1),
4621
+ pNumber11("U52", "mm", 3, 1, 100, 1),
4622
+ pNumber11("U53", "mm", 4, 1, 100, 1)
4623
+ ],
4624
+ paramSvg: {
4625
+ D1: "pivot_plate.svg",
4626
+ D2: "pivot_plate.svg",
4627
+ D3: "pivot_side_y.svg",
4628
+ T1: "pivot_plate.svg",
4629
+ T2: "pivot_plate.svg",
4630
+ W4: "pivot_plate.svg",
4631
+ S1: "pivot_plate.svg",
4632
+ S2min: "pivot_plate.svg",
4633
+ S3: "pivot_plate.svg",
4634
+ hollowTop: "pivot_plate.svg",
4635
+ RR2: "pivot_plate.svg",
4636
+ RR3: "pivot_plate.svg",
4637
+ A2: "pivot_wall.svg",
4638
+ T3a: "pivot_plate.svg",
4639
+ T3b: "pivot_plate.svg",
4640
+ T4a: "pivot_plate.svg",
4641
+ T4b: "pivot_plate.svg",
4642
+ T5a: "pivot_side_x.svg",
4643
+ T5b: "pivot_side_x.svg",
4644
+ S5a: "pivot_side_x.svg",
4645
+ S5b: "pivot_side_x.svg",
4646
+ RR4: "pivot_side_y.svg",
4647
+ RR5: "pivot_side_x.svg",
4648
+ H11: "pivot_side_x.svg",
4649
+ H12: "pivot_side_x.svg",
4650
+ H13: "pivot_side_x.svg",
4651
+ H14: "pivot_side_x.svg",
4652
+ H15: "pivot_side_x.svg",
4653
+ H2: "pivot_side_x.svg",
4654
+ H31: "pivot_side_x.svg",
4655
+ H32: "pivot_side_x.svg",
4656
+ H33: "pivot_side_x.svg",
4657
+ H34: "pivot_side_x.svg",
4658
+ H35: "pivot_side_x.svg",
4659
+ H36: "pivot_side_x.svg",
4660
+ U31: "pivot_relief35.svg",
4661
+ U32: "pivot_relief35.svg",
4662
+ U33: "pivot_relief35.svg",
4663
+ RR31: "pivot_relief35.svg",
4664
+ U41: "pivot_relief4.svg",
4665
+ U42: "pivot_relief4.svg",
4666
+ U43: "pivot_relief4.svg",
4667
+ U51: "pivot_relief35.svg",
4668
+ U52: "pivot_relief35.svg",
4669
+ U53: "pivot_relief35.svg"
4670
+ },
4671
+ sim: {
4672
+ tMax: 180,
4673
+ tStep: 0.5,
4674
+ tUpdate: 500
4675
+ // every 0.5 second
4676
+ }
4677
+ };
4678
+ function pGeom11(t, param, suffix = "") {
4679
+ const rGeome = initGeom11(pDef11.partName + suffix);
4680
+ const figTopPlate1 = figure11();
4681
+ const figTopPlate2 = figure11();
4682
+ const figTopWall1 = figure11();
4683
+ const figTopWall2 = figure11();
4684
+ const figTopTube = figure11();
4685
+ const figTopPlate3 = figure11();
4686
+ const figSidePlate = figure11();
4687
+ const figSideArc = figure11();
4688
+ const figRelief3 = figure11();
4689
+ const figRelief4 = figure11();
4690
+ const figRelief5 = figure11();
4691
+ rGeome.logstr += `${rGeome.partName} simTime: ${t}
4692
+ `;
4693
+ try {
4694
+ let calcHolYi2 = function(ix) {
4695
+ const yy = ix * Math.tan(a12) - param.T2 / Math.cos(a12);
4696
+ const ry = Math.min(yy, Y9i);
4697
+ return ry;
4698
+ }, ctrPlate2 = function(plateId) {
4699
+ const rCtr = contour9(X9, Y9);
4700
+ if (outline1Mode === 2) {
4701
+ rCtr.addSegStrokeA(X8, Y9).addCornerRounded(param.RR2);
4702
+ }
4703
+ rCtr.addSegStrokeA(X7, Y7).addCornerRounded(param.RR2).addPointA(-R2, 0).addPointA(X7, -Y7).addSegArc2().addCornerRounded(param.RR2);
4704
+ if (outline1Mode === 2) {
4705
+ rCtr.addSegStrokeA(X8, -Y9).addCornerRounded(param.RR2);
4706
+ }
4707
+ rCtr.addSegStrokeA(X9, -Y9);
4708
+ if (plateId === 2) {
4709
+ rCtr.addSegStrokeR(0, param.T2).addSegStrokeR(-param.T4b, 0).addSegStrokeR(0, 2 * (Y9 - param.T2)).addSegStrokeR(param.T4b, 0);
4710
+ }
4711
+ rCtr.closeSegStroke();
4712
+ return rCtr;
4713
+ }, ctrWall22 = function(ay) {
4714
+ const rCtr = contour9(X9, ay * Y9);
4715
+ if (outline1Mode === 2) {
4716
+ rCtr.addSegStrokeA(X8, ay * Y9).addCornerRounded(param.RR2);
4717
+ }
4718
+ rCtr.addSegStrokeA(X7, ay * Y7).addCornerRounded(param.RR2).addPointAP(ay * a6b, R2).addPointAP(ay * a6, R2).addSegArc2().addSegStrokeAP(ay * a6, R2i).addPointAP(ay * a6b, R2i).addPointA(X7i, ay * Y7i).addSegArc2().addCornerRounded(param.RR2);
4719
+ if (outline2Mode === 2) {
4720
+ rCtr.addSegStrokeA(X8i, ay * Y8i).addCornerRounded(param.RR2);
4721
+ }
4722
+ rCtr.addSegStrokeA(X9, ay * Y9i).closeSegStroke();
4723
+ return rCtr;
4724
+ }, ctrSidePlate2 = function(ih) {
4725
+ const rCtr = contour9(-Y9, H3tot - ih * param.H31).addSegStrokeA(-Y9, param.H36 + param.H35).addCornerRounded(param.RR4).addSegStrokeA(-X36, param.H36 + Y36).addPointA(0, 0).addPointA(X36, param.H36 + Y36).addSegArc2().addSegStrokeA(Y9, param.H36 + param.H35).addCornerRounded(param.RR4).addSegStrokeA(Y9, H3tot - ih * param.H31).closeSegStroke();
4726
+ return rCtr;
4727
+ }, ctrU3iSN2 = function(iy) {
4728
+ const H0 = H3tot + param.H2 / 2;
4729
+ const H1 = H0 - iy * (param.H2 / 2 - param.U33);
4730
+ const rCtr = contour9(-holY1 + U3Sx, H1).addCornerRounded(param.RR31).addSegStrokeA(holY1 - U3Sx, H1).addCornerRounded(param.RR31).addSegStrokeA(0, H0 - iy * U3Sy).addCornerRounded(param.RR31).closeSegStroke();
4731
+ return rCtr;
4732
+ }, ctrU3iEW2 = function(ix) {
4733
+ const X1 = ix * (-holY1 + param.U32);
4734
+ const rCtr = contour9(X1, H3tot - U33p + U3Ey).addCornerRounded(param.RR31).addSegStrokeA(-ix * U3Ex, H3tot + param.H2 / 2).addCornerRounded(param.RR31).addSegStrokeA(X1, H23 + U33p - U3Ey).addCornerRounded(param.RR31).closeSegStroke();
4735
+ return rCtr;
4736
+ }, ctrRelief45i2 = function(ih, iU1, iU2, iU3) {
4737
+ const _X35 = Y9 - iU2;
4738
+ const _Y35 = param.H35 - iU2 * Math.tan(a36 / 2);
4739
+ const _a36a = Math.atan2(_X35, _Y35);
4740
+ const _l36 = Math.sqrt(_X35 ** 2 + _Y35 ** 2);
4741
+ const _R36 = param.H36 - iU2;
4742
+ if (_l36 < _R36) {
4743
+ throw `err503: _R36 ${ffix10(_R36)} is too big compare to _l36 ${ffix10(_l36)}`;
4744
+ }
4745
+ const _a36b = Math.acos(_R36 / _l36);
4746
+ const _a36 = pi2 - (_a36a + _a36b);
4747
+ const _X36 = _R36 * Math.cos(_a36);
4748
+ const _Y36 = _R36 * Math.sin(_a36);
4749
+ const _R3 = R3 + iU1;
4750
+ const _a3 = Math.asin(iU1 / (2 * _R3));
4751
+ const _Y3 = _R3 * Math.cos(_a3);
4752
+ const rCtr = contour9(-_X35, ih - iU3).addCornerRounded(param.RR4).addSegStrokeA(-_X35, param.H36 + _Y35).addCornerRounded(param.RR4).addSegStrokeA(-_X36, param.H36 + _Y36).addPointA(0, iU2).addPointA(_X36, param.H36 + _Y36).addSegArc2().addSegStrokeA(_X35, param.H36 + _Y35).addCornerRounded(param.RR4).addSegStrokeA(_X35, ih - iU3).addCornerRounded(param.RR4).addSegStrokeA(iU1 / 2, ih - iU3).addCornerRounded(param.RR4).addSegStrokeA(iU1 / 2, param.H36 + _Y3).addCornerRounded(param.RR4).addPointA(0, param.H36 - R3 - iU1).addPointA(-iU1 / 2, param.H36 + _Y3).addSegArc2().addCornerRounded(param.RR4).addSegStrokeA(-iU1 / 2, ih - iU3).addCornerRounded(param.RR4).closeSegStroke();
4753
+ return rCtr;
4754
+ };
4755
+ var calcHolYi = calcHolYi2, ctrPlate = ctrPlate2, ctrWall2 = ctrWall22, ctrSidePlate = ctrSidePlate2, ctrU3iSN = ctrU3iSN2, ctrU3iEW = ctrU3iEW2, ctrRelief45i = ctrRelief45i2;
4756
+ const R1 = param.D1 / 2;
4757
+ const R2 = param.D2 / 2;
4758
+ const R3 = param.D3 / 2;
4759
+ const a22 = degToRad8(param.A2) / 2;
4760
+ const pi2 = Math.PI / 2;
4761
+ const Lextra = param.S1 + param.T3a + param.T3b + param.S3 + param.T4a + param.T4b;
4762
+ const X9 = R2 + Lextra;
4763
+ const Y9 = param.W4 / 2;
4764
+ const R9 = Math.sqrt(X9 ** 2 + Y9 ** 2);
4765
+ const R8 = R2 + param.S2min;
4766
+ const outline1Mode = R9 < R8 ? 1 : 2;
4767
+ if (R8 < Y9) {
4768
+ throw `err107: W4 ${ffix10(param.W4)} is too large compare to S2min ${ffix10(param.S2min)} and D2 ${ffix10(param.D2)}`;
4769
+ }
4770
+ const X8 = Math.sqrt(R8 ** 2 - Y9 ** 2);
4771
+ const X8b = outline1Mode === 2 ? X8 : X9;
4772
+ const a12 = Math.atan2(Y9, X8b);
4773
+ const X7 = R2 * Math.cos(a12);
4774
+ const Y7 = R2 * Math.sin(a12);
4775
+ const T2min = param.T4b * Y9 / X9;
4776
+ const a8i = pi2 - a12 / 2;
4777
+ const X8i = X8 + param.T2 * Math.tan(pi2 - a8i);
4778
+ const Y8i = Y9 - param.T2;
4779
+ const outline2Mode = X8i < X9 ? 2 : 1;
4780
+ const Y9i = outline2Mode === 2 ? Y9 - param.T2 : Y9 - param.T2 / Math.cos(a12);
4781
+ const a7i = a12 - Math.atan2(param.T2, R2);
4782
+ if (a7i < 0) {
4783
+ throw `err157: T2 ${ffix10(param.T2)} is too large compare to A1 ${ffix10(radToDeg9(2 * a12))}`;
4784
+ }
4785
+ const R2i = R2 - param.T2;
4786
+ const X7i = R2i * Math.cos(a7i);
4787
+ const Y7i = R2i * Math.sin(a7i);
4788
+ const a6 = Math.PI - a22;
4789
+ const a6b = (a6 + a12) / 2;
4790
+ const holX1 = R2 + param.S1;
4791
+ const outline3Mode = X8 < holX1 ? 3 : outline1Mode;
4792
+ const holY1 = Math.min(Y9, holX1 * Math.tan(a12));
4793
+ const T22 = param.T2 / 2;
4794
+ const holX1i = holX1 + param.T3b + param.T3a;
4795
+ const holX2i = holX1i + param.S3;
4796
+ const outline4Mode = X8i < holX1i ? 3 : X8i < holX2i ? 2 : 1;
4797
+ const holY1i = calcHolYi2(holX1i);
4798
+ const holY2i = calcHolYi2(holX2i);
4799
+ const H1432 = param.H12 + param.H13 + param.H14;
4800
+ const H1tot = param.H11 + H1432 + param.H15;
4801
+ const H3tot = param.H31 + param.H32 + param.H33 + param.H34 + param.H35 + param.H36;
4802
+ const Htot = H1tot + param.H2 + H3tot;
4803
+ const Lreturn = param.T5a + param.T5b + 2 * param.S5a + param.S5b + param.T4a + param.T4b;
4804
+ const Lend = R2 + Lextra - Lreturn;
4805
+ const Lplate3 = Lreturn - param.T4b - param.T5b;
4806
+ const H23 = param.H2 + H3tot;
4807
+ const a36a = Math.atan2(Y9, param.H35);
4808
+ const l36 = Math.sqrt(Y9 ** 2 + param.H35 ** 2);
4809
+ if (l36 < param.H36) {
4810
+ throw `err229: H36 ${ffix10(param.H36)} is too big compare to l36 ${ffix10(l36)}`;
4811
+ }
4812
+ const a36b = Math.acos(param.H36 / l36);
4813
+ const a36 = pi2 - (a36a + a36b);
4814
+ const X36 = param.H36 * Math.cos(a36);
4815
+ const Y36 = param.H36 * Math.sin(a36);
4816
+ const U33p = Math.min(param.H15, param.H31) / 2;
4817
+ const U3h = param.H2 + 2 * U33p;
4818
+ const U3w = 2 * holY1;
4819
+ const U33 = param.U33 + U33p;
4820
+ const aU3 = Math.atan2(U3h, U3w);
4821
+ const U3Sx = param.U31 / (2 * Math.sin(aU3)) + U33 * Math.tan(pi2 - aU3);
4822
+ const U3Sy = param.U31 / (2 * Math.sin(pi2 - aU3));
4823
+ const U3Ex = param.U31 / (2 * Math.sin(aU3));
4824
+ const U3Ey = param.U31 / (2 * Math.sin(pi2 - aU3)) + param.U32 * Math.tan(aU3);
4825
+ if (R2 < R1 + param.T1 + param.T2) {
4826
+ throw `err230: D2 ${ffix10(2 * R2)} is too small compare to D1 ${ffix10(2 * R1)}, T1 ${ffix10(param.T1)} and T2 ${ffix10(param.T2)}`;
4827
+ }
4828
+ if (param.T2 < T2min) {
4829
+ throw `err233: T2 ${ffix10(param.T2)} is too small compare to T2min ${ffix10(T2min)}, T4b ${ffix10(param.T4b)}, A1 ${ffix10(radToDeg9(2 * a12))}`;
4830
+ }
4831
+ if (param.H36 < R3 + param.U51 + param.U52) {
4832
+ throw `err236: D3 ${ffix10(param.D3)} is too large compare to H36 ${ffix10(param.H36)}`;
4833
+ }
4834
+ if (param.H36 < R3 + param.U41 + param.U42) {
4835
+ throw `err243: D3 ${ffix10(param.D3)} is too large compare to H36 ${ffix10(param.H36)}`;
4836
+ }
4837
+ if (param.U32 < T22) {
4838
+ throw `err248: U32 ${ffix10(param.U32)} is too large compare to T2 ${ffix10(param.T2)}`;
4839
+ }
4840
+ if (param.U42 <= param.T2) {
4841
+ throw `err263: U42 ${ffix10(param.U42)} is too large compare to T2 ${ffix10(param.T2)}`;
4842
+ }
4843
+ rGeome.logstr += `Lextra ${ffix10(Lextra)} Rmax ${ffix10(R9)} Dmax ${ffix10(2 * R9)} mm
4844
+ `;
4845
+ rGeome.logstr += `Lreturn ${ffix10(Lreturn)} Lend ${ffix10(Lend)} mm
4846
+ `;
4847
+ rGeome.logstr += `H1tot ${ffix10(H1tot)} H3tot ${ffix10(H3tot)} Htot ${ffix10(Htot)} mm
4848
+ `;
4849
+ rGeome.logstr += `A1 ${ffix10(radToDeg9(2 * a12))} degree, T2min ${ffix10(T2min)}
4850
+ `;
4851
+ rGeome.logstr += `outline1Mode ${outline1Mode}
4852
+ `;
4853
+ const ctrHollow = contour9(holX2i, holY2i).addCornerRounded(param.RR3);
4854
+ if (outline4Mode === 2) {
4855
+ ctrHollow.addSegStrokeA(X8i, Y8i).addCornerRounded(param.RR2);
4856
+ }
4857
+ ctrHollow.addSegStrokeA(holX1i, holY1i).addCornerRounded(param.RR3).addSegStrokeA(holX1i, -holY1i).addCornerRounded(param.RR3);
4858
+ if (outline4Mode === 2) {
4859
+ ctrHollow.addSegStrokeA(X8i, -Y8i).addCornerRounded(param.RR2);
4860
+ }
4861
+ ctrHollow.addSegStrokeA(holX2i, -holY2i).addCornerRounded(param.RR3).closeSegStroke();
4862
+ const ctrsTopPlate1 = [ctrPlate2(1), contourCircle10(0, 0, R1)];
4863
+ if (param.hollowTop === 1) {
4864
+ ctrsTopPlate1.push(ctrHollow);
4865
+ }
4866
+ figTopPlate1.addMainOI(ctrsTopPlate1);
4867
+ figTopPlate1.addSecond(contourCircle10(0, 0, R8));
4868
+ figTopPlate1.addSecond(contourCircle10(0, 0, R9));
4869
+ figTopPlate2.addMainOI([ctrPlate2(2), contourCircle10(0, 0, R1), ctrHollow]);
4870
+ figTopPlate2.addSecond(contourCircle10(0, 0, R8));
4871
+ figTopPlate2.addSecond(contourCircle10(0, 0, R9));
4872
+ const ctrWall1 = contour9(X9, Y9);
4873
+ if (outline1Mode === 2) {
4874
+ ctrWall1.addSegStrokeA(X8, Y9).addCornerRounded(param.RR2);
4875
+ }
4876
+ ctrWall1.addSegStrokeA(X7, Y7).addCornerRounded(param.RR2).addPointA(-R2, 0).addPointA(X7, -Y7).addSegArc2().addCornerRounded(param.RR2);
4877
+ if (outline1Mode === 2) {
4878
+ ctrWall1.addSegStrokeA(X8, -Y9).addCornerRounded(param.RR2);
4879
+ }
4880
+ ctrWall1.addSegStrokeA(X9, -Y9).addSegStrokeA(X9, -Y9i);
4881
+ if (outline2Mode === 2) {
4882
+ ctrWall1.addSegStrokeA(X8i, -Y8i).addCornerRounded(param.RR2);
4883
+ }
4884
+ ctrWall1.addSegStrokeA(X7i, -Y7i).addCornerRounded(param.RR2).addPointA(-R2i, 0).addPointA(X7i, Y7i).addSegArc2().addCornerRounded(param.RR2);
4885
+ if (outline2Mode === 2) {
4886
+ ctrWall1.addSegStrokeA(X8i, Y8i).addCornerRounded(param.RR2);
4887
+ }
4888
+ ctrWall1.addSegStrokeA(X9, Y9i).closeSegStroke();
4889
+ figTopWall1.addMainO(ctrWall1);
4890
+ figTopWall1.addMainOI([contourCircle10(0, 0, R1 + param.T1), contourCircle10(0, 0, R1)]);
4891
+ figTopWall1.addSecond(contourCircle10(0, 0, R8));
4892
+ figTopWall1.addSecond(contourCircle10(0, 0, R9));
4893
+ figTopWall2.addMainO(ctrWall22(1));
4894
+ figTopWall2.addMainO(ctrWall22(-1));
4895
+ figTopWall2.addMainOI([contourCircle10(0, 0, R1 + param.T1), contourCircle10(0, 0, R1)]);
4896
+ figTopWall2.addSecond(contourCircle10(0, 0, R8));
4897
+ figTopWall2.addSecond(contourCircle10(0, 0, R9));
4898
+ const ctrTopTube = contour9(X9, Y9);
4899
+ if (outline3Mode === 2) {
4900
+ ctrTopTube.addSegStrokeA(X8, Y9).addCornerRounded(param.RR2);
4901
+ }
4902
+ ctrTopTube.addSegStrokeA(holX1, holY1).addSegStrokeR(0, -T22).addSegStrokeR(param.T3b, 0).addSegStrokeR(0, -2 * (holY1 - T22)).addSegStrokeR(-param.T3b, 0).addSegStrokeR(0, -T22);
4903
+ if (outline3Mode === 2) {
4904
+ ctrTopTube.addSegStrokeA(X8, -Y9).addCornerRounded(param.RR2);
4905
+ }
4906
+ ctrTopTube.addSegStrokeA(X9, -Y9).addSegStrokeR(0, param.T2).addSegStrokeR(-param.T4b, 0).addSegStrokeR(0, 2 * (Y9 - param.T2)).addSegStrokeR(param.T4b, 0).closeSegStroke();
4907
+ figTopTube.addMainOI([ctrTopTube, ctrHollow]);
4908
+ figTopTube.addSecond(contourCircle10(0, 0, R8));
4909
+ figTopTube.addSecond(contourCircle10(0, 0, R9));
4910
+ const ctrTopPlate3 = ctrRectangle10(Lend + param.T5b, -Y9, Lplate3, 2 * Y9);
4911
+ figTopPlate3.addMainOI([ctrTopPlate3, ctrHollow]);
4912
+ figTopPlate3.addSecond(contourCircle10(0, 0, R8));
4913
+ figTopPlate3.addSecond(contourCircle10(0, 0, R9));
4914
+ figSidePlate.addMainOI([ctrSidePlate2(1), contourCircle10(0, param.H36, R3)]);
4915
+ figSidePlate.addSecond(ctrRectangle10(-Y9, H3tot - param.H31, param.W4, param.H31));
4916
+ figSidePlate.addSecond(ctrRectangle10(-Y9, H3tot, param.W4, param.H2));
4917
+ figSidePlate.addSecond(ctrRectangle10(-Y9, H23, param.W4, param.H15));
4918
+ figSidePlate.addSecond(ctrRectangle10(-R2, H23, 2 * R2, H1tot));
4919
+ figSidePlate.addSecond(ctrRectangle10(-Y9, H23 + param.H15, Y9 - Y9i, H1432));
4920
+ figSidePlate.addSecond(ctrRectangle10(Y9i, H23 + param.H15, Y9 - Y9i, H1432));
4921
+ figSidePlate.addSecond(ctrRectangle10(-Y9, H23 + param.H15 + H1432, param.W4, param.H11));
4922
+ const H3c = param.H36 + param.H35 + param.H34;
4923
+ figSidePlate.addSecond(ctrRectangle10(-Y9, H3c, param.T2, param.H33));
4924
+ figSidePlate.addSecond(ctrRectangle10(Y9 - param.T2, H3c, param.T2, param.H33));
4925
+ figSidePlate.addSecond(ctrRectangle10(-Y9, H3c + param.H33, param.T2, param.H32));
4926
+ figSidePlate.addSecond(ctrRectangle10(Y9 - param.T2, H3c + param.H33, param.T2, param.H32));
4927
+ const Xtube = R2 + param.S1 + param.T3b + param.T3a;
4928
+ const Htube = param.H31 + param.H2 + H1tot;
4929
+ const T4ab = param.T4a + param.T4b;
4930
+ const T5ab = param.T5a + param.T5b;
4931
+ const H3b = H3tot - param.H31;
4932
+ const ctrSideArc = contour9(Lend + T5ab, H3c).addSegStrokeR(param.S5a, param.H33).addCornerRounded(param.RR5).addSegStrokeR(param.S5b, 0).addCornerRounded(param.RR5).addSegStrokeR(param.S5a, -param.H33).addSegStrokeR(0, param.H33 + param.H32).addSegStrokeR(-2 * param.S5a - param.S5b, 0).closeSegStroke();
4933
+ figSideArc.addMainO(ctrSideArc);
4934
+ figSideArc.addSecond(ctrRectangle10(-R2, H23, 2 * R2 + Lextra, H1tot));
4935
+ figSideArc.addSecond(ctrRectangle10(-R1, H23, 2 * R1, H1tot));
4936
+ figSideArc.addSecond(ctrRectangle10(R2 + param.S1, H3tot, Lextra - param.S1, param.H2));
4937
+ figSideArc.addSecond(ctrRectangle10(Lend, H3tot - param.H31, Lreturn, param.H31));
4938
+ figSideArc.addSecond(ctrRectangle10(Xtube, H3tot - param.H31, param.S3, Htube));
4939
+ figSideArc.addSecond(ctrRectangle10(Lend, 0, T5ab, H3b));
4940
+ figSideArc.addSecond(ctrRectangle10(Xtube + param.S3, 0, T4ab, H3b));
4941
+ figSideArc.addSecond(ctrRectangle10(Lend, param.H36 - R3, T5ab, 2 * R3));
4942
+ figSideArc.addSecond(ctrRectangle10(Xtube + param.S3, param.H36 - R3, T4ab, 2 * R3));
4943
+ figRelief3.mergeFigure(figSidePlate, true);
4944
+ const ctrU3e = ctrRectangle10(-holY1, H3tot - U33p, U3w, U3h);
4945
+ figRelief3.addMainOI([ctrU3e, ctrU3iSN2(1), ctrU3iSN2(-1), ctrU3iEW2(1), ctrU3iEW2(-1)]);
4946
+ figRelief4.mergeFigure(figSidePlate, true);
4947
+ const ctrRelief4e = contour9(-Y9 + param.T2, H23 + param.H15).addSegStrokeA(-Y9 + param.T2, H3tot).addSegStrokeA(-Y9, H3tot).addSegStrokeA(-Y9, param.H36 + param.H35).addCornerRounded(param.RR4).addSegStrokeA(-X36, param.H36 + Y36).addPointA(0, 0).addPointA(X36, param.H36 + Y36).addSegArc2().addSegStrokeA(Y9, param.H36 + param.H35).addCornerRounded(param.RR4).addSegStrokeA(Y9, H3tot).addSegStrokeA(Y9 - param.T2, H3tot).addSegStrokeA(Y9 - param.T2, H23 + param.H15).closeSegStroke();
4948
+ figRelief4.addMainOI([
4949
+ ctrRelief4e,
4950
+ ctrRelief45i2(H23 + param.H15, param.U41, param.U42, param.U43),
4951
+ contourCircle10(0, param.H36, R3)
4952
+ ]);
4953
+ figRelief5.mergeFigure(figRelief3, true);
4954
+ figRelief5.addMainOI([
4955
+ ctrSidePlate2(0),
4956
+ ctrRelief45i2(H3tot, param.U51, param.U52, param.U53),
4957
+ contourCircle10(0, param.H36, R3)
4958
+ ]);
4959
+ rGeome.fig = {
4960
+ faceTopPlate1: figTopPlate1,
4961
+ faceTopPlate2: figTopPlate2,
4962
+ faceTopWall1: figTopWall1,
4963
+ faceTopWall2: figTopWall2,
4964
+ faceTopTube: figTopTube,
4965
+ faceTopPlate3: figTopPlate3,
4966
+ faceSidePlate: figSidePlate,
4967
+ faceSideArc: figSideArc,
4968
+ faceRelief3: figRelief3,
4969
+ faceRelief4: figRelief4,
4970
+ faceRelief5: figRelief5
4971
+ };
4972
+ const designName = rGeome.partName;
4973
+ const partExtrude = [];
4974
+ const partList = [];
4975
+ if (param.H11 > 0) {
4976
+ const eName = `subpax_${designName}_plate1`;
4977
+ const HH = H23 + param.H15 + param.H14 + param.H13 + param.H12;
4978
+ partExtrude.push({
4979
+ outName: eName,
4980
+ face: `${designName}_faceTopPlate1`,
4981
+ extrudeMethod: EExtrude11.eLinearOrtho,
4982
+ length: param.H11,
4983
+ rotate: [0, 0, 0],
4984
+ translate: [0, 0, HH]
4985
+ });
4986
+ partList.push(eName);
4987
+ }
4988
+ if (param.H12 > 0) {
4989
+ const eName = `subpax_${designName}_wall11`;
4990
+ const HH = H23 + param.H15 + param.H14 + param.H13;
4991
+ partExtrude.push({
4992
+ outName: eName,
4993
+ face: `${designName}_faceTopWall1`,
4994
+ extrudeMethod: EExtrude11.eLinearOrtho,
4995
+ length: param.H12,
4996
+ rotate: [0, 0, 0],
4997
+ translate: [0, 0, HH]
4998
+ });
4999
+ partList.push(eName);
5000
+ }
5001
+ if (param.H13 > 0) {
5002
+ const eName = `subpax_${designName}_wall2`;
5003
+ const HH = H23 + param.H15 + param.H14;
5004
+ partExtrude.push({
5005
+ outName: eName,
5006
+ face: `${designName}_faceTopWall2`,
5007
+ extrudeMethod: EExtrude11.eLinearOrtho,
5008
+ length: param.H13,
5009
+ rotate: [0, 0, 0],
5010
+ translate: [0, 0, HH]
5011
+ });
5012
+ partList.push(eName);
5013
+ }
5014
+ if (param.H14 > 0) {
5015
+ const eName = `subpax_${designName}_wall12`;
5016
+ const HH = H23 + param.H15;
5017
+ partExtrude.push({
5018
+ outName: eName,
5019
+ face: `${designName}_faceTopWall1`,
5020
+ extrudeMethod: EExtrude11.eLinearOrtho,
5021
+ length: param.H14,
5022
+ rotate: [0, 0, 0],
5023
+ translate: [0, 0, HH]
5024
+ });
5025
+ partList.push(eName);
5026
+ }
5027
+ if (param.H15 > 0) {
5028
+ const eName = `subpax_${designName}_plate2`;
5029
+ partExtrude.push({
5030
+ outName: eName,
5031
+ face: `${designName}_faceTopPlate2`,
5032
+ extrudeMethod: EExtrude11.eLinearOrtho,
5033
+ length: param.H15,
5034
+ rotate: [0, 0, 0],
5035
+ translate: [0, 0, H23]
5036
+ });
5037
+ partList.push(eName);
5038
+ }
5039
+ if (param.H2 > 0) {
5040
+ const eName = `subpax_${designName}_tube`;
5041
+ partExtrude.push({
5042
+ outName: eName,
5043
+ face: `${designName}_faceTopTube`,
5044
+ extrudeMethod: EExtrude11.eLinearOrtho,
5045
+ length: param.H2,
5046
+ rotate: [0, 0, 0],
5047
+ translate: [0, 0, H3tot]
5048
+ });
5049
+ partList.push(eName);
5050
+ }
5051
+ if (param.H31 > 0) {
5052
+ const eName = `subpax_${designName}_plate3`;
5053
+ partExtrude.push({
5054
+ outName: eName,
5055
+ face: `${designName}_faceTopPlate3`,
5056
+ extrudeMethod: EExtrude11.eLinearOrtho,
5057
+ length: param.H31,
5058
+ rotate: [0, 0, 0],
5059
+ translate: [0, 0, H3tot - param.H31]
5060
+ });
5061
+ partList.push(eName);
5062
+ }
5063
+ if (param.T5a > 0) {
5064
+ const eName = `subpax_${designName}_sideplate5`;
5065
+ partExtrude.push({
5066
+ outName: eName,
5067
+ face: `${designName}_faceSidePlate`,
5068
+ extrudeMethod: EExtrude11.eLinearOrtho,
5069
+ length: param.T5a,
5070
+ rotate: [pi2, 0, -pi2],
5071
+ translate: [param.T5a + Lend + param.T5b, 0, 0]
5072
+ });
5073
+ partList.push(eName);
5074
+ }
5075
+ if (param.T4a > 0) {
5076
+ const eName = `subpax_${designName}_sideplate4`;
5077
+ partExtrude.push({
5078
+ outName: eName,
5079
+ face: `${designName}_faceSidePlate`,
5080
+ extrudeMethod: EExtrude11.eLinearOrtho,
5081
+ length: param.T4a,
5082
+ rotate: [pi2, 0, -pi2],
5083
+ translate: [param.T4a + Xtube + param.S3, 0, 0]
5084
+ });
5085
+ partList.push(eName);
5086
+ }
5087
+ if (param.T2 > 0) {
5088
+ const eName = `subpax_${designName}_sidearc1`;
5089
+ partExtrude.push({
5090
+ outName: eName,
5091
+ face: `${designName}_faceSideArc`,
5092
+ extrudeMethod: EExtrude11.eLinearOrtho,
5093
+ length: param.T2,
5094
+ rotate: [pi2, 0, 0],
5095
+ translate: [0, param.T2 - Y9, 0]
5096
+ });
5097
+ partList.push(eName);
5098
+ }
5099
+ if (param.T2 > 0) {
5100
+ const eName = `subpax_${designName}_sidearc2`;
5101
+ partExtrude.push({
5102
+ outName: eName,
5103
+ face: `${designName}_faceSideArc`,
5104
+ extrudeMethod: EExtrude11.eLinearOrtho,
5105
+ length: param.T2,
5106
+ rotate: [pi2, 0, 0],
5107
+ translate: [0, Y9, 0]
5108
+ });
5109
+ partList.push(eName);
5110
+ }
5111
+ if (param.T3b > 0) {
5112
+ const eName = `subpax_${designName}_siderelief3`;
5113
+ partExtrude.push({
5114
+ outName: eName,
5115
+ face: `${designName}_faceRelief3`,
5116
+ extrudeMethod: EExtrude11.eLinearOrtho,
5117
+ length: param.T3b,
5118
+ rotate: [pi2, 0, -pi2],
5119
+ translate: [param.T3b + R2 + param.S1, 0, 0]
5120
+ });
5121
+ partList.push(eName);
5122
+ }
5123
+ if (param.T5b > 0) {
5124
+ const eName = `subpax_${designName}_siderelief5`;
5125
+ partExtrude.push({
5126
+ outName: eName,
5127
+ face: `${designName}_faceRelief5`,
5128
+ extrudeMethod: EExtrude11.eLinearOrtho,
5129
+ length: param.T5b,
5130
+ rotate: [pi2, 0, -pi2],
5131
+ translate: [param.T5b + Lend, 0, 0]
5132
+ });
5133
+ partList.push(eName);
5134
+ }
5135
+ if (param.T4b > 0) {
5136
+ const eName = `subpax_${designName}_siderelief4`;
5137
+ partExtrude.push({
5138
+ outName: eName,
5139
+ face: `${designName}_faceRelief4`,
5140
+ extrudeMethod: EExtrude11.eLinearOrtho,
5141
+ length: param.T4b,
5142
+ rotate: [pi2, 0, -pi2],
5143
+ translate: [R2 + Lextra, 0, 0]
5144
+ });
5145
+ partList.push(eName);
5146
+ }
5147
+ rGeome.vol = {
5148
+ //inherits: partInherit,
5149
+ extrudes: partExtrude,
5150
+ volumes: [
5151
+ {
5152
+ outName: `pax_${designName}`,
5153
+ boolMethod: EBVolume11.eUnion,
5154
+ inList: partList
5155
+ }
5156
+ ]
5157
+ };
5158
+ rGeome.sub = {};
5159
+ rGeome.logstr += "pivot drawn successfully!\n";
5160
+ rGeome.calcErr = false;
5161
+ } catch (emsg) {
5162
+ rGeome.logstr += emsg;
5163
+ console.log(emsg);
5164
+ }
5165
+ return rGeome;
5166
+ }
5167
+ var pivotDef = {
5168
+ pTitle: "pivot",
5169
+ pDescription: "the motor-wheel block of rc-car",
5170
+ pDef: pDef11,
5171
+ pGeom: pGeom11
5172
+ };
5173
+
5174
+ // src/rccar/wheel.ts
5175
+ import {
5176
+ contourCircle as contourCircle11,
5177
+ figure as figure12,
5178
+ ffix as ffix11,
5179
+ pNumber as pNumber12,
5180
+ pSectionSeparator as pSectionSeparator12,
5181
+ EExtrude as EExtrude12,
5182
+ EBVolume as EBVolume12,
5183
+ initGeom as initGeom12
5184
+ } from "geometrix";
5185
+ var pDef12 = {
5186
+ partName: "wheel",
5187
+ params: [
5188
+ //pNumber(name, unit, init, min, max, step)
5189
+ pNumber12("D1", "mm", 20, 1, 1e3, 0.1),
5190
+ pNumber12("RD2", "mm", 1, 1, 500, 1),
5191
+ pNumber12("RD3", "mm", 5, 1, 500, 1),
5192
+ pNumber12("RD4", "mm", 2, 1, 500, 1),
5193
+ pNumber12("RD5", "mm", 20, 1, 500, 1),
5194
+ pNumber12("RD6", "mm", 4, 1, 500, 1),
5195
+ pNumber12("N6", "teeth", 20, 5, 1e3, 1),
5196
+ pSectionSeparator12("widths"),
5197
+ pNumber12("W1", "mm", 1, 0, 500, 1),
5198
+ pNumber12("W2", "mm", 20, 1, 500, 1),
5199
+ pNumber12("W3", "mm", 0, 0, 500, 1),
5200
+ pNumber12("W4", "mm", 2, 1, 500, 1),
5201
+ pNumber12("W5", "mm", 2, 1, 500, 1),
5202
+ pNumber12("W6", "mm", 1, 0, 500, 1)
5203
+ ],
5204
+ paramSvg: {
5205
+ D1: "wheel_side.svg",
5206
+ RD2: "wheel_side.svg",
5207
+ RD3: "wheel_cut.svg",
5208
+ RD4: "wheel_cut.svg",
5209
+ RD5: "wheel_side.svg",
5210
+ RD6: "wheel_side.svg",
5211
+ N6: "wheel_side.svg",
5212
+ W1: "wheel_cut.svg",
5213
+ W2: "wheel_cut.svg",
5214
+ W3: "wheel_cut.svg",
5215
+ W4: "wheel_cut.svg",
5216
+ W5: "wheel_cut.svg",
5217
+ W6: "wheel_cut.svg"
5218
+ },
5219
+ sim: {
5220
+ tMax: 180,
5221
+ tStep: 0.5,
5222
+ tUpdate: 500
5223
+ // every 0.5 second
5224
+ }
5225
+ };
5226
+ function pGeom12(t, param, suffix = "") {
5227
+ const rGeome = initGeom12(pDef12.partName + suffix);
5228
+ const figTube = figure12();
5229
+ const figPneu = figure12();
5230
+ const figTrans1 = figure12();
5231
+ const figTrans2 = figure12();
5232
+ const figCut = figure12();
5233
+ rGeome.logstr += `${rGeome.partName} simTime: ${t}
5234
+ `;
5235
+ try {
5236
+ const R1 = param.D1 / 2;
5237
+ const Rpneu = R1 + param.RD2 + param.RD5 + param.RD6;
5238
+ const Rtrans = R1 + param.RD2 + param.RD3 + param.RD4;
5239
+ const Wtot = param.W1 + param.W2 + param.W3 + 2 * param.W4 + param.W5 + param.W6;
5240
+ if (Rpneu < Rtrans) {
5241
+ throw `err230: Dpneu ${ffix11(2 * Rpneu)} is too small compare to Dtrans ${ffix11(2 * Rtrans)}`;
5242
+ }
5243
+ rGeome.logstr += `Wtot ${ffix11(Wtot)} Dpneu ${ffix11(2 * Rpneu)} Dtrans ${ffix11(2 * Rtrans)} mm
5244
+ `;
5245
+ figTube.addMainO(contourCircle11(0, 0, R1));
5246
+ rGeome.fig = {
5247
+ faceTube: figTube,
5248
+ facePneu: figPneu,
5249
+ faceTrans1: figTrans1,
5250
+ faceTrans2: figTrans2,
5251
+ faceCut: figCut
5252
+ };
5253
+ const designName = rGeome.partName;
5254
+ const partExtrude = [];
5255
+ const partList = [];
5256
+ if (param.W2 > 0) {
5257
+ const eName = `subpax_${designName}_pneu`;
5258
+ partExtrude.push({
5259
+ outName: eName,
5260
+ face: `${designName}_facePneu`,
5261
+ extrudeMethod: EExtrude12.eLinearOrtho,
5262
+ length: param.W2,
5263
+ rotate: [0, 0, 0],
5264
+ translate: [0, 0, param.W1]
5265
+ });
5266
+ partList.push(eName);
5267
+ }
5268
+ rGeome.vol = {
5269
+ //inherits: partInherit,
5270
+ extrudes: partExtrude,
5271
+ volumes: [
5272
+ {
5273
+ outName: `pax_${designName}`,
5274
+ boolMethod: EBVolume12.eUnion,
5275
+ inList: partList
5276
+ }
5277
+ ]
5278
+ };
5279
+ rGeome.sub = {};
5280
+ rGeome.logstr += "wheel drawn successfully!\n";
5281
+ rGeome.calcErr = false;
5282
+ } catch (emsg) {
5283
+ rGeome.logstr += emsg;
5284
+ console.log(emsg);
5285
+ }
5286
+ return rGeome;
5287
+ }
5288
+ var wheelDef = {
5289
+ pTitle: "wheel",
5290
+ pDescription: "one wheel of the rc-car",
5291
+ pDef: pDef12,
5292
+ pGeom: pGeom12
5293
+ };
4553
5294
  export {
4554
5295
  abriDef,
4555
5296
  catamaranDef,
@@ -4557,9 +5298,11 @@ export {
4557
5298
  liftDef,
4558
5299
  long2dDef,
4559
5300
  losangeDef,
5301
+ pivotDef,
4560
5302
  scaraDef,
4561
5303
  scarabaseDef,
4562
5304
  stairsDef,
4563
- voilaDef
5305
+ voilaDef,
5306
+ wheelDef
4564
5307
  };
4565
5308
  //# sourceMappingURL=index.js.map