desi77 0.1.9 → 0.1.11

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
@@ -864,40 +864,337 @@ var stoneTowerDef = {
864
864
  pGeom: pGeom2
865
865
  };
866
866
 
867
- // src/spring/springTorqueA.ts
867
+ // src/stone/house.ts
868
868
  import {
869
- point as point2,
870
869
  contour as contour3,
871
- contourCircle as contourCircle2,
870
+ ctrRectangle as ctrRectangle3,
872
871
  figure as figure3,
873
- radToDeg as radToDeg3,
874
872
  ffix as ffix3,
875
873
  pNumber as pNumber3,
876
- pCheckbox as pCheckbox2,
877
874
  pSectionSeparator as pSectionSeparator3,
878
875
  EExtrude as EExtrude3,
879
876
  EBVolume as EBVolume3,
880
877
  initGeom as initGeom3
881
878
  } from "geometrix";
882
879
  var pDef3 = {
880
+ partName: "house",
881
+ params: [
882
+ //pNumber(name, unit, init, min, max, step)
883
+ pNumber3("WA", "cm", 1e3, 100, 2e3, 1),
884
+ pNumber3("WB", "cm", 800, 100, 2e3, 1),
885
+ pNumber3("WC", "cm", 800, 100, 2e3, 1),
886
+ pNumber3("WD", "cm", 500, 100, 2e3, 1),
887
+ pNumber3("WE", "cm", 400, 100, 2e3, 1),
888
+ pSectionSeparator3("Heights"),
889
+ pNumber3("HA1", "cm", 400, 200, 2e3, 1),
890
+ pNumber3("HA2", "cm", 1200, 200, 2e3, 1),
891
+ pNumber3("HB1", "cm", 600, 200, 2e3, 1),
892
+ pNumber3("HB2", "cm", 1100, 200, 2e3, 1),
893
+ pNumber3("HC1", "cm", 700, 200, 2e3, 1),
894
+ pNumber3("HC2", "cm", 600, 200, 2e3, 1),
895
+ pNumber3("HD1", "cm", 700, 200, 2e3, 1),
896
+ pNumber3("HD2", "cm", 600, 200, 2e3, 1),
897
+ pNumber3("HE1", "cm", 1e3, 200, 2e3, 1),
898
+ pNumber3("HE2", "cm", 600, 200, 2e3, 1),
899
+ pSectionSeparator3("L-Lengths"),
900
+ pNumber3("L1", "cm", 1200, 200, 2e3, 1),
901
+ pNumber3("L2", "cm", 200, 200, 2e3, 1),
902
+ pNumber3("L3", "cm", 1500, 200, 2e3, 1),
903
+ pNumber3("S1", "cm", 200, 50, 2e3, 1),
904
+ pNumber3("S2", "cm", 300, 50, 2e3, 1),
905
+ pNumber3("S3", "cm", 100, 50, 2e3, 1),
906
+ pNumber3("Ht", "cm", 400, 50, 2e3, 1),
907
+ pSectionSeparator3("M-Lengths"),
908
+ pNumber3("M1", "cm", 200, 50, 2e3, 1),
909
+ pNumber3("M2", "cm", 400, 50, 2e3, 1),
910
+ pNumber3("M3", "cm", 800, 50, 2e3, 1),
911
+ pNumber3("M4", "cm", 100, 50, 2e3, 1),
912
+ pSectionSeparator3("Nest"),
913
+ pNumber3("AE1", "cm", 400, 50, 2e3, 1),
914
+ pNumber3("AE2", "cm", 300, 50, 2e3, 1),
915
+ pNumber3("BE1", "cm", 400, 50, 2e3, 1),
916
+ pNumber3("BE2", "cm", 400, 50, 2e3, 1)
917
+ ],
918
+ paramSvg: {
919
+ WA: "house_top.svg",
920
+ WB: "house_top.svg",
921
+ WC: "house_top.svg",
922
+ WD: "house_top.svg",
923
+ WE: "house_top.svg",
924
+ HA1: "house_pignon.svg",
925
+ HA2: "house_pignon.svg",
926
+ HB1: "house_pignon.svg",
927
+ HB2: "house_pignon.svg",
928
+ HC1: "house_pignon.svg",
929
+ HC2: "house_pignon.svg",
930
+ HD1: "house_pignon.svg",
931
+ HD2: "house_pignon.svg",
932
+ HE1: "house_pignon.svg",
933
+ HE2: "house_pignon.svg",
934
+ L1: "house_top.svg",
935
+ L2: "house_top.svg",
936
+ L3: "house_top.svg",
937
+ S1: "house_top.svg",
938
+ S2: "house_top.svg",
939
+ S3: "house_top.svg",
940
+ Ht: "house_top.svg",
941
+ M1: "house_top.svg",
942
+ M2: "house_top.svg",
943
+ M3: "house_top.svg",
944
+ M4: "house_top.svg",
945
+ AE1: "house_top.svg",
946
+ AE2: "house_top.svg",
947
+ BE1: "house_top.svg",
948
+ BE2: "house_top.svg"
949
+ },
950
+ sim: {
951
+ tMax: 180,
952
+ tStep: 0.5,
953
+ tUpdate: 500
954
+ // every 0.5 second
955
+ }
956
+ };
957
+ function pGeom3(t, param, suffix = "") {
958
+ const rGeome = initGeom3(pDef3.partName + suffix);
959
+ const figPA = figure3();
960
+ const figPB = figure3();
961
+ const figPC = figure3();
962
+ const figPD = figure3();
963
+ const figPE = figure3();
964
+ const figTerrasse = figure3();
965
+ rGeome.logstr += `${rGeome.partName} simTime: ${t}
966
+ `;
967
+ try {
968
+ let makeCtrPignon2 = function(iW2, iH1, iH2) {
969
+ const rCtr = contour3(-iW2, 0).addSegStrokeR(2 * iW2, 0).addSegStrokeR(0, iH1).addSegStrokeR(-iW2, iH2).addSegStrokeR(-iW2, -iH2).closeSegStroke();
970
+ return rCtr;
971
+ }, makeCtrPtop2 = function(iW2, iL, iOrientation, iX, iY) {
972
+ const rCtr = ctrRectangle3(-iW2, 0, 2 * iW2, iL).rotate(0, 0, (2 + iOrientation) * pi2).translate(iX, iY);
973
+ return rCtr;
974
+ };
975
+ var makeCtrPignon = makeCtrPignon2, makeCtrPtop = makeCtrPtop2;
976
+ const WA2 = param.WA / 2;
977
+ const WB2 = param.WB / 2;
978
+ const WC2 = param.WC / 2;
979
+ const WD2 = param.WD / 2;
980
+ const WE2 = param.WE / 2;
981
+ const HAtotal = param.HA1 + param.HA2;
982
+ const HBtotal = param.HB1 + param.HB2;
983
+ const HCtotal = param.HC1 + param.HC2;
984
+ const HDtotal = param.HD1 + param.HD2;
985
+ const HEtotal = param.HE1 + param.HE2;
986
+ if (HBtotal < HAtotal) {
987
+ throw `err167: HBtotal ${ffix3(HBtotal)} is too small compare to HAtotal ${ffix3(HAtotal)}`;
988
+ }
989
+ rGeome.logstr += `HAtotal ${ffix3(HAtotal / 100)} m
990
+ `;
991
+ rGeome.logstr += `HBtotal ${ffix3(HBtotal / 100)} m
992
+ `;
993
+ rGeome.logstr += `HCtotal ${ffix3(HCtotal / 100)} m
994
+ `;
995
+ rGeome.logstr += `HDtotal ${ffix3(HDtotal / 100)} m
996
+ `;
997
+ rGeome.logstr += `HEtotal ${ffix3(HEtotal / 100)} m
998
+ `;
999
+ const pi2 = Math.PI / 2;
1000
+ figPA.addMainO(makeCtrPignon2(WA2, param.HA1, param.HA2));
1001
+ figPB.addMainO(makeCtrPignon2(WB2, param.HB1, param.HB2));
1002
+ figPC.addMainO(makeCtrPignon2(WC2, param.HC1, param.HC2));
1003
+ figPD.addMainO(makeCtrPignon2(WD2, param.HD1, param.HD2));
1004
+ figPE.addMainO(makeCtrPignon2(WE2, param.HE1, param.HE2));
1005
+ figPA.mergeFigure(figPB.translate(WA2 + WB2, 0), true);
1006
+ figPA.mergeFigure(figPC.translate(WA2 + 2 * WB2 + WC2, 0), true);
1007
+ figPA.mergeFigure(figPD.translate(WA2 + 2 * (WB2 + WC2) + WD2, 0), true);
1008
+ figPA.mergeFigure(figPE.translate(WA2 + 2 * (WB2 + WC2 + WD2) + WE2, 0), true);
1009
+ figPA.addSecond(ctrRectangle3(-WA2 - param.S2, 0, param.S2, param.Ht));
1010
+ const xTerrasse1 = WB2 + 2 * WC2 + param.L1;
1011
+ const xTerrasse2 = WB2 + param.L3 / 2;
1012
+ const pALenW = xTerrasse1;
1013
+ const pALenE = WB2 + param.L2;
1014
+ const pBLenN = WA2 + param.M2;
1015
+ const pBLenS = WA2 + param.M3 + param.M4;
1016
+ const pCLenN = WA2 + param.M1;
1017
+ const pCx = -WB2 - WC2;
1018
+ const pD1LenS = WA2;
1019
+ const pD1x = -WB2 - param.L3 + WD2 + param.S3;
1020
+ const pD2LenE = WB2;
1021
+ const pD2y = -WA2 - param.M3 + WD2;
1022
+ const pE1LenS = param.AE1;
1023
+ const pE1x = -param.BE1 - WE2;
1024
+ const pE2LenW = param.AE2;
1025
+ const pE2y = -param.BE2 - WE2;
1026
+ figTerrasse.addMainO(makeCtrPtop2(WA2 / 2, param.S1, 3, -xTerrasse1, 0));
1027
+ figTerrasse.addMainO(makeCtrPtop2(param.L3 / 2, param.S2, 0, -xTerrasse2, -WA2));
1028
+ figTerrasse.addSecond(makeCtrPtop2(WA2, pALenW, 3, 0, 0));
1029
+ figTerrasse.addSecond(makeCtrPtop2(WA2, pALenE, 1, 0, 0));
1030
+ figTerrasse.addSecond(makeCtrPtop2(WB2, pBLenN, 2, 0, 0));
1031
+ figTerrasse.addSecond(makeCtrPtop2(WB2, pBLenS, 0, 0, 0));
1032
+ figTerrasse.addSecond(makeCtrPtop2(WC2, pCLenN, 2, pCx, 0));
1033
+ figTerrasse.addSecond(makeCtrPtop2(WD2, pD1LenS, 0, pD1x, 0));
1034
+ figTerrasse.addSecond(makeCtrPtop2(WD2, pD2LenE, 1, 0, pD2y));
1035
+ figTerrasse.addSecond(makeCtrPtop2(WE2, pE1LenS, 0, pE1x, 0));
1036
+ figTerrasse.addSecond(makeCtrPtop2(WE2, pE2LenW, 3, 0, pE2y));
1037
+ rGeome.fig = {
1038
+ facePA: figPA,
1039
+ facePB: figPB,
1040
+ facePC: figPC,
1041
+ facePD: figPD,
1042
+ facePE: figPE,
1043
+ faceTerrasse: figTerrasse
1044
+ };
1045
+ const designName = rGeome.partName;
1046
+ rGeome.vol = {
1047
+ extrudes: [
1048
+ {
1049
+ outName: `subpax_${designName}_pAw`,
1050
+ face: `${designName}_facePA`,
1051
+ extrudeMethod: EExtrude3.eLinearOrtho,
1052
+ length: pALenW,
1053
+ rotate: [pi2, 0, 3 * pi2],
1054
+ translate: [0, 0, 0]
1055
+ },
1056
+ {
1057
+ outName: `subpax_${designName}_pAe`,
1058
+ face: `${designName}_facePA`,
1059
+ extrudeMethod: EExtrude3.eLinearOrtho,
1060
+ length: pALenE,
1061
+ rotate: [pi2, 0, 1 * pi2],
1062
+ translate: [0, 0, 0]
1063
+ },
1064
+ {
1065
+ outName: `subpax_${designName}_pBn`,
1066
+ face: `${designName}_facePB`,
1067
+ extrudeMethod: EExtrude3.eLinearOrtho,
1068
+ length: pBLenN,
1069
+ rotate: [pi2, 0, 2 * pi2],
1070
+ translate: [0, 0, 0]
1071
+ },
1072
+ {
1073
+ outName: `subpax_${designName}_pBs`,
1074
+ face: `${designName}_facePB`,
1075
+ extrudeMethod: EExtrude3.eLinearOrtho,
1076
+ length: pBLenS,
1077
+ rotate: [pi2, 0, 0 * pi2],
1078
+ translate: [0, 0, 0]
1079
+ },
1080
+ {
1081
+ outName: `subpax_${designName}_pCn`,
1082
+ face: `${designName}_facePC`,
1083
+ extrudeMethod: EExtrude3.eLinearOrtho,
1084
+ length: pCLenN,
1085
+ rotate: [pi2, 0, 2 * pi2],
1086
+ translate: [pCx, 0, 0]
1087
+ },
1088
+ {
1089
+ outName: `subpax_${designName}_pD1s`,
1090
+ face: `${designName}_facePD`,
1091
+ extrudeMethod: EExtrude3.eLinearOrtho,
1092
+ length: pD1LenS,
1093
+ rotate: [pi2, 0, 0 * pi2],
1094
+ translate: [pD1x, 0, 0]
1095
+ },
1096
+ {
1097
+ outName: `subpax_${designName}_pD2e`,
1098
+ face: `${designName}_facePD`,
1099
+ extrudeMethod: EExtrude3.eLinearOrtho,
1100
+ length: pD2LenE,
1101
+ rotate: [pi2, 0, 1 * pi2],
1102
+ translate: [0, pD2y, 0]
1103
+ },
1104
+ {
1105
+ outName: `subpax_${designName}_pE1s`,
1106
+ face: `${designName}_facePE`,
1107
+ extrudeMethod: EExtrude3.eLinearOrtho,
1108
+ length: pE1LenS,
1109
+ rotate: [pi2, 0, 0 * pi2],
1110
+ translate: [pE1x, 0, 0]
1111
+ },
1112
+ {
1113
+ outName: `subpax_${designName}_pE2w`,
1114
+ face: `${designName}_facePE`,
1115
+ extrudeMethod: EExtrude3.eLinearOrtho,
1116
+ length: pE2LenW,
1117
+ rotate: [pi2, 0, 3 * pi2],
1118
+ translate: [0, pE2y, 0]
1119
+ },
1120
+ {
1121
+ outName: `subpax_${designName}_terras`,
1122
+ face: `${designName}_faceTerrasse`,
1123
+ extrudeMethod: EExtrude3.eLinearOrtho,
1124
+ length: param.Ht,
1125
+ rotate: [0, 0, 0],
1126
+ translate: [0, 0, 0]
1127
+ }
1128
+ ],
1129
+ volumes: [
1130
+ {
1131
+ outName: `pax_${designName}`,
1132
+ boolMethod: EBVolume3.eUnion,
1133
+ inList: [
1134
+ `subpax_${designName}_pAw`,
1135
+ `subpax_${designName}_pAe`,
1136
+ `subpax_${designName}_pBn`,
1137
+ `subpax_${designName}_pBs`,
1138
+ `subpax_${designName}_pCn`,
1139
+ `subpax_${designName}_pD1s`,
1140
+ `subpax_${designName}_pD2e`,
1141
+ `subpax_${designName}_pE1s`,
1142
+ `subpax_${designName}_pE2w`,
1143
+ `subpax_${designName}_terras`
1144
+ ]
1145
+ }
1146
+ ]
1147
+ };
1148
+ rGeome.sub = {};
1149
+ rGeome.logstr += "house drawn successfully!\n";
1150
+ rGeome.calcErr = false;
1151
+ } catch (emsg) {
1152
+ rGeome.logstr += emsg;
1153
+ console.log(emsg);
1154
+ }
1155
+ return rGeome;
1156
+ }
1157
+ var houseDef = {
1158
+ pTitle: "house",
1159
+ pDescription: "the envelop of an house with large roof",
1160
+ pDef: pDef3,
1161
+ pGeom: pGeom3
1162
+ };
1163
+
1164
+ // src/spring/springTorqueA.ts
1165
+ import {
1166
+ point as point2,
1167
+ contour as contour4,
1168
+ contourCircle as contourCircle2,
1169
+ figure as figure4,
1170
+ radToDeg as radToDeg3,
1171
+ ffix as ffix4,
1172
+ pNumber as pNumber4,
1173
+ pCheckbox as pCheckbox2,
1174
+ pSectionSeparator as pSectionSeparator4,
1175
+ EExtrude as EExtrude4,
1176
+ EBVolume as EBVolume4,
1177
+ initGeom as initGeom4
1178
+ } from "geometrix";
1179
+ var pDef4 = {
883
1180
  partName: "springTorqueA",
884
1181
  params: [
885
1182
  //pNumber(name, unit, init, min, max, step)
886
- pNumber3("D1", "mm", 20, 1, 1e3, 1),
887
- pNumber3("N1", "hole", 16, 0, 400, 1),
888
- pNumber3("T1", "mm", 2, 0.1, 50, 0.1),
889
- pNumber3("E1", "mm", 1, 0.1, 50, 0.1),
890
- pSectionSeparator3("External ring"),
1183
+ pNumber4("D1", "mm", 20, 1, 1e3, 1),
1184
+ pNumber4("N1", "hole", 16, 0, 400, 1),
1185
+ pNumber4("T1", "mm", 2, 0.1, 50, 0.1),
1186
+ pNumber4("E1", "mm", 1, 0.1, 50, 0.1),
1187
+ pSectionSeparator4("External ring"),
891
1188
  pCheckbox2("Ring2", true),
892
- pNumber3("D2", "mm", 80, 1, 1e3, 1),
893
- pNumber3("N2", "hole", 16, 0, 400, 1),
894
- pNumber3("T2", "mm", 2, 0.1, 50, 0.1),
895
- pNumber3("E2", "mm", 1, 0.1, 50, 0.1),
896
- pSectionSeparator3("Spoke"),
897
- pNumber3("N3", "spoke", 5, 0, 60, 1),
898
- pNumber3("E3", "mm", 3, 0.1, 100, 0.1),
899
- pNumber3("R3", "mm", 3, 0, 100, 0.1),
900
- pNumber3("Th", "mm", 3, 0.1, 100, 0.1)
1189
+ pNumber4("D2", "mm", 80, 1, 1e3, 1),
1190
+ pNumber4("N2", "hole", 16, 0, 400, 1),
1191
+ pNumber4("T2", "mm", 2, 0.1, 50, 0.1),
1192
+ pNumber4("E2", "mm", 1, 0.1, 50, 0.1),
1193
+ pSectionSeparator4("Spoke"),
1194
+ pNumber4("N3", "spoke", 5, 0, 60, 1),
1195
+ pNumber4("E3", "mm", 3, 0.1, 100, 0.1),
1196
+ pNumber4("R3", "mm", 3, 0, 100, 0.1),
1197
+ pNumber4("Th", "mm", 3, 0.1, 100, 0.1)
901
1198
  ],
902
1199
  paramSvg: {
903
1200
  D1: "springTorqueA_profile.svg",
@@ -921,9 +1218,9 @@ var pDef3 = {
921
1218
  // every 0.5 second
922
1219
  }
923
1220
  };
924
- function pGeom3(t, param, suffix = "") {
925
- const rGeome = initGeom3(pDef3.partName + suffix);
926
- const figProfile = figure3();
1221
+ function pGeom4(t, param, suffix = "") {
1222
+ const rGeome = initGeom4(pDef4.partName + suffix);
1223
+ const figProfile = figure4();
927
1224
  rGeome.logstr += `${rGeome.partName} simTime: ${t}
928
1225
  `;
929
1226
  try {
@@ -945,12 +1242,12 @@ function pGeom3(t, param, suffix = "") {
945
1242
  const aIntMin = 2 * Math.asin((RT1 + 0.5 * param.E1) / R1);
946
1243
  const aInt = param.N1 > 0 ? 2 * Math.PI / param.N1 : 3.14;
947
1244
  if (aInt < aIntMin) {
948
- throw `err101: aInt ${ffix3(radToDeg3(aInt))} is too small compare to aIntMin ${ffix3(radToDeg3(aIntMin))} degree`;
1245
+ throw `err101: aInt ${ffix4(radToDeg3(aInt))} is too small compare to aIntMin ${ffix4(radToDeg3(aIntMin))} degree`;
949
1246
  }
950
1247
  const aExtMin = 2 * Math.asin((RT2 + 0.5 * param.E2) / R2);
951
1248
  const aExt = param.N2 > 0 ? 2 * Math.PI / param.N2 : 3.14;
952
1249
  if (aExt < aExtMin) {
953
- throw `err106: aExt ${ffix3(radToDeg3(aExt))} is too small compare to aExtMin ${ffix3(radToDeg3(aExtMin))} degree`;
1250
+ throw `err106: aExt ${ffix4(radToDeg3(aExt))} is too small compare to aExtMin ${ffix4(radToDeg3(aExtMin))} degree`;
954
1251
  }
955
1252
  const ah2 = Math.asin(E32 / Rh2);
956
1253
  const ah1 = Math.asin(E32 / Rh1);
@@ -961,9 +1258,9 @@ function pGeom3(t, param, suffix = "") {
961
1258
  const Rh1b2 = sinah02 > 0.1 ? (E32 + param.R3) / sinah02 : Rh1 / 2;
962
1259
  const hollowTriangle = param.N3 > 1 && Rh1b2 > Rh1 + param.R3 - 0.1 ? true : false;
963
1260
  if (!hollowTriangle && ah0 < 2 * ahR1) {
964
- throw `err115: ah0 ${ffix3(radToDeg3(ah0))} is too small compare to ah1 ${ffix3(radToDeg3(ah1))}, ahR1 ${ffix3(radToDeg3(ahR1))} degree`;
1261
+ throw `err115: ah0 ${ffix4(radToDeg3(ah0))} is too small compare to ah1 ${ffix4(radToDeg3(ah1))}, ahR1 ${ffix4(radToDeg3(ahR1))} degree`;
965
1262
  }
966
- rGeome.logstr += `Dmax ${ffix3(2 * Rmax)}, Dmin ${ffix3(2 * Rmin)} mm
1263
+ rGeome.logstr += `Dmax ${ffix4(2 * Rmax)}, Dmin ${ffix4(2 * Rmin)} mm
967
1264
  `;
968
1265
  rGeome.logstr += `Triangle vs quadri: ${hollowTriangle ? "triangle" : "quadri"}
969
1266
  `;
@@ -986,7 +1283,7 @@ function pGeom3(t, param, suffix = "") {
986
1283
  const p1 = point2(0, 0).translatePolar(aRef + ah1, Rh1);
987
1284
  const p1b = point2(0, 0).translatePolar(aRef + ah0 / 2, Rh1b);
988
1285
  const [x0, y0] = hollowTriangle ? [p1b.cx, p1b.cy] : [p1.cx, p1.cy];
989
- const iCtr = contour3(x0, y0).addCornerRounded(param.R3).addSegStrokeAP(aRef + ah2, Rh2).addCornerRounded(param.R3).addPointAP(aRef + ah0 / 2, Rh2).addPointAP(aRef + ah0 - ah2, Rh2).addSegArc2().addCornerRounded(param.R3);
1286
+ const iCtr = contour4(x0, y0).addCornerRounded(param.R3).addSegStrokeAP(aRef + ah2, Rh2).addCornerRounded(param.R3).addPointAP(aRef + ah0 / 2, Rh2).addPointAP(aRef + ah0 - ah2, Rh2).addSegArc2().addCornerRounded(param.R3);
990
1287
  if (hollowTriangle) {
991
1288
  iCtr.closeSegStroke();
992
1289
  } else {
@@ -1008,7 +1305,7 @@ function pGeom3(t, param, suffix = "") {
1008
1305
  {
1009
1306
  outName: `subpax_${designName}_profile`,
1010
1307
  face: `${designName}_faceProfile`,
1011
- extrudeMethod: EExtrude3.eLinearOrtho,
1308
+ extrudeMethod: EExtrude4.eLinearOrtho,
1012
1309
  length: param.Th,
1013
1310
  rotate: [0, 0, 0],
1014
1311
  translate: [0, 0, 0]
@@ -1017,7 +1314,7 @@ function pGeom3(t, param, suffix = "") {
1017
1314
  volumes: [
1018
1315
  {
1019
1316
  outName: `pax_${designName}`,
1020
- boolMethod: EBVolume3.eIdentity,
1317
+ boolMethod: EBVolume4.eIdentity,
1021
1318
  inList: [`subpax_${designName}_profile`]
1022
1319
  }
1023
1320
  ]
@@ -1034,36 +1331,36 @@ function pGeom3(t, param, suffix = "") {
1034
1331
  var springTorqueADef = {
1035
1332
  pTitle: "springTorqueA",
1036
1333
  pDescription: "spring disc for torque transmission",
1037
- pDef: pDef3,
1038
- pGeom: pGeom3
1334
+ pDef: pDef4,
1335
+ pGeom: pGeom4
1039
1336
  };
1040
1337
 
1041
1338
  // src/spring/plugTorque.ts
1042
1339
  import {
1043
1340
  withinPiPi as withinPiPi2,
1044
1341
  point as point3,
1045
- contour as contour5,
1342
+ contour as contour6,
1046
1343
  contourCircle as contourCircle3,
1047
- figure as figure4,
1344
+ figure as figure5,
1048
1345
  degToRad as degToRad2,
1049
1346
  radToDeg as radToDeg5,
1050
- ffix as ffix5,
1051
- pNumber as pNumber4,
1347
+ ffix as ffix6,
1348
+ pNumber as pNumber5,
1052
1349
  pDropdown as pDropdown2,
1053
- pSectionSeparator as pSectionSeparator4,
1054
- EExtrude as EExtrude4,
1055
- EBVolume as EBVolume4,
1056
- initGeom as initGeom4
1350
+ pSectionSeparator as pSectionSeparator5,
1351
+ EExtrude as EExtrude5,
1352
+ EBVolume as EBVolume5,
1353
+ initGeom as initGeom5
1057
1354
  } from "geometrix";
1058
1355
  import { triALLrLAA as triALLrLAA2 } from "triangule";
1059
1356
 
1060
1357
  // src/spring/libPlugTorque.ts
1061
1358
  import {
1062
1359
  withinPiPi,
1063
- contour as contour4,
1360
+ contour as contour5,
1064
1361
  degToRad,
1065
1362
  radToDeg as radToDeg4,
1066
- ffix as ffix4
1363
+ ffix as ffix5
1067
1364
  } from "geometrix";
1068
1365
  import { triALLrLAA } from "triangule";
1069
1366
  function ctrPlugExtern(param, RbEmax) {
@@ -1093,9 +1390,9 @@ function ctrPlugExtern(param, RbEmax) {
1093
1390
  }
1094
1391
  const tooSmallAngle = 1e-4;
1095
1392
  if (aAddE < tooSmallAngle || aDedE < tooSmallAngle) {
1096
- throw `err164: aAddE ${ffix4(radToDeg4(aAddE))} or aDedE ${ffix4(radToDeg4(aDedE))} are too small`;
1393
+ throw `err164: aAddE ${ffix5(radToDeg4(aAddE))} or aDedE ${ffix5(radToDeg4(aDedE))} are too small`;
1097
1394
  }
1098
- const ctrToothE = contour4(RminE, 0);
1395
+ const ctrToothE = contour5(RminE, 0);
1099
1396
  for (let ii = 0; ii < param.Nt; ii++) {
1100
1397
  const aRef = ii * aTooth;
1101
1398
  ctrToothE.addSegStrokeAP(aRef + aSlopeE, RbE).addCornerRounded(param.Rae);
@@ -1117,42 +1414,42 @@ function ctrPlugExtern(param, RbEmax) {
1117
1414
  }
1118
1415
 
1119
1416
  // src/spring/plugTorque.ts
1120
- var pDef4 = {
1417
+ var pDef5 = {
1121
1418
  partName: "plugTorque",
1122
1419
  params: [
1123
1420
  //pNumber(name, unit, init, min, max, step)
1124
- pNumber4("Nt", "teeth", 8, 1, 1e3, 1),
1125
- pNumber4("Dt", "mm", 22, 0.1, 1e3, 0.1),
1126
- pNumber4("Ht", "mm", 2, 0.1, 100, 0.1),
1127
- pNumber4("Th", "mm", 1, 0.1, 100, 0.1),
1421
+ pNumber5("Nt", "teeth", 8, 1, 1e3, 1),
1422
+ pNumber5("Dt", "mm", 22, 0.1, 1e3, 0.1),
1423
+ pNumber5("Ht", "mm", 2, 0.1, 100, 0.1),
1424
+ pNumber5("Th", "mm", 1, 0.1, 100, 0.1),
1128
1425
  pDropdown2("make3D", ["both", "intern", "extern"]),
1129
- pSectionSeparator4("Tooth profile"),
1130
- pNumber4("ati", "%", 50, 1, 99, 0.1),
1131
- pNumber4("ate", "%", 52, 1, 99, 1),
1132
- pNumber4("ah", "%", 100, 1, 400, 1),
1133
- pNumber4("dh", "%", 100, 1, 400, 1),
1134
- pNumber4("aeh", "%", 10, 0, 100, 1),
1135
- pNumber4("deh", "%", 10, 0, 100, 1),
1136
- pNumber4("aM", "degree", 0, -30, 30, 0.1),
1137
- pSectionSeparator4("Tooth profile details"),
1426
+ pSectionSeparator5("Tooth profile"),
1427
+ pNumber5("ati", "%", 50, 1, 99, 0.1),
1428
+ pNumber5("ate", "%", 52, 1, 99, 1),
1429
+ pNumber5("ah", "%", 100, 1, 400, 1),
1430
+ pNumber5("dh", "%", 100, 1, 400, 1),
1431
+ pNumber5("aeh", "%", 10, 0, 100, 1),
1432
+ pNumber5("deh", "%", 10, 0, 100, 1),
1433
+ pNumber5("aM", "degree", 0, -30, 30, 0.1),
1434
+ pSectionSeparator5("Tooth profile details"),
1138
1435
  pDropdown2("SnAai", ["stroke", "arc"]),
1139
1436
  pDropdown2("SnAae", ["stroke", "arc"]),
1140
1437
  pDropdown2("SnAdi", ["stroke", "arc"]),
1141
1438
  pDropdown2("SnAde", ["stroke", "arc"]),
1142
- pNumber4("Rai", "mm", 1, 0, 50, 0.1),
1143
- pNumber4("Rae", "mm", 1, 0, 50, 0.1),
1144
- pNumber4("Rdi", "mm", 1, 0, 50, 0.1),
1145
- pNumber4("Rde", "mm", 1, 0, 50, 0.1),
1146
- pSectionSeparator4("Internal part"),
1147
- pNumber4("Ni", "holes", 5, 0, 1e3, 1),
1148
- pNumber4("Di", "mm", 12, 0.1, 1e3, 0.1),
1149
- pNumber4("DTi", "mm", 3, 0.1, 100, 0.1),
1150
- pNumber4("Ei", "mm", 1, 0.1, 100, 0.1),
1151
- pSectionSeparator4("External part"),
1152
- pNumber4("Ne", "holes", 8, 0, 1e3, 1),
1153
- pNumber4("De", "mm", 32, 0.1, 1e3, 0.1),
1154
- pNumber4("DTe", "mm", 3, 0.1, 100, 0.1),
1155
- pNumber4("Ee", "mm", 1, 0.1, 100, 0.1)
1439
+ pNumber5("Rai", "mm", 1, 0, 50, 0.1),
1440
+ pNumber5("Rae", "mm", 1, 0, 50, 0.1),
1441
+ pNumber5("Rdi", "mm", 1, 0, 50, 0.1),
1442
+ pNumber5("Rde", "mm", 1, 0, 50, 0.1),
1443
+ pSectionSeparator5("Internal part"),
1444
+ pNumber5("Ni", "holes", 5, 0, 1e3, 1),
1445
+ pNumber5("Di", "mm", 12, 0.1, 1e3, 0.1),
1446
+ pNumber5("DTi", "mm", 3, 0.1, 100, 0.1),
1447
+ pNumber5("Ei", "mm", 1, 0.1, 100, 0.1),
1448
+ pSectionSeparator5("External part"),
1449
+ pNumber5("Ne", "holes", 8, 0, 1e3, 1),
1450
+ pNumber5("De", "mm", 32, 0.1, 1e3, 0.1),
1451
+ pNumber5("DTe", "mm", 3, 0.1, 100, 0.1),
1452
+ pNumber5("Ee", "mm", 1, 0.1, 100, 0.1)
1156
1453
  ],
1157
1454
  paramSvg: {
1158
1455
  Nt: "plugTorque_teeth_radial.svg",
@@ -1191,10 +1488,10 @@ var pDef4 = {
1191
1488
  // every 0.5 second
1192
1489
  }
1193
1490
  };
1194
- function pGeom4(t, param, suffix = "") {
1195
- const rGeome = initGeom4(pDef4.partName + suffix);
1196
- const figIntern = figure4();
1197
- const figExtern = figure4();
1491
+ function pGeom5(t, param, suffix = "") {
1492
+ const rGeome = initGeom5(pDef5.partName + suffix);
1493
+ const figIntern = figure5();
1494
+ const figExtern = figure5();
1198
1495
  rGeome.logstr += `${rGeome.partName} simTime: ${t}
1199
1496
  `;
1200
1497
  try {
@@ -1249,10 +1546,10 @@ function pGeom4(t, param, suffix = "") {
1249
1546
  throw `err087: RminI ${RminI} is too small because of Di ${param.Di}, DTi ${param.DTi} or Ei ${param.Ei}`;
1250
1547
  }
1251
1548
  if (adTi < 2 * aMindTi) {
1252
- throw `err131: adTi ${ffix5(radToDeg5(adTi))} is too small compare to aMindTi ${ffix5(radToDeg5(aMindTi))} degree`;
1549
+ throw `err131: adTi ${ffix6(radToDeg5(adTi))} is too small compare to aMindTi ${ffix6(radToDeg5(aMindTi))} degree`;
1253
1550
  }
1254
1551
  if (adTe < 2 * aMindTe) {
1255
- throw `err134: adTe ${ffix5(radToDeg5(adTe))} is too small compare to aMindTe ${ffix5(radToDeg5(aMindTe))} degree`;
1552
+ throw `err134: adTe ${ffix6(radToDeg5(adTe))} is too small compare to aMindTe ${ffix6(radToDeg5(aMindTe))} degree`;
1256
1553
  }
1257
1554
  if (param.ati > param.ate) {
1258
1555
  throw `err145: ate ${param.ate} is too small compare to ati ${param.ati} %`;
@@ -1265,22 +1562,22 @@ function pGeom4(t, param, suffix = "") {
1265
1562
  }
1266
1563
  const tooSmallAngle = 1e-4;
1267
1564
  if (aAddI < tooSmallAngle || aDedI < tooSmallAngle) {
1268
- throw `err161: aAddI ${ffix5(radToDeg5(aAddI))} or aDedI ${ffix5(radToDeg5(aDedI))} are too small`;
1565
+ throw `err161: aAddI ${ffix6(radToDeg5(aAddI))} or aDedI ${ffix6(radToDeg5(aDedI))} are too small`;
1269
1566
  }
1270
1567
  if (aAddE < tooSmallAngle || aDedE < tooSmallAngle) {
1271
- throw `err164: aAddE ${ffix5(radToDeg5(aAddE))} or aDedE ${ffix5(radToDeg5(aDedE))} are too small`;
1568
+ throw `err164: aAddE ${ffix6(radToDeg5(aAddE))} or aDedE ${ffix6(radToDeg5(aDedE))} are too small`;
1272
1569
  }
1273
- rGeome.logstr += `Extern: Dmax ${ffix5(2 * RmaxE)}, Dmin ${ffix5(2 * RminE)} mm
1570
+ rGeome.logstr += `Extern: Dmax ${ffix6(2 * RmaxE)}, Dmin ${ffix6(2 * RminE)} mm
1274
1571
  `;
1275
- rGeome.logstr += `Intern: Dmax ${ffix5(2 * RmaxI)}, Dmin ${ffix5(2 * RminI)} mm
1572
+ rGeome.logstr += `Intern: Dmax ${ffix6(2 * RmaxI)}, Dmin ${ffix6(2 * RminI)} mm
1276
1573
  `;
1277
- rGeome.logstr += `aSlack: ${ffix5(radToDeg5(aSlack))} degree
1574
+ rGeome.logstr += `aSlack: ${ffix6(radToDeg5(aSlack))} degree
1278
1575
  `;
1279
- rGeome.logstr += `Tooth: Ht ${param.Ht}, moduli ${ffix5(moduli)}, Hti ${ffix5(Htai + Htdi)}, Hte ${ffix5(Htae + Htde)} mm
1576
+ rGeome.logstr += `Tooth: Ht ${param.Ht}, moduli ${ffix6(moduli)}, Hti ${ffix6(Htai + Htdi)}, Hte ${ffix6(Htae + Htde)} mm
1280
1577
  `;
1281
- rGeome.logstr += `Tooth angle intern: aM ${param.aM}, aM[adden] ${ffix5(radToDeg5(-aAddenI / 2))}, aM[deden] ${ffix5(radToDeg5((aTooth - aAddenI) / 2))} degree
1578
+ rGeome.logstr += `Tooth angle intern: aM ${param.aM}, aM[adden] ${ffix6(radToDeg5(-aAddenI / 2))}, aM[deden] ${ffix6(radToDeg5((aTooth - aAddenI) / 2))} degree
1282
1579
  `;
1283
- rGeome.logstr += `Tooth angle extern: aM ${param.aM}, aM[adden] ${ffix5(radToDeg5(-aAddenE / 2))}, aM[deden] ${ffix5(radToDeg5((aTooth - aAddenE) / 2))} degree
1580
+ rGeome.logstr += `Tooth angle extern: aM ${param.aM}, aM[adden] ${ffix6(radToDeg5(-aAddenE / 2))}, aM[deden] ${ffix6(radToDeg5((aTooth - aAddenE) / 2))} degree
1284
1581
  `;
1285
1582
  const ctrsI = [];
1286
1583
  ctrsI.push(contourCircle3(0, 0, RminI));
@@ -1288,7 +1585,7 @@ function pGeom4(t, param, suffix = "") {
1288
1585
  const p1 = point3(0, 0).translatePolar(ii * adTi, Ri);
1289
1586
  ctrsI.push(contourCircle3(p1.cx, p1.cy, RTi));
1290
1587
  }
1291
- const ctrToothI = contour5(RbI, 0);
1588
+ const ctrToothI = contour6(RbI, 0);
1292
1589
  for (let ii = 0; ii < param.Nt; ii++) {
1293
1590
  const aRef = ii * aTooth;
1294
1591
  ctrToothI.addSegStrokeAP(aRef + aSlopeI, RmaxI).addCornerRounded(param.Rai);
@@ -1351,7 +1648,7 @@ function pGeom4(t, param, suffix = "") {
1351
1648
  {
1352
1649
  outName: nameSubpaxIntern,
1353
1650
  face: `${designName}_faceIntern`,
1354
- extrudeMethod: EExtrude4.eLinearOrtho,
1651
+ extrudeMethod: EExtrude5.eLinearOrtho,
1355
1652
  length: param.Th,
1356
1653
  rotate: [0, 0, 0],
1357
1654
  translate: [0, 0, 0]
@@ -1359,7 +1656,7 @@ function pGeom4(t, param, suffix = "") {
1359
1656
  {
1360
1657
  outName: nameSubpaxExtern,
1361
1658
  face: `${designName}_faceExtern`,
1362
- extrudeMethod: EExtrude4.eLinearOrtho,
1659
+ extrudeMethod: EExtrude5.eLinearOrtho,
1363
1660
  length: param.Th,
1364
1661
  rotate: [0, 0, -aSlack / 2],
1365
1662
  translate: [0, 0, 0]
@@ -1368,7 +1665,7 @@ function pGeom4(t, param, suffix = "") {
1368
1665
  volumes: [
1369
1666
  {
1370
1667
  outName: `pax_${designName}`,
1371
- boolMethod: EBVolume4.eUnion,
1668
+ boolMethod: EBVolume5.eUnion,
1372
1669
  inList: nameList
1373
1670
  }
1374
1671
  ]
@@ -1385,66 +1682,66 @@ function pGeom4(t, param, suffix = "") {
1385
1682
  var plugTorqueDef = {
1386
1683
  pTitle: "plugTorque",
1387
1684
  pDescription: "plugable torque transmission",
1388
- pDef: pDef4,
1389
- pGeom: pGeom4
1685
+ pDef: pDef5,
1686
+ pGeom: pGeom5
1390
1687
  };
1391
1688
 
1392
1689
  // src/spring/springTorqueB.ts
1393
1690
  import {
1394
1691
  withinZeroPi,
1395
1692
  point as point4,
1396
- contour as contour6,
1693
+ contour as contour7,
1397
1694
  contourCircle as contourCircle4,
1398
- figure as figure5,
1695
+ figure as figure6,
1399
1696
  radToDeg as radToDeg6,
1400
- ffix as ffix6,
1401
- pNumber as pNumber5,
1697
+ ffix as ffix7,
1698
+ pNumber as pNumber6,
1402
1699
  pCheckbox as pCheckbox3,
1403
1700
  pDropdown as pDropdown3,
1404
- pSectionSeparator as pSectionSeparator5,
1405
- EExtrude as EExtrude5,
1406
- EBVolume as EBVolume5,
1407
- initGeom as initGeom5
1701
+ pSectionSeparator as pSectionSeparator6,
1702
+ EExtrude as EExtrude6,
1703
+ EBVolume as EBVolume6,
1704
+ initGeom as initGeom6
1408
1705
  } from "geometrix";
1409
- var pDef5 = {
1706
+ var pDef6 = {
1410
1707
  partName: "springTorqueB",
1411
1708
  params: [
1412
1709
  //pNumber(name, unit, init, min, max, step)
1413
- pNumber5("De", "mm", 80, 1, 1e3, 1),
1414
- pNumber5("Ne", "hole", 16, 0, 400, 1),
1415
- pNumber5("DTe", "mm", 2, 0.1, 50, 0.1),
1416
- pNumber5("Ee", "mm", 1, 0.1, 50, 0.1),
1710
+ pNumber6("De", "mm", 80, 1, 1e3, 1),
1711
+ pNumber6("Ne", "hole", 16, 0, 400, 1),
1712
+ pNumber6("DTe", "mm", 2, 0.1, 50, 0.1),
1713
+ pNumber6("Ee", "mm", 1, 0.1, 50, 0.1),
1417
1714
  pCheckbox3("Teeth", true),
1418
- pNumber5("Th", "mm", 3, 0.1, 100, 0.1),
1419
- pSectionSeparator5("Internal ring"),
1420
- pNumber5("Di", "mm", 30, 1, 1e3, 1),
1421
- pNumber5("Ni", "hole", 8, 0, 400, 1),
1422
- pNumber5("DTi", "mm", 2, 0.1, 50, 0.1),
1423
- pNumber5("Ei", "mm", 1, 0.1, 50, 0.1),
1424
- pSectionSeparator5("Spring"),
1425
- pNumber5("Ns", "spring", 6, 4, 60, 1),
1426
- pNumber5("aEs", "%", 10, 1, 90, 1),
1427
- pNumber5("Esi", "%", 10, 1, 90, 1),
1428
- pNumber5("Ese", "%", 10, 1, 90, 1),
1429
- pNumber5("Nk", "zigzag", 3, 1, 100, 1),
1430
- pNumber5("Wk", "mm", 1, 0.1, 20, 0.1),
1431
- pNumber5("Wc", "mm", 1, 0.1, 20, 0.1),
1432
- pNumber5("Rrsi", "mm", 1, 0, 20, 0.1),
1433
- pNumber5("Rrse", "mm", 1, 0, 20, 0.1),
1434
- pSectionSeparator5("Tooth Profile"),
1435
- pNumber5("Nt", "teeth", 8, 1, 1e3, 1),
1436
- pNumber5("Dt", "mm", 20, 0.1, 1e3, 0.1),
1437
- pNumber5("Ht", "mm", 2, 0.1, 100, 0.1),
1438
- pNumber5("ate", "%", 52, 1, 99, 1),
1439
- pNumber5("ah", "%", 100, 1, 400, 1),
1440
- pNumber5("dh", "%", 100, 1, 400, 1),
1441
- pNumber5("aeh", "%", 10, 0, 100, 1),
1442
- pNumber5("aM", "degree", 0, -30, 30, 0.1),
1443
- pSectionSeparator5("Tooth profile details"),
1715
+ pNumber6("Th", "mm", 3, 0.1, 100, 0.1),
1716
+ pSectionSeparator6("Internal ring"),
1717
+ pNumber6("Di", "mm", 30, 1, 1e3, 1),
1718
+ pNumber6("Ni", "hole", 8, 0, 400, 1),
1719
+ pNumber6("DTi", "mm", 2, 0.1, 50, 0.1),
1720
+ pNumber6("Ei", "mm", 1, 0.1, 50, 0.1),
1721
+ pSectionSeparator6("Spring"),
1722
+ pNumber6("Ns", "spring", 6, 4, 60, 1),
1723
+ pNumber6("aEs", "%", 10, 1, 90, 1),
1724
+ pNumber6("Esi", "%", 10, 1, 90, 1),
1725
+ pNumber6("Ese", "%", 10, 1, 90, 1),
1726
+ pNumber6("Nk", "zigzag", 3, 1, 100, 1),
1727
+ pNumber6("Wk", "mm", 1, 0.1, 20, 0.1),
1728
+ pNumber6("Wc", "mm", 1, 0.1, 20, 0.1),
1729
+ pNumber6("Rrsi", "mm", 1, 0, 20, 0.1),
1730
+ pNumber6("Rrse", "mm", 1, 0, 20, 0.1),
1731
+ pSectionSeparator6("Tooth Profile"),
1732
+ pNumber6("Nt", "teeth", 8, 1, 1e3, 1),
1733
+ pNumber6("Dt", "mm", 20, 0.1, 1e3, 0.1),
1734
+ pNumber6("Ht", "mm", 2, 0.1, 100, 0.1),
1735
+ pNumber6("ate", "%", 52, 1, 99, 1),
1736
+ pNumber6("ah", "%", 100, 1, 400, 1),
1737
+ pNumber6("dh", "%", 100, 1, 400, 1),
1738
+ pNumber6("aeh", "%", 10, 0, 100, 1),
1739
+ pNumber6("aM", "degree", 0, -30, 30, 0.1),
1740
+ pSectionSeparator6("Tooth profile details"),
1444
1741
  pDropdown3("SnAae", ["stroke", "arc"]),
1445
1742
  pDropdown3("SnAde", ["stroke", "arc"]),
1446
- pNumber5("Rae", "mm", 1, 0, 50, 0.1),
1447
- pNumber5("Rde", "mm", 1, 0, 50, 0.1)
1743
+ pNumber6("Rae", "mm", 1, 0, 50, 0.1),
1744
+ pNumber6("Rde", "mm", 1, 0, 50, 0.1)
1448
1745
  ],
1449
1746
  paramSvg: {
1450
1747
  De: "springTorqueB_profile.svg",
@@ -1516,9 +1813,9 @@ function calcAzag(cx2, cx1, r2, r1) {
1516
1813
  }
1517
1814
  return [ra22, ra11];
1518
1815
  }
1519
- function pGeom5(t, param, suffix = "") {
1520
- const rGeome = initGeom5(pDef5.partName + suffix);
1521
- const figProfile = figure5();
1816
+ function pGeom6(t, param, suffix = "") {
1817
+ const rGeome = initGeom6(pDef6.partName + suffix);
1818
+ const figProfile = figure6();
1522
1819
  rGeome.logstr += `${rGeome.partName} simTime: ${t}
1523
1820
  `;
1524
1821
  try {
@@ -1562,12 +1859,12 @@ function pGeom5(t, param, suffix = "") {
1562
1859
  const aHMinI = 2 * Math.asin((RTi + 0.5 * param.Ei) / Ri);
1563
1860
  const aHI = param.Ni > 0 ? 2 * Math.PI / param.Ni : 3.14;
1564
1861
  if (aHI < aHMinI) {
1565
- throw `err126: aHI ${ffix6(radToDeg6(aHI))} is too small compare to aHMinI ${ffix6(radToDeg6(aHMinI))} degree`;
1862
+ throw `err126: aHI ${ffix7(radToDeg6(aHI))} is too small compare to aHMinI ${ffix7(radToDeg6(aHMinI))} degree`;
1566
1863
  }
1567
1864
  const aHMinE = 2 * Math.asin((RTe + 0.5 * param.Ee) / Re);
1568
1865
  const aHE = param.Ne > 0 ? 2 * Math.PI / param.Ne : 3.14;
1569
1866
  if (aHE < aHMinE) {
1570
- throw `err131: aHE ${ffix6(radToDeg6(aHE))} is too small compare to aHMinE ${ffix6(radToDeg6(aHMinE))} degree`;
1867
+ throw `err131: aHE ${ffix7(radToDeg6(aHE))} is too small compare to aHMinE ${ffix7(radToDeg6(aHMinE))} degree`;
1571
1868
  }
1572
1869
  const pts1 = [];
1573
1870
  const Rk1 = Rsi + Esi + dRLs - Rk;
@@ -1597,11 +1894,11 @@ function pGeom5(t, param, suffix = "") {
1597
1894
  const pt4 = point4(0, 0).translatePolar(-a14, Rsi);
1598
1895
  const Rks = Rk - Wk2;
1599
1896
  const Rkl = Rk + Wk2;
1600
- rGeome.logstr += `Dmax ${ffix6(2 * Rmax)}, Dmin1 ${ffix6(2 * Rmin1)} mm
1897
+ rGeome.logstr += `Dmax ${ffix7(2 * Rmax)}, Dmin1 ${ffix7(2 * Rmin1)} mm
1601
1898
  `;
1602
- rGeome.logstr += `Spring area: aSpring ${ffix6(radToDeg6(aSpring))} degree, dRLs ${ffix6(dRLs)}, HLs ${ffix6(HLs)} mm
1899
+ rGeome.logstr += `Spring area: aSpring ${ffix7(radToDeg6(aSpring))} degree, dRLs ${ffix7(dRLs)}, HLs ${ffix7(HLs)} mm
1603
1900
  `;
1604
- rGeome.logstr += `Spring zigzag: Ek ${ffix6(Ek)}, Rk ${ffix6(Rk)} mm
1901
+ rGeome.logstr += `Spring zigzag: Ek ${ffix7(Ek)}, Rk ${ffix7(Rk)} mm
1605
1902
  `;
1606
1903
  const ctrExt = contourCircle4(0, 0, Rmax);
1607
1904
  const ctrsH = [];
@@ -1620,7 +1917,7 @@ function pGeom5(t, param, suffix = "") {
1620
1917
  const p1 = point4(0, 0).translatePolar(ii * aHE, Re);
1621
1918
  ctrsH.push(contourCircle4(p1.cx, p1.cy, RTe));
1622
1919
  }
1623
- const ctrSpringEnv = contour6(Rsi + Esi, 0).addSegStrokeAP(0, Rse - Ese).addPointAP(aSpring / 2, Rse - Ese).addPointAP(aSpring, Rse - Ese).addSegArc2().addSegStrokeAP(aSpring, Rsi + Esi).addPointAP(aSpring / 2, Rsi + Esi).addPointAP(0, Rsi + Esi).addSegArc2();
1920
+ const ctrSpringEnv = contour7(Rsi + Esi, 0).addSegStrokeAP(0, Rse - Ese).addPointAP(aSpring / 2, Rse - Ese).addPointAP(aSpring, Rse - Ese).addSegArc2().addSegStrokeAP(aSpring, Rsi + Esi).addPointAP(aSpring / 2, Rsi + Esi).addPointAP(0, Rsi + Esi).addSegArc2();
1624
1921
  figProfile.addSecond(ctrSpringEnv);
1625
1922
  figProfile.addSecond(ctrSpringEnv.rotate(0, 0, aSpringStep));
1626
1923
  figProfile.addSecond(ctrSpringEnv.rotate(0, 0, -aSpringStep));
@@ -1628,7 +1925,7 @@ function pGeom5(t, param, suffix = "") {
1628
1925
  figProfile.addSecond(contourCircle4(pts1[ii].cx, pts1[ii].cy, Rk));
1629
1926
  figProfile.addSecond(contourCircle4(pts2[ii].cx, pts2[ii].cy, Rk));
1630
1927
  }
1631
- const ctrPartial1 = contour6(pt1.cx, pt1.cy);
1928
+ const ctrPartial1 = contour7(pt1.cx, pt1.cy);
1632
1929
  for (let ii = 0; ii < param.Nk; ii++) {
1633
1930
  let a11 = -Math.PI / 2;
1634
1931
  const [a12, a21] = calcAzig(pts1[ii].cx, pts2[ii].cx, Rks, Rkl);
@@ -1662,7 +1959,7 @@ function pGeom5(t, param, suffix = "") {
1662
1959
  ctrPartial1.addPointA(pt2b.cx, pt2b.cy).addPointA(pt2c.cx, pt2c.cy).addSegArc2().addSegStrokeA(pt2.cx, pt2.cy);
1663
1960
  const [, firsta22] = calcAzig(pts1[param.Nk - 1].cx, pts2[param.Nk - 1].cx, Rkl, Rks);
1664
1961
  const firstp22 = pts2[param.Nk - 1].translatePolar(firsta22, Rks);
1665
- const ctrPartial2 = contour6(pt3.cx, pt3.cy).addSegStrokeA(pt3c.cx, pt3c.cy).addPointA(pt3b.cx, pt3b.cy).addPointA(firstp22.cx, firstp22.cy).addSegArc2();
1962
+ const ctrPartial2 = contour7(pt3.cx, pt3.cy).addSegStrokeA(pt3c.cx, pt3c.cy).addPointA(pt3b.cx, pt3b.cy).addPointA(firstp22.cx, firstp22.cy).addSegArc2();
1666
1963
  for (let ii = param.Nk - 1; ii >= 0; ii--) {
1667
1964
  let a21 = Math.PI / 2;
1668
1965
  let a12 = -Math.PI / 2;
@@ -1687,7 +1984,7 @@ function pGeom5(t, param, suffix = "") {
1687
1984
  ctrPartial2.addSegStrokeA(p11.cx, p11.cy).addPointA(p1b.cx, p1b.cy).addPointA(p12.cx, p12.cy).addSegArc2();
1688
1985
  }
1689
1986
  ctrPartial2.addSegStrokeA(pt4.cx, pt4.cy);
1690
- const ctrSpringHollow = contour6(pt1.cx, pt1.cy).addCornerRounded(param.Rrsi).addPartial(ctrPartial1).addCornerRounded(param.Rrse).addPointAP(aSpring + aSpringStep / 2, Rse).addPointAP(aSpring + aSpringStep - a23, Rse).addSegArc2().addCornerRounded(param.Rrse).addPartial(ctrPartial2.rotate(0, 0, aSpringStep)).addCornerRounded(param.Rrsi).addPointAP(aSpringStep / 2, Rsi).addPointAP(a14, Rsi).addSegArc2();
1987
+ const ctrSpringHollow = contour7(pt1.cx, pt1.cy).addCornerRounded(param.Rrsi).addPartial(ctrPartial1).addCornerRounded(param.Rrse).addPointAP(aSpring + aSpringStep / 2, Rse).addPointAP(aSpring + aSpringStep - a23, Rse).addSegArc2().addCornerRounded(param.Rrse).addPartial(ctrPartial2.rotate(0, 0, aSpringStep)).addCornerRounded(param.Rrsi).addPointAP(aSpringStep / 2, Rsi).addPointAP(a14, Rsi).addSegArc2();
1691
1988
  for (let ii = 0; ii < param.Ns; ii++) {
1692
1989
  ctrsH.push(ctrSpringHollow.rotate(0, 0, ii * aSpringStep));
1693
1990
  }
@@ -1701,7 +1998,7 @@ function pGeom5(t, param, suffix = "") {
1701
1998
  {
1702
1999
  outName: `subpax_${designName}_profile`,
1703
2000
  face: `${designName}_faceProfile`,
1704
- extrudeMethod: EExtrude5.eLinearOrtho,
2001
+ extrudeMethod: EExtrude6.eLinearOrtho,
1705
2002
  length: param.Th,
1706
2003
  rotate: [0, 0, 0],
1707
2004
  translate: [0, 0, 0]
@@ -1710,7 +2007,7 @@ function pGeom5(t, param, suffix = "") {
1710
2007
  volumes: [
1711
2008
  {
1712
2009
  outName: `pax_${designName}`,
1713
- boolMethod: EBVolume5.eIdentity,
2010
+ boolMethod: EBVolume6.eIdentity,
1714
2011
  inList: [`subpax_${designName}_profile`]
1715
2012
  }
1716
2013
  ]
@@ -1727,66 +2024,66 @@ function pGeom5(t, param, suffix = "") {
1727
2024
  var springTorqueBDef = {
1728
2025
  pTitle: "springTorqueB",
1729
2026
  pDescription: "spring disc for smooth torque transmission",
1730
- pDef: pDef5,
1731
- pGeom: pGeom5
2027
+ pDef: pDef6,
2028
+ pGeom: pGeom6
1732
2029
  };
1733
2030
 
1734
2031
  // src/spring/springTorqueC.ts
1735
2032
  import {
1736
2033
  point as point5,
1737
- contour as contour7,
2034
+ contour as contour8,
1738
2035
  contourCircle as contourCircle5,
1739
- figure as figure6,
2036
+ figure as figure7,
1740
2037
  radToDeg as radToDeg7,
1741
- ffix as ffix7,
1742
- pNumber as pNumber6,
2038
+ ffix as ffix8,
2039
+ pNumber as pNumber7,
1743
2040
  pCheckbox as pCheckbox4,
1744
2041
  pDropdown as pDropdown4,
1745
- pSectionSeparator as pSectionSeparator6,
1746
- EExtrude as EExtrude6,
1747
- EBVolume as EBVolume6,
1748
- initGeom as initGeom6
2042
+ pSectionSeparator as pSectionSeparator7,
2043
+ EExtrude as EExtrude7,
2044
+ EBVolume as EBVolume7,
2045
+ initGeom as initGeom7
1749
2046
  } from "geometrix";
1750
- var pDef6 = {
2047
+ var pDef7 = {
1751
2048
  partName: "springTorqueC",
1752
2049
  params: [
1753
2050
  //pNumber(name, unit, init, min, max, step)
1754
- pNumber6("De", "mm", 80, 1, 1e3, 1),
1755
- pNumber6("Ne", "hole", 16, 0, 400, 1),
1756
- pNumber6("DTe", "mm", 2, 0.1, 50, 0.1),
1757
- pNumber6("Ee", "mm", 1, 0.1, 50, 0.1),
2051
+ pNumber7("De", "mm", 80, 1, 1e3, 1),
2052
+ pNumber7("Ne", "hole", 16, 0, 400, 1),
2053
+ pNumber7("DTe", "mm", 2, 0.1, 50, 0.1),
2054
+ pNumber7("Ee", "mm", 1, 0.1, 50, 0.1),
1758
2055
  pCheckbox4("Teeth", true),
1759
- pNumber6("Th", "mm", 3, 0.1, 100, 0.1),
1760
- pSectionSeparator6("Internal ring"),
1761
- pNumber6("Di", "mm", 30, 1, 1e3, 1),
1762
- pNumber6("Ni", "hole", 8, 0, 400, 1),
1763
- pNumber6("DTi", "mm", 2, 0.1, 50, 0.1),
1764
- pNumber6("Ei", "mm", 1, 0.1, 50, 0.1),
1765
- pSectionSeparator6("Spring"),
1766
- pNumber6("Ns", "spring", 6, 1, 60, 1),
2056
+ pNumber7("Th", "mm", 3, 0.1, 100, 0.1),
2057
+ pSectionSeparator7("Internal ring"),
2058
+ pNumber7("Di", "mm", 30, 1, 1e3, 1),
2059
+ pNumber7("Ni", "hole", 8, 0, 400, 1),
2060
+ pNumber7("DTi", "mm", 2, 0.1, 50, 0.1),
2061
+ pNumber7("Ei", "mm", 1, 0.1, 50, 0.1),
2062
+ pSectionSeparator7("Spring"),
2063
+ pNumber7("Ns", "spring", 6, 1, 60, 1),
1767
2064
  pDropdown4("zig", ["alt", "one", "two"]),
1768
2065
  pDropdown4("zag", ["arc", "stroke"]),
1769
- pNumber6("aEs", "%", 20, 1, 99, 1),
1770
- pNumber6("Esi", "%", 10, 0, 90, 1),
1771
- pNumber6("Ese", "%", 10, 0, 90, 1),
1772
- pNumber6("Nk", "zigzag", 4, 2, 100, 1),
1773
- pNumber6("Wk", "mm", 1, 0.1, 20, 0.1),
1774
- pNumber6("Rrsi", "mm", 0.1, 0, 20, 0.1),
1775
- pNumber6("Rrse", "mm", 1, 0, 20, 0.1),
1776
- pSectionSeparator6("Tooth Profile"),
1777
- pNumber6("Nt", "teeth", 8, 1, 1e3, 1),
1778
- pNumber6("Dt", "mm", 20, 0.1, 1e3, 0.1),
1779
- pNumber6("Ht", "mm", 2, 0.1, 100, 0.1),
1780
- pNumber6("ate", "%", 52, 1, 99, 1),
1781
- pNumber6("ah", "%", 100, 1, 400, 1),
1782
- pNumber6("dh", "%", 100, 1, 400, 1),
1783
- pNumber6("aeh", "%", 10, 0, 100, 1),
1784
- pNumber6("aM", "degree", 0, -30, 30, 0.1),
1785
- pSectionSeparator6("Tooth profile details"),
2066
+ pNumber7("aEs", "%", 20, 1, 99, 1),
2067
+ pNumber7("Esi", "%", 10, 0, 90, 1),
2068
+ pNumber7("Ese", "%", 10, 0, 90, 1),
2069
+ pNumber7("Nk", "zigzag", 4, 2, 100, 1),
2070
+ pNumber7("Wk", "mm", 1, 0.1, 20, 0.1),
2071
+ pNumber7("Rrsi", "mm", 0.1, 0, 20, 0.1),
2072
+ pNumber7("Rrse", "mm", 1, 0, 20, 0.1),
2073
+ pSectionSeparator7("Tooth Profile"),
2074
+ pNumber7("Nt", "teeth", 8, 1, 1e3, 1),
2075
+ pNumber7("Dt", "mm", 20, 0.1, 1e3, 0.1),
2076
+ pNumber7("Ht", "mm", 2, 0.1, 100, 0.1),
2077
+ pNumber7("ate", "%", 52, 1, 99, 1),
2078
+ pNumber7("ah", "%", 100, 1, 400, 1),
2079
+ pNumber7("dh", "%", 100, 1, 400, 1),
2080
+ pNumber7("aeh", "%", 10, 0, 100, 1),
2081
+ pNumber7("aM", "degree", 0, -30, 30, 0.1),
2082
+ pSectionSeparator7("Tooth profile details"),
1786
2083
  pDropdown4("SnAae", ["stroke", "arc"]),
1787
2084
  pDropdown4("SnAde", ["stroke", "arc"]),
1788
- pNumber6("Rae", "mm", 1, 0, 50, 0.1),
1789
- pNumber6("Rde", "mm", 1, 0, 50, 0.1)
2085
+ pNumber7("Rae", "mm", 1, 0, 50, 0.1),
2086
+ pNumber7("Rde", "mm", 1, 0, 50, 0.1)
1790
2087
  ],
1791
2088
  paramSvg: {
1792
2089
  De: "springTorqueC_profile.svg",
@@ -1839,9 +2136,9 @@ function calcZagP2(pA, pE, lAB, lDE, iSign) {
1839
2136
  const rPt = pA.translatePolar(aAE + iSign * aCAB, lAB);
1840
2137
  return rPt;
1841
2138
  }
1842
- function pGeom6(t, param, suffix = "") {
1843
- const rGeome = initGeom6(pDef6.partName + suffix);
1844
- const figProfile = figure6();
2139
+ function pGeom7(t, param, suffix = "") {
2140
+ const rGeome = initGeom7(pDef7.partName + suffix);
2141
+ const figProfile = figure7();
1845
2142
  rGeome.logstr += `${rGeome.partName} simTime: ${t}
1846
2143
  `;
1847
2144
  try {
@@ -1886,7 +2183,7 @@ function pGeom6(t, param, suffix = "") {
1886
2183
  const aStart1 = iParity === 0 ? -Math.PI / 2 : Math.PI / 2 + aSpring;
1887
2184
  const siRk = iParity === 0 ? Rks : Rkl;
1888
2185
  const startPt1 = pts[0].translatePolar(aStart1, siRk);
1889
- const rCtr = contour7(startPt1.cx, startPt1.cy);
2186
+ const rCtr = contour8(startPt1.cx, startPt1.cy);
1890
2187
  for (let ii = 0; ii < param.Nk; ii++) {
1891
2188
  const iiParity3 = (ii + iParity) % 2;
1892
2189
  const apt = Math.atan2(pts[ii].cy, pts[ii].cx);
@@ -1922,7 +2219,7 @@ function pGeom6(t, param, suffix = "") {
1922
2219
  } else {
1923
2220
  const p3 = pts[ii].translatePolar(da3, iRk);
1924
2221
  const p4 = calcZagP2(pts[ii], pts[ii + 1], iRk, iRk2, -aSign);
1925
- if (ii > 0) {
2222
+ if (ii > 0 && aSpring > aArcMin) {
1926
2223
  rCtr.addPointA(p3.cx, p3.cy).addPointA(p4.cx, p4.cy).addSegArc2();
1927
2224
  } else {
1928
2225
  rCtr.addPointA(p4.cx, p4.cy).addSegArc(iRk, false, iiParity3 === 0);
@@ -1936,7 +2233,7 @@ function pGeom6(t, param, suffix = "") {
1936
2233
  const aStart1 = eParity === 0 ? -Math.PI / 2 : Math.PI / 2 + aSpring;
1937
2234
  const siRk = eParity === 0 ? Rkl : Rks;
1938
2235
  const startPt1 = pts[param.Nk - 1].translatePolar(aStart1, siRk);
1939
- const rCtr = contour7(startPt1.cx, startPt1.cy);
2236
+ const rCtr = contour8(startPt1.cx, startPt1.cy);
1940
2237
  for (let ii = param.Nk - 1; ii >= 0; ii--) {
1941
2238
  const iiParity3 = (ii + iParity) % 2;
1942
2239
  const apt = Math.atan2(pts[ii].cy, pts[ii].cx);
@@ -1972,7 +2269,7 @@ function pGeom6(t, param, suffix = "") {
1972
2269
  } else {
1973
2270
  const p3 = pts[ii].translatePolar(da3, iRk);
1974
2271
  const p4 = calcZagP2(pts[ii], pts[ii - 1], iRk, iRk2, -aSign);
1975
- if (ii < param.Nk - 1) {
2272
+ if (ii < param.Nk - 1 && aSpring > aArcMin) {
1976
2273
  rCtr.addPointA(p3.cx, p3.cy).addPointA(p4.cx, p4.cy).addSegArc2();
1977
2274
  } else {
1978
2275
  rCtr.addPointA(p4.cx, p4.cy).addSegArc(iRk, false, iiParity3 === 1);
@@ -1985,7 +2282,7 @@ function pGeom6(t, param, suffix = "") {
1985
2282
  const pp1 = ip1 === 0 ? ppp0 : ppp1;
1986
2283
  const pp2 = ip2 === 0 ? ppp0 : ppp1;
1987
2284
  const [ppib, ppeb] = pppb2(ip1, ip2);
1988
- const ctr = contour7(pp1[0].cx, pp1[0].cy).addCornerRounded(param.Rrsi).addSegStrokeA(pp1[1].cx, pp1[1].cy).addPartial(ctrPartial12(ip1)).addSegStrokeA(pp1[3].cx, pp1[3].cy).addCornerRounded(param.Rrse).addPointA(ppeb.cx, ppeb.cy).addPointA(pp2[4].cx, pp2[4].cy).addSegArc2().addCornerRounded(param.Rrse).addSegStrokeA(pp2[5].cx, pp2[5].cy).addPartial(ctrPartial22(ip2).rotate(0, 0, aSpringStep)).addSegStrokeA(pp2[7].cx, pp2[7].cy).addCornerRounded(param.Rrsi).addPointA(ppib.cx, ppib.cy).addPointA(pp1[0].cx, pp1[0].cy).addSegArc2();
2285
+ const ctr = contour8(pp1[0].cx, pp1[0].cy).addCornerRounded(param.Rrsi).addSegStrokeA(pp1[1].cx, pp1[1].cy).addPartial(ctrPartial12(ip1)).addSegStrokeA(pp1[3].cx, pp1[3].cy).addCornerRounded(param.Rrse).addPointA(ppeb.cx, ppeb.cy).addPointA(pp2[4].cx, pp2[4].cy).addSegArc2().addCornerRounded(param.Rrse).addSegStrokeA(pp2[5].cx, pp2[5].cy).addPartial(ctrPartial22(ip2).rotate(0, 0, aSpringStep)).addSegStrokeA(pp2[7].cx, pp2[7].cy).addCornerRounded(param.Rrsi).addPointA(ppib.cx, ppib.cy).addPointA(pp1[0].cx, pp1[0].cy).addSegArc2();
1989
2286
  return ctr.rotate(0, 0, ii * aSpringStep);
1990
2287
  };
1991
2288
  var prePoints = prePoints2, pppI = pppI2, externParity = externParity2, pppE = pppE2, iiParity = iiParity2, pppb = pppb2, ctrPartial1 = ctrPartial12, ctrPartial2 = ctrPartial22, ctrSpringHollow = ctrSpringHollow2;
@@ -2024,12 +2321,12 @@ function pGeom6(t, param, suffix = "") {
2024
2321
  const aHMinI = 2 * Math.asin((RTi + 0.5 * param.Ei) / Ri);
2025
2322
  const aHI = param.Ni > 0 ? 2 * Math.PI / param.Ni : 3.14;
2026
2323
  if (aHI < aHMinI) {
2027
- throw `err126: aHI ${ffix7(radToDeg7(aHI))} is too small compare to aHMinI ${ffix7(radToDeg7(aHMinI))} degree`;
2324
+ throw `err126: aHI ${ffix8(radToDeg7(aHI))} is too small compare to aHMinI ${ffix8(radToDeg7(aHMinI))} degree`;
2028
2325
  }
2029
2326
  const aHMinE = 2 * Math.asin((RTe + 0.5 * param.Ee) / Re);
2030
2327
  const aHE = param.Ne > 0 ? 2 * Math.PI / param.Ne : 3.14;
2031
2328
  if (aHE < aHMinE) {
2032
- throw `err131: aHE ${ffix7(radToDeg7(aHE))} is too small compare to aHMinE ${ffix7(radToDeg7(aHMinE))} degree`;
2329
+ throw `err131: aHE ${ffix8(radToDeg7(aHE))} is too small compare to aHMinE ${ffix8(radToDeg7(aHMinE))} degree`;
2033
2330
  }
2034
2331
  const pts0 = [];
2035
2332
  const pts1 = [];
@@ -2045,7 +2342,7 @@ function pGeom6(t, param, suffix = "") {
2045
2342
  const kap2 = ii % 2 === k2Parity2 ? ka : aSpring - ka;
2046
2343
  pts1.push(point5(kl * Math.cos(kap2), kl * Math.sin(kap2)));
2047
2344
  }
2048
- const aArcMin = 2 * Math.asin(Rk / (Rsi + Esi));
2345
+ const aArcMin = Math.asin(Rk / (Rsi + Esi));
2049
2346
  let zagArc = param.zag === 0;
2050
2347
  const Wk2 = param.Wk / 2;
2051
2348
  const a18 = Math.asin(Wk2 / Rsi);
@@ -2073,15 +2370,15 @@ function pGeom6(t, param, suffix = "") {
2073
2370
  ppp1.push(pppI2(-a18, 1, Rsi).rotateOrig(aSpringStep));
2074
2371
  const Rks = Rk - Wk2;
2075
2372
  const Rkl = Rk + Wk2;
2076
- rGeome.logstr += `Dmax ${ffix7(2 * Rmax)}, Dmin1 ${ffix7(2 * Rmin1)} mm
2373
+ rGeome.logstr += `Dmax ${ffix8(2 * Rmax)}, Dmin1 ${ffix8(2 * Rmin1)} mm
2077
2374
  `;
2078
- rGeome.logstr += `Spring area: aSpring ${ffix7(radToDeg7(aSpring))} degree, dRLs ${ffix7(dRLs)} mm
2375
+ rGeome.logstr += `Spring area: aSpring ${ffix8(radToDeg7(aSpring))} degree, dRLs ${ffix8(dRLs)} mm
2079
2376
  `;
2080
- rGeome.logstr += `Spring zigzag: Ek ${ffix7(Ek)}, Rk ${ffix7(Rk)} mm
2377
+ rGeome.logstr += `Spring zigzag: Ek ${ffix8(Ek)}, Rk ${ffix8(Rk)} mm
2081
2378
  `;
2082
- if (aSpring < aArcMin) {
2379
+ if (aSpring < 2 * aArcMin) {
2083
2380
  zagArc = false;
2084
- rGeome.logstr += `Spring zigzag forced to stroke because of aArcMin ${ffix7(radToDeg7(aArcMin))} degree
2381
+ rGeome.logstr += `Spring zigzag forced to stroke because of aArcMin ${ffix8(radToDeg7(aArcMin))} degree
2085
2382
  `;
2086
2383
  }
2087
2384
  const ctrExt = contourCircle5(0, 0, Rmax);
@@ -2101,7 +2398,7 @@ function pGeom6(t, param, suffix = "") {
2101
2398
  const p1 = point5(0, 0).translatePolar(ii * aHE, Re);
2102
2399
  ctrsH.push(contourCircle5(p1.cx, p1.cy, RTe));
2103
2400
  }
2104
- const ctrSpringEnv = contour7(Rsi + Esi, 0).addSegStrokeAP(0, Rse - Ese).addPointAP(aSpring / 2, Rse - Ese).addPointAP(aSpring, Rse - Ese).addSegArc2().addSegStrokeAP(aSpring, Rsi + Esi).addPointAP(aSpring / 2, Rsi + Esi).addPointAP(0, Rsi + Esi).addSegArc2();
2401
+ const ctrSpringEnv = contour8(Rsi + Esi, 0).addSegStrokeAP(0, Rse - Ese).addPointAP(aSpring / 2, Rse - Ese).addPointAP(aSpring, Rse - Ese).addSegArc2().addSegStrokeAP(aSpring, Rsi + Esi).addPointAP(aSpring / 2, Rsi + Esi).addPointAP(0, Rsi + Esi).addSegArc2();
2105
2402
  figProfile.addSecond(ctrSpringEnv);
2106
2403
  figProfile.addSecond(ctrSpringEnv.rotate(0, 0, aSpringStep));
2107
2404
  figProfile.addSecond(ctrSpringEnv.rotate(0, 0, -aSpringStep));
@@ -2126,7 +2423,7 @@ function pGeom6(t, param, suffix = "") {
2126
2423
  {
2127
2424
  outName: `subpax_${designName}_profile`,
2128
2425
  face: `${designName}_faceProfile`,
2129
- extrudeMethod: EExtrude6.eLinearOrtho,
2426
+ extrudeMethod: EExtrude7.eLinearOrtho,
2130
2427
  length: param.Th,
2131
2428
  rotate: [0, 0, 0],
2132
2429
  translate: [0, 0, 0]
@@ -2135,7 +2432,7 @@ function pGeom6(t, param, suffix = "") {
2135
2432
  volumes: [
2136
2433
  {
2137
2434
  outName: `pax_${designName}`,
2138
- boolMethod: EBVolume6.eIdentity,
2435
+ boolMethod: EBVolume7.eIdentity,
2139
2436
  inList: [`subpax_${designName}_profile`]
2140
2437
  }
2141
2438
  ]
@@ -2152,15 +2449,1176 @@ function pGeom6(t, param, suffix = "") {
2152
2449
  var springTorqueCDef = {
2153
2450
  pTitle: "springTorqueC",
2154
2451
  pDescription: "spring disc for smooth torque transmission",
2155
- pDef: pDef6,
2156
- pGeom: pGeom6
2452
+ pDef: pDef7,
2453
+ pGeom: pGeom7
2454
+ };
2455
+
2456
+ // src/spring/springWorm.ts
2457
+ import {
2458
+ contour as contour9,
2459
+ contourCircle as contourCircle6,
2460
+ ctrRectangle as ctrRectangle4,
2461
+ figure as figure8,
2462
+ ffix as ffix9,
2463
+ pNumber as pNumber8,
2464
+ pDropdown as pDropdown5,
2465
+ pSectionSeparator as pSectionSeparator8,
2466
+ EExtrude as EExtrude8,
2467
+ EBVolume as EBVolume8,
2468
+ initGeom as initGeom8
2469
+ } from "geometrix";
2470
+ function makeCtrGroove(x0, y0, xl, yl, roundTop) {
2471
+ const xl2 = xl / 2;
2472
+ const yl2 = yl - xl2;
2473
+ if (roundTop) {
2474
+ const rCtr = contour9(x0, y0).addSegStrokeR(xl, 0).addSegStrokeR(0, yl2).addPointR(-xl2, xl2).addPointR(-xl, 0).addSegArc2().closeSegStroke();
2475
+ return rCtr;
2476
+ } else {
2477
+ const rCtr = contour9(x0, y0 + xl2).addPointR(xl2, -xl2).addPointR(xl, 0).addSegArc2().addSegStrokeR(0, yl2).addSegStrokeR(-xl, 0).closeSegStroke();
2478
+ return rCtr;
2479
+ }
2480
+ }
2481
+ var pDef8 = {
2482
+ partName: "springWorm",
2483
+ params: [
2484
+ //pNumber(name, unit, init, min, max, step)
2485
+ pNumber8("D1", "mm", 30, 2, 200, 1),
2486
+ pNumber8("E1", "mm", 2, 0.1, 50, 0.1),
2487
+ pNumber8("N1", "groove", 6, 2, 200, 1),
2488
+ pNumber8("W2", "mm", 2, 0.1, 50, 0.1),
2489
+ pNumber8("W3", "mm", 1, 0.1, 50, 0.1),
2490
+ pNumber8("S1", "mm", 1, 0.1, 50, 0.1),
2491
+ pSectionSeparator8("Extremity caps"),
2492
+ pDropdown5("leftCaps", ["ext", "int"]),
2493
+ pDropdown5("rightCaps", ["ext", "int"]),
2494
+ pNumber8("W1", "mm", 2, 0.1, 50, 0.1),
2495
+ pNumber8("W1b", "mm", 1, 0.1, 50, 0.1),
2496
+ pSectionSeparator8("Tooth Profile"),
2497
+ pNumber8("Nt", "teeth", 8, 1, 1e3, 1),
2498
+ pNumber8("Dt", "mm", 20, 0.1, 1e3, 0.1),
2499
+ pNumber8("Ht", "mm", 2, 0.1, 100, 0.1),
2500
+ pNumber8("ate", "%", 52, 1, 99, 1),
2501
+ pNumber8("ah", "%", 100, 1, 400, 1),
2502
+ pNumber8("dh", "%", 100, 1, 400, 1),
2503
+ pNumber8("aeh", "%", 10, 0, 100, 1),
2504
+ pNumber8("aM", "degree", 0, -30, 30, 0.1),
2505
+ pSectionSeparator8("Tooth profile details"),
2506
+ pDropdown5("SnAae", ["stroke", "arc"]),
2507
+ pDropdown5("SnAde", ["stroke", "arc"]),
2508
+ pNumber8("Rae", "mm", 1, 0, 50, 0.1),
2509
+ pNumber8("Rde", "mm", 1, 0, 50, 0.1)
2510
+ ],
2511
+ paramSvg: {
2512
+ D1: "springWorm_mid.svg",
2513
+ E1: "springWorm_mid.svg",
2514
+ S1: "springWorm_mid.svg",
2515
+ W1: "springWorm_side.svg",
2516
+ W1b: "springWorm_side.svg",
2517
+ N1: "springWorm_side.svg",
2518
+ W2: "springWorm_side.svg",
2519
+ W3: "springWorm_side.svg",
2520
+ leftCaps: "springWorm_side.svg",
2521
+ rightCaps: "springWorm_caps.svg",
2522
+ Nt: "plugTorque_teeth_radial.svg",
2523
+ Dt: "plugTorque_teeth_radial.svg",
2524
+ Ht: "plugTorque_teeth_radial.svg",
2525
+ ate: "plugTorque_teeth_radial.svg",
2526
+ dh: "plugTorque_teeth_radial.svg",
2527
+ ah: "plugTorque_teeth_radial.svg",
2528
+ aeh: "plugTorque_teeth_radial.svg",
2529
+ aM: "plugTorque_teeth_adden.svg",
2530
+ SnAae: "plugTorque_teeth_radial.svg",
2531
+ SnAde: "plugTorque_teeth_radial.svg",
2532
+ Rae: "plugTorque_teeth_radial.svg",
2533
+ Rde: "plugTorque_teeth_radial.svg"
2534
+ },
2535
+ sim: {
2536
+ tMax: 180,
2537
+ tStep: 0.5,
2538
+ tUpdate: 500
2539
+ // every 0.5 second
2540
+ }
2541
+ };
2542
+ function pGeom8(t, param, suffix = "") {
2543
+ const rGeome = initGeom8(pDef8.partName + suffix);
2544
+ const figTube = figure8();
2545
+ const figGroove1 = figure8();
2546
+ const figGroove2 = figure8();
2547
+ const figLeft = figure8();
2548
+ const figRight = figure8();
2549
+ const figW1b = figure8();
2550
+ rGeome.logstr += `${rGeome.partName} simTime: ${t}
2551
+ `;
2552
+ try {
2553
+ const R1 = param.D1 / 2;
2554
+ const Ri = R1 - param.E1;
2555
+ const R12 = 1.2 * R1;
2556
+ const S12 = param.S1 / 2;
2557
+ const W32 = param.W3 / 2;
2558
+ const lenMid = (param.N1 + 1) * param.W2 + param.N1 * param.W3;
2559
+ const capsLeftExt = param.leftCaps === 0;
2560
+ const capsRightExt = param.rightCaps === 0;
2561
+ const lenLeft = capsLeftExt ? param.W1 : param.W1 + param.W1b;
2562
+ const lenRight = capsRightExt ? param.W1 : param.W1 + param.W1b;
2563
+ const lenTotal = lenLeft + lenMid + lenRight;
2564
+ if (Ri < 0.1) {
2565
+ throw `err079: D1 ${param.D1} is too small compare to E1 ${param.E1}`;
2566
+ }
2567
+ if (R1 - S12 < W32) {
2568
+ throw `err130: R1 ${R1} is too small compare to S12 ${S12} or W32 ${W32}`;
2569
+ }
2570
+ rGeome.logstr += `Dint ${ffix9(2 * Ri)} mm
2571
+ `;
2572
+ rGeome.logstr += `Total length ${ffix9(lenTotal)} mm
2573
+ `;
2574
+ const [ctrToothE, logE] = ctrPlugExtern(param, R1);
2575
+ rGeome.logstr += logE;
2576
+ figTube.addMainOI([contourCircle6(0, 0, R1), contourCircle6(0, 0, Ri)]);
2577
+ figTube.addSecond(ctrRectangle4(S12, -R12, R1, 2 * R12));
2578
+ figTube.addSecond(ctrRectangle4(-R1 - S12, -R12, R1, 2 * R12));
2579
+ figTube.addSecond(ctrRectangle4(-R12, S12, 2 * R12, R1));
2580
+ figTube.addSecond(ctrRectangle4(-R12, -R1 - S12, 2 * R12, R1));
2581
+ const ctrTubes = [];
2582
+ ctrTubes.push(ctrRectangle4(0, -R1, param.W1, param.D1));
2583
+ if (!capsLeftExt) {
2584
+ ctrTubes.push(ctrRectangle4(param.W1, -R1, param.W1b, param.D1));
2585
+ }
2586
+ ctrTubes.push(ctrRectangle4(lenLeft, -R1, lenMid, param.D1));
2587
+ if (!capsRightExt) {
2588
+ ctrTubes.push(ctrRectangle4(lenLeft + lenMid, -R1, param.W1b, param.D1));
2589
+ }
2590
+ ctrTubes.push(ctrRectangle4(lenTotal - param.W1, -R1, param.W1, param.D1));
2591
+ for (const iCtr of ctrTubes) {
2592
+ figGroove1.addSecond(iCtr);
2593
+ figGroove2.addSecond(iCtr);
2594
+ }
2595
+ const xStart = lenLeft + param.W2;
2596
+ const xStep = param.W3 + param.W2;
2597
+ for (let ii = 0; ii < param.N1; ii++) {
2598
+ const ctr1 = makeCtrGroove(xStart + ii * xStep, S12, param.W3, R1, false);
2599
+ const ctr2 = makeCtrGroove(xStart + ii * xStep, -R1 - S12, param.W3, R1, true);
2600
+ if (ii % 2 === 0) {
2601
+ figGroove1.addMainO(ctr1);
2602
+ figGroove1.addMainO(ctr2);
2603
+ figGroove2.addSecond(ctr1);
2604
+ figGroove2.addSecond(ctr2);
2605
+ } else {
2606
+ figGroove1.addSecond(ctr1);
2607
+ figGroove1.addSecond(ctr2);
2608
+ figGroove2.addMainO(ctr1);
2609
+ figGroove2.addMainO(ctr2);
2610
+ }
2611
+ }
2612
+ if (capsLeftExt) {
2613
+ figLeft.addMainOI([contourCircle6(0, 0, R1), ctrToothE]);
2614
+ } else {
2615
+ figLeft.addMainO(ctrToothE);
2616
+ figLeft.addSecond(contourCircle6(0, 0, R1));
2617
+ }
2618
+ figLeft.addSecond(contourCircle6(0, 0, Ri));
2619
+ if (capsRightExt) {
2620
+ figRight.addMainOI([contourCircle6(0, 0, R1), ctrToothE]);
2621
+ } else {
2622
+ figRight.addMainO(ctrToothE);
2623
+ figRight.addSecond(contourCircle6(0, 0, R1));
2624
+ }
2625
+ figRight.addSecond(contourCircle6(0, 0, Ri));
2626
+ figW1b.addMainO(contourCircle6(0, 0, R1));
2627
+ rGeome.fig = {
2628
+ faceTube: figTube,
2629
+ faceGroove1: figGroove1,
2630
+ faceGroove2: figGroove2,
2631
+ faceLeft: figLeft,
2632
+ faceRight: figRight,
2633
+ faceW1b: figW1b
2634
+ };
2635
+ const designName = rGeome.partName;
2636
+ const union_list = [
2637
+ `subpax_${designName}_tube`,
2638
+ `subpax_${designName}_left`,
2639
+ `subpax_${designName}_right`
2640
+ ];
2641
+ if (!capsLeftExt) {
2642
+ union_list.push(`subpax_${designName}_leftB`);
2643
+ }
2644
+ if (!capsRightExt) {
2645
+ union_list.push(`subpax_${designName}_rightB`);
2646
+ }
2647
+ rGeome.vol = {
2648
+ extrudes: [
2649
+ {
2650
+ outName: `subpax_${designName}_tube`,
2651
+ face: `${designName}_faceTube`,
2652
+ extrudeMethod: EExtrude8.eLinearOrtho,
2653
+ length: lenMid,
2654
+ rotate: [0, 0, 0],
2655
+ translate: [0, 0, lenLeft]
2656
+ },
2657
+ {
2658
+ outName: `subpax_${designName}_left`,
2659
+ face: `${designName}_faceLeft`,
2660
+ extrudeMethod: EExtrude8.eLinearOrtho,
2661
+ length: param.W1,
2662
+ rotate: [0, 0, 0],
2663
+ translate: [0, 0, 0]
2664
+ },
2665
+ {
2666
+ outName: `subpax_${designName}_leftB`,
2667
+ face: `${designName}_faceW1b`,
2668
+ extrudeMethod: EExtrude8.eLinearOrtho,
2669
+ length: param.W1b,
2670
+ rotate: [0, 0, 0],
2671
+ translate: [0, 0, param.W1]
2672
+ },
2673
+ {
2674
+ outName: `subpax_${designName}_rightB`,
2675
+ face: `${designName}_faceW1b`,
2676
+ extrudeMethod: EExtrude8.eLinearOrtho,
2677
+ length: param.W1b,
2678
+ rotate: [0, 0, 0],
2679
+ translate: [0, 0, lenLeft + lenMid]
2680
+ },
2681
+ {
2682
+ outName: `subpax_${designName}_right`,
2683
+ face: `${designName}_faceRight`,
2684
+ extrudeMethod: EExtrude8.eLinearOrtho,
2685
+ length: param.W1,
2686
+ rotate: [0, 0, 0],
2687
+ translate: [0, 0, lenTotal - param.W1]
2688
+ },
2689
+ {
2690
+ outName: `subpax_${designName}_groove1`,
2691
+ face: `${designName}_faceGroove1`,
2692
+ extrudeMethod: EExtrude8.eLinearOrtho,
2693
+ length: 2 * R12,
2694
+ rotate: [0, -Math.PI / 2, 0],
2695
+ translate: [R12, 0, 0]
2696
+ },
2697
+ {
2698
+ outName: `subpax_${designName}_groove2`,
2699
+ face: `${designName}_faceGroove2`,
2700
+ extrudeMethod: EExtrude8.eLinearOrtho,
2701
+ length: 2 * R12,
2702
+ rotate: [0, -Math.PI / 2, -Math.PI / 2],
2703
+ translate: [0, -R12, 0]
2704
+ }
2705
+ ],
2706
+ volumes: [
2707
+ {
2708
+ outName: `ipax_${designName}_plus`,
2709
+ boolMethod: EBVolume8.eUnion,
2710
+ inList: union_list
2711
+ },
2712
+ {
2713
+ outName: `ipax_${designName}_moins`,
2714
+ boolMethod: EBVolume8.eUnion,
2715
+ inList: [`subpax_${designName}_groove1`, `subpax_${designName}_groove2`]
2716
+ },
2717
+ {
2718
+ outName: `pax_${designName}`,
2719
+ boolMethod: EBVolume8.eSubstraction,
2720
+ inList: [`ipax_${designName}_plus`, `ipax_${designName}_moins`]
2721
+ }
2722
+ ]
2723
+ };
2724
+ rGeome.sub = {};
2725
+ rGeome.logstr += "springWorm drawn successfully!\n";
2726
+ rGeome.calcErr = false;
2727
+ } catch (emsg) {
2728
+ rGeome.logstr += emsg;
2729
+ console.log(emsg);
2730
+ }
2731
+ return rGeome;
2732
+ }
2733
+ var springWormDef = {
2734
+ pTitle: "springWorm",
2735
+ pDescription: "Flex-part for unperfect coaxial transmission",
2736
+ pDef: pDef8,
2737
+ pGeom: pGeom8
2738
+ };
2739
+
2740
+ // src/spring/springOne.ts
2741
+ import {
2742
+ contour as contour10,
2743
+ contourCircle as contourCircle7,
2744
+ figure as figure9,
2745
+ degToRad as degToRad3,
2746
+ ffix as ffix10,
2747
+ pNumber as pNumber9,
2748
+ pCheckbox as pCheckbox5,
2749
+ pSectionSeparator as pSectionSeparator9,
2750
+ initGeom as initGeom9
2751
+ } from "geometrix";
2752
+ import {
2753
+ tJDir,
2754
+ tJSide,
2755
+ contourJ,
2756
+ facet,
2757
+ facet2figure,
2758
+ sheetFold
2759
+ } from "sheetfold";
2760
+ var pDef9 = {
2761
+ partName: "springOne",
2762
+ params: [
2763
+ //pNumber(name, unit, init, min, max, step)
2764
+ pNumber9("D1", "mm", 16, 1, 100, 0.1),
2765
+ pNumber9("Dbearing", "mm", 35, 1, 100, 0.1),
2766
+ pNumber9("H1", "mm", 5, 1, 100, 1),
2767
+ pNumber9("H2", "mm", 15, 1, 100, 1),
2768
+ pNumber9("R2", "mm", 15, 1, 100, 1),
2769
+ pNumber9("L1", "mm", 50, 1, 200, 1),
2770
+ pNumber9("Rc1", "mm", 5, 0, 50, 1),
2771
+ pSectionSeparator9("Spring zone"),
2772
+ pCheckbox5("spring", true),
2773
+ pNumber9("E1", "mm", 2, 1, 100, 1),
2774
+ pNumber9("E2", "mm", 2, 1, 100, 1),
2775
+ pNumber9("smEy", "mm", 1, 0.1, 10, 0.1),
2776
+ pNumber9("shEy", "mm", 1, 0.1, 10, 0.1),
2777
+ pNumber9("shPr", "%", 90, 0, 99, 1),
2778
+ pNumber9("sNx", "xHoles", 2, 2, 200, 1),
2779
+ pNumber9("smEx", "mm", 1, 0.1, 10, 0.1),
2780
+ pNumber9("smExS", "mm", 0.5, 0.1, 10, 0.1),
2781
+ pSectionSeparator9("Screw holes"),
2782
+ pNumber9("D3", "mm", 6, 1, 100, 1),
2783
+ pNumber9("P3", "mm", 70, 1, 200, 1),
2784
+ pNumber9("P4", "mm", 30, 1, 200, 1),
2785
+ pSectionSeparator9("Borders"),
2786
+ pNumber9("L2", "mm", 20, 1, 200, 1),
2787
+ pNumber9("E3", "mm", 1, 0, 20, 0.1),
2788
+ pNumber9("W1", "mm", 20, 1, 200, 1),
2789
+ pNumber9("W3", "mm", 50, 1, 400, 1),
2790
+ pNumber9("Rc3", "mm", 0.5, 0, 10, 0.1),
2791
+ pCheckbox5("B2", true),
2792
+ pNumber9("A2", "mm", 10, 1, 200, 1),
2793
+ pNumber9("Rc2", "mm", 5, 0, 50, 1),
2794
+ pSectionSeparator9("Folding"),
2795
+ pNumber9("Th", "mm", 1, 0.1, 10, 0.1),
2796
+ pNumber9("Jangle", "degree", 90, 0, 120, 1),
2797
+ pNumber9("Jradius", "mm", 2, 0.1, 10, 0.1),
2798
+ pNumber9("Jneutral", "%", 50, 0, 100, 1),
2799
+ pNumber9("Jmark", "mm", 1, 0.1, 10, 0.1)
2800
+ ],
2801
+ paramSvg: {
2802
+ D1: "springOne_face.svg",
2803
+ Dbearing: "springOne_face.svg",
2804
+ H1: "springOne_face.svg",
2805
+ H2: "springOne_face.svg",
2806
+ R2: "springOne_face.svg",
2807
+ L1: "springOne_face.svg",
2808
+ Rc1: "springOne_face.svg",
2809
+ spring: "springOne_spring.svg",
2810
+ E1: "springOne_face.svg",
2811
+ E2: "springOne_face.svg",
2812
+ smEy: "springOne_spring.svg",
2813
+ shEy: "springOne_spring.svg",
2814
+ shPr: "springOne_spring.svg",
2815
+ sNx: "springOne_spring.svg",
2816
+ smEx: "springOne_spring.svg",
2817
+ smExS: "springOne_spring.svg",
2818
+ D3: "springOne_top.svg",
2819
+ P3: "springOne_top.svg",
2820
+ P4: "springOne_top.svg",
2821
+ L2: "springOne_top.svg",
2822
+ E3: "springOne_top.svg",
2823
+ W1: "springOne_top.svg",
2824
+ W3: "springOne_top.svg",
2825
+ Rc3: "springOne_top.svg",
2826
+ B2: "springOne_face.svg",
2827
+ A2: "springOne_face.svg",
2828
+ Rc2: "springOne_side.svg",
2829
+ Th: "springOne_side.svg",
2830
+ Jangle: "springOne_face.svg",
2831
+ Jradius: "springOne_face.svg",
2832
+ Jneutral: "springOne_face.svg",
2833
+ Jmark: "springOne_face.svg"
2834
+ },
2835
+ sim: {
2836
+ tMax: 180,
2837
+ tStep: 0.5,
2838
+ tUpdate: 500
2839
+ // every 0.5 second
2840
+ }
2841
+ };
2842
+ function pGeom9(t, param, suffix = "") {
2843
+ const rGeome = initGeom9(pDef9.partName + suffix);
2844
+ const figWallB = figure9();
2845
+ rGeome.logstr += `${rGeome.partName} simTime: ${t}
2846
+ `;
2847
+ try {
2848
+ let makeSpringHollow2 = function(iLen) {
2849
+ const rCtr = contour10(0, 0).addCornerRounded(sRc).addSegStrokeR(iLen, 0).addCornerRounded(sRc).addSegStrokeR(0, param.shEy).addCornerRounded(sRc).addSegStrokeR(-iLen, 0).addCornerRounded(sRc).closeSegStroke();
2850
+ return rCtr;
2851
+ }, calcXref2 = function(iyRef, iSel, idx) {
2852
+ const cotan = iSel === 0 ? cotanBAD : cotanBADb;
2853
+ const cL = iSel === 0 ? 2 * L12 : 2 * L12b;
2854
+ const cy = iyRef - Hfoot - param.H1;
2855
+ const cx = cy < 0 ? cL : cL - 2 * cy * cotan;
2856
+ const cx0 = param.L1 / 2 - cx / 2 + param.smExS;
2857
+ const nx = idx % 2 === 0 ? param.sNx + 1 : param.sNx;
2858
+ const lx = (cx - 2 * param.smExS + param.smEx) / (param.sNx + 1) - param.smEx;
2859
+ const lxAZpre = lx / 2 - param.smEx / 2;
2860
+ const lxAZ = idx % 2 === 0 ? lxAZpre : lx;
2861
+ if (lxAZ < 2 * sRc) {
2862
+ throw `err228: lxAZ ${ffix10(lxAZ)} is too small compare to ${param.sNx} or ${param.smEx}`;
2863
+ }
2864
+ return [cx0, lxAZ, lx, nx];
2865
+ }, makeCtrWall2 = function(iJunctionName) {
2866
+ 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();
2867
+ return rCtr;
2868
+ }, makeCtrSide2 = function(iJunctionName) {
2869
+ 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();
2870
+ return rCtr;
2871
+ };
2872
+ var makeSpringHollow = makeSpringHollow2, calcXref = calcXref2, makeCtrWall = makeCtrWall2, makeCtrSide = makeCtrSide2;
2873
+ const R1 = param.D1 / 2;
2874
+ const R3 = param.D3 / 2;
2875
+ const Hwall = param.H1 + param.H2 + param.R2;
2876
+ const aJa = degToRad3(param.Jangle);
2877
+ const aJn = param.Jneutral / 100;
2878
+ const aJr = param.Jradius;
2879
+ const aJm = param.Jmark;
2880
+ const Hfoot = param.Jradius + (1 - aJn) * param.Th;
2881
+ const xFoot = 2 * param.E3;
2882
+ const L12 = param.L1 / 2;
2883
+ const aBAC = Math.atan2(param.H2, L12);
2884
+ const lAC = Math.sqrt(L12 ** 2 + param.H2 ** 2);
2885
+ if (param.R2 > lAC) {
2886
+ throw `err141: R2 ${param.R2} is too large comapre to lAC ${ffix10(lAC)} mm`;
2887
+ }
2888
+ const aCAD = Math.asin(param.R2 / lAC);
2889
+ const lAD = lAC * Math.cos(aCAD);
2890
+ const xAD = lAD * Math.cos(aBAC + aCAD);
2891
+ const yAD = lAD * Math.sin(aBAC + aCAD);
2892
+ const cotanBAD = xAD / yAD;
2893
+ const L12b = L12 + xFoot;
2894
+ const aBACb = Math.atan2(param.H2, L12b);
2895
+ const lACb = Math.sqrt(L12b ** 2 + param.H2 ** 2);
2896
+ const aCADb = Math.asin(param.R2 / lACb);
2897
+ const lADb = lACb * Math.cos(aCADb);
2898
+ const xADb = lADb * Math.cos(aBACb + aCADb);
2899
+ const yADb = lADb * Math.sin(aBACb + aCADb);
2900
+ const cotanBADb = xADb / yADb;
2901
+ const L2b = param.L2 - param.E3;
2902
+ const L1b = param.L1 + 2 * param.E3;
2903
+ const W3b = (param.W3 - param.W1) / 2;
2904
+ const midBottomX = L2b + L1b / 2;
2905
+ const midBottomY = param.W3 / 2;
2906
+ const P32 = param.P3 / 2;
2907
+ const P42 = param.P4 / 2;
2908
+ const L122 = param.L1 + 2 * param.L2;
2909
+ const sHeight = param.H1 + param.H2 - R1 - param.E1 - param.E2;
2910
+ const sStepY = param.smEy + param.shEy;
2911
+ const sNy = Math.floor((sHeight + param.smEy) / sStepY);
2912
+ const sRc = param.shEy * param.shPr / 200;
2913
+ if (R1 < 0.1) {
2914
+ throw `err087: R1 ${ffix10(R1)} is too small because of D1 ${param.D1}`;
2915
+ }
2916
+ if (L2b < 0.1) {
2917
+ throw `err165: L2b ${ffix10(L2b)} is too small because of E3 ${param.E3}`;
2918
+ }
2919
+ if (param.E3 < param.Rc3) {
2920
+ throw `err170: E3 ${param.E3} is too small compare to Rc3 ${param.Rc3}`;
2921
+ }
2922
+ if (W3b < param.Rc3) {
2923
+ throw `err174: W3b ${ffix10(W3b)} is too small compare to Rc3 ${param.Rc3}`;
2924
+ }
2925
+ if (param.spring === 1) {
2926
+ if (sHeight < 0.1) {
2927
+ throw `err189: sHeight ${ffix10(sHeight)} is too small because of E1 ${param.E1} or E2 ${param.E2}`;
2928
+ }
2929
+ }
2930
+ rGeome.logstr += `Bearing holder wall: Hwall ${ffix10(Hwall)}, Hfoot ${ffix10(Hfoot)} mm
2931
+ `;
2932
+ if (param.spring === 1) {
2933
+ rGeome.logstr += `spring: sNy ${sNy}, sRc ${ffix10(sRc)} mm
2934
+ `;
2935
+ } else {
2936
+ rGeome.logstr += `No spring
2937
+ `;
2938
+ }
2939
+ const sW1 = [];
2940
+ const sWB = [];
2941
+ if (param.spring === 1) {
2942
+ for (let jj = 0; jj < sNy; jj++) {
2943
+ const yy = Hfoot + param.E1 + jj * sStepY;
2944
+ const yRef = yy + param.shEy / 2;
2945
+ const [xRef, lxAZ, lx, nx] = calcXref2(yRef, 0, jj);
2946
+ const [xRefB, lxAZb, lxb] = calcXref2(yRef, 1, jj);
2947
+ let xx = xRef;
2948
+ let xxb = xRefB;
2949
+ sW1.push(makeSpringHollow2(lxAZ).translate(xx, yy));
2950
+ sWB.push(makeSpringHollow2(lxAZb).translate(xxb, yy));
2951
+ xx += lxAZ + param.smEx;
2952
+ xxb += lxAZb + param.smEx;
2953
+ for (let ii = 0; ii < nx - 1; ii++) {
2954
+ sW1.push(makeSpringHollow2(lx).translate(xx, yy));
2955
+ sWB.push(makeSpringHollow2(lxb).translate(xxb, yy));
2956
+ xx += lx + param.smEx;
2957
+ xxb += lxb + param.smEx;
2958
+ }
2959
+ sW1.push(makeSpringHollow2(lxAZ).translate(xx, yy));
2960
+ sWB.push(makeSpringHollow2(lxAZb).translate(xxb, yy));
2961
+ }
2962
+ }
2963
+ const ctrWall1 = makeCtrWall2("J1");
2964
+ const ctrWall2 = makeCtrWall2("J2");
2965
+ const ctrAxis = contourCircle7(L12, Hfoot + param.H1 + param.H2, R1);
2966
+ const ctrBearing = contourCircle7(L12, Hfoot + param.H1 + param.H2, param.Dbearing / 2);
2967
+ const faWall1 = facet([ctrWall1, ctrAxis, ...sW1]);
2968
+ const faWall2 = facet([ctrWall2, ctrAxis, ...sW1]);
2969
+ 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);
2970
+ if (param.B2 === 1) {
2971
+ ctrBottom.startJunction("J4", tJDir.eA, tJSide.eABLeft);
2972
+ }
2973
+ 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);
2974
+ if (param.B2 === 1) {
2975
+ ctrBottom.startJunction("J3", tJDir.eA, tJSide.eABLeft);
2976
+ }
2977
+ ctrBottom.closeSegStroke();
2978
+ const hollowBottom = [];
2979
+ hollowBottom.push(contourCircle7(midBottomX - P32, midBottomY - P42, R3));
2980
+ hollowBottom.push(contourCircle7(midBottomX - P32, midBottomY + P42, R3));
2981
+ hollowBottom.push(contourCircle7(midBottomX + P32, midBottomY - P42, R3));
2982
+ hollowBottom.push(contourCircle7(midBottomX + P32, midBottomY + P42, R3));
2983
+ const faBottom = facet([ctrBottom, ...hollowBottom]);
2984
+ const faSide = [];
2985
+ const junctionSide = {};
2986
+ if (param.B2 === 1) {
2987
+ faSide.push(facet([makeCtrSide2("J3")]));
2988
+ faSide.push(facet([makeCtrSide2("J4")]));
2989
+ junctionSide["J3"] = { angle: aJa, radius: aJr, neutral: aJn, mark: aJm };
2990
+ junctionSide["J4"] = { angle: aJa, radius: aJr, neutral: aJn, mark: aJm };
2991
+ }
2992
+ let half1 = [];
2993
+ let half2 = [];
2994
+ if (param.B2 === 1) {
2995
+ half1 = ["J3", param.A2];
2996
+ half2 = ["J4", param.A2];
2997
+ }
2998
+ const sFold = sheetFold(
2999
+ [faBottom, faWall1, faWall2, ...faSide],
3000
+ {
3001
+ J1: { angle: aJa, radius: aJr, neutral: aJn, mark: aJm },
3002
+ J2: { angle: aJa, radius: aJr, neutral: aJn, mark: aJm },
3003
+ ...junctionSide
3004
+ },
3005
+ [
3006
+ { x1: 0, y1: 0, a1: 0, l1: param.W1, ante: ["J1", Hwall], post: ["J2", Hwall] },
3007
+ { x1: 0, y1: Hfoot + 1.5 * Hwall, a1: 0, l1: L122, ante: half1, post: half2 }
3008
+ ],
3009
+ param.Th,
3010
+ rGeome.partName
3011
+ );
3012
+ 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();
3013
+ figWallB.addMainOI([ctrWallB, ctrAxis, ...sWB]);
3014
+ figWallB.addSecond(ctrBearing);
3015
+ figWallB.mergeFigure(facet2figure(faWall1), true);
3016
+ rGeome.fig = {
3017
+ faceWallB: figWallB
3018
+ };
3019
+ const ffObj = sFold.makeFigures();
3020
+ for (const iFace of Object.keys(ffObj)) {
3021
+ rGeome.fig[iFace] = ffObj[iFace];
3022
+ }
3023
+ rGeome.vol = sFold.makeVolume();
3024
+ rGeome.sub = {};
3025
+ rGeome.logstr += "springOne drawn successfully!\n";
3026
+ rGeome.calcErr = false;
3027
+ } catch (emsg) {
3028
+ rGeome.logstr += emsg;
3029
+ console.log(emsg);
3030
+ }
3031
+ return rGeome;
3032
+ }
3033
+ var springOneDef = {
3034
+ pTitle: "springOne",
3035
+ pDescription: "bearing-holder with integrated spring",
3036
+ pDef: pDef9,
3037
+ pGeom: pGeom9
3038
+ };
3039
+
3040
+ // src/spring/springSide.ts
3041
+ import {
3042
+ contour as contour11,
3043
+ contourCircle as contourCircle8,
3044
+ ffix as ffix11,
3045
+ pNumber as pNumber10,
3046
+ pCheckbox as pCheckbox6,
3047
+ pSectionSeparator as pSectionSeparator10,
3048
+ initGeom as initGeom10
3049
+ } from "geometrix";
3050
+ import {
3051
+ tJDir as tJDir2,
3052
+ tJSide as tJSide2,
3053
+ contourJ as contourJ2,
3054
+ facet as facet2,
3055
+ sheetFold as sheetFold2
3056
+ } from "sheetfold";
3057
+ var pDef10 = {
3058
+ partName: "springSide",
3059
+ params: [
3060
+ //pNumber(name, unit, init, min, max, step)
3061
+ pNumber10("D5", "mm", 100, 10, 5e3, 1),
3062
+ pNumber10("N5", "unit", 8, 3, 100, 1),
3063
+ pNumber10("W2", "mm", 20, 1, 200, 1),
3064
+ pSectionSeparator10("One unit"),
3065
+ pNumber10("D1", "mm", 16, 1, 100, 0.1),
3066
+ pNumber10("H1", "mm", 5, 1, 100, 1),
3067
+ pNumber10("H2", "mm", 15, 1, 100, 1),
3068
+ pNumber10("R2", "mm", 15, 1, 100, 1),
3069
+ pSectionSeparator10("Spring zone"),
3070
+ pCheckbox6("spring", true),
3071
+ pNumber10("E1", "mm", 2, 1, 100, 1),
3072
+ pNumber10("E2", "mm", 2, 1, 100, 1),
3073
+ pNumber10("smEy", "mm", 1, 0.1, 10, 0.1),
3074
+ pNumber10("shEy", "mm", 1, 0.1, 10, 0.1),
3075
+ pNumber10("shPr", "%", 90, 0, 99, 1),
3076
+ pNumber10("sNx", "xHoles", 2, 2, 200, 1),
3077
+ pNumber10("smEx", "mm", 1, 0.1, 10, 0.1),
3078
+ pNumber10("smExS", "mm", 0.5, 0.1, 10, 0.1),
3079
+ pSectionSeparator10("Folding"),
3080
+ pNumber10("Th", "mm", 1, 0.1, 10, 0.1),
3081
+ //pNumber('Jangle', 'degree', 90, 0, 120, 1),
3082
+ pNumber10("Jradius", "mm", 2, 0.1, 10, 0.1),
3083
+ pNumber10("Jneutral", "%", 50, 0, 100, 1),
3084
+ pNumber10("Jmark", "mm", 1, 0.1, 10, 0.1)
3085
+ ],
3086
+ paramSvg: {
3087
+ D5: "springSide_top.svg",
3088
+ N5: "springSide_top.svg",
3089
+ W2: "springSide_top.svg",
3090
+ D1: "springSide_face.svg",
3091
+ H1: "springSide_face.svg",
3092
+ H2: "springSide_face.svg",
3093
+ R2: "springSide_face.svg",
3094
+ spring: "springSide_spring.svg",
3095
+ E1: "springSide_face.svg",
3096
+ E2: "springSide_face.svg",
3097
+ smEy: "springSide_spring.svg",
3098
+ shEy: "springSide_spring.svg",
3099
+ shPr: "springSide_spring.svg",
3100
+ sNx: "springSide_spring.svg",
3101
+ smEx: "springSide_spring.svg",
3102
+ smExS: "springSide_spring.svg",
3103
+ Th: "springSide_section.svg",
3104
+ //Jangle: 'springSide_face.svg',
3105
+ Jradius: "springSide_face.svg",
3106
+ Jneutral: "springSide_face.svg",
3107
+ Jmark: "springSide_face.svg"
3108
+ },
3109
+ sim: {
3110
+ tMax: 180,
3111
+ tStep: 0.5,
3112
+ tUpdate: 500
3113
+ // every 0.5 second
3114
+ }
3115
+ };
3116
+ function pGeom10(t, param, suffix = "") {
3117
+ const rGeome = initGeom10(pDef10.partName + suffix);
3118
+ rGeome.logstr += `${rGeome.partName} simTime: ${t}
3119
+ `;
3120
+ try {
3121
+ let makeSpringHollow2 = function(iLen) {
3122
+ const rCtr = contour11(0, 0).addCornerRounded(sRc).addSegStrokeR(iLen, 0).addCornerRounded(sRc).addSegStrokeR(0, param.shEy).addCornerRounded(sRc).addSegStrokeR(-iLen, 0).addCornerRounded(sRc).closeSegStroke();
3123
+ return rCtr;
3124
+ }, calcXref2 = function(iyRef, iSel, idx) {
3125
+ const cotan = iSel === 0 ? cotanBAD : cotanBADb;
3126
+ const cL = iSel === 0 ? Li : Le;
3127
+ const cy = iyRef - Hfoot - param.H1;
3128
+ const cx = cy < 0 ? cL : cL - 2 * cy * cotan;
3129
+ const cx0 = cL / 2 - cx / 2 + param.smExS;
3130
+ const nx = idx % 2 === 0 ? param.sNx + 1 : param.sNx;
3131
+ const lx = (cx - 2 * param.smExS + param.smEx) / (param.sNx + 1) - param.smEx;
3132
+ const lxAZpre = lx / 2 - param.smEx / 2;
3133
+ const lxAZ = idx % 2 === 0 ? lxAZpre : lx;
3134
+ if (lxAZ < 2 * sRc) {
3135
+ throw `err228: lxAZ ${ffix11(lxAZ)} is too small compare to ${param.sNx} or ${param.smEx}`;
3136
+ }
3137
+ return [cx0, lxAZ, lx, nx];
3138
+ }, makeCtrWall2 = function(iJ0, iJ1, iJb, iL, iL2, iJ1b, iSel) {
3139
+ const Xad = iSel ? xADb : xAD;
3140
+ const Yad = iSel ? yADb : yAD;
3141
+ const rCtr = contourJ2(0, Hfoot);
3142
+ if (iL2 > 0) {
3143
+ rCtr.addSegStrokeR(iL2, 0);
3144
+ }
3145
+ rCtr.startJunction(iJb, tJDir2.eB, tJSide2.eABRight).addSegStrokeR(Li, 0);
3146
+ if (iL2 > 0) {
3147
+ rCtr.addSegStrokeR(iL2, 0);
3148
+ }
3149
+ if (iSel) {
3150
+ rCtr.startJunction(iJ0, tJDir2.eA, tJSide2.eABLeft);
3151
+ } else {
3152
+ if (iJ1b) {
3153
+ rCtr.startJunction(iJ1, tJDir2.eB, tJSide2.eABRight);
3154
+ }
3155
+ }
3156
+ rCtr.addSegStrokeR(0, param.H1).addSegStrokeR(-Xad, Yad).addPointA(iL2 + iL / 2, Hwall + Hfoot).addPointA(Xad, param.H1 + Yad + Hfoot).addSegArc2().addSegStrokeR(-Xad, -Yad);
3157
+ if (iSel) {
3158
+ if (iJ1b) {
3159
+ rCtr.startJunction(iJ1, tJDir2.eB, tJSide2.eABRight);
3160
+ }
3161
+ } else {
3162
+ rCtr.startJunction(iJ0, tJDir2.eA, tJSide2.eABLeft);
3163
+ }
3164
+ rCtr.closeSegStroke();
3165
+ return rCtr;
3166
+ };
3167
+ var makeSpringHollow = makeSpringHollow2, calcXref = calcXref2, makeCtrWall = makeCtrWall2;
3168
+ const pi2 = Math.PI / 2;
3169
+ const aJn = param.Jneutral / 100;
3170
+ const aJr = param.Jradius;
3171
+ const aJm = param.Jmark;
3172
+ const Hfoot = aJr + (1 - aJn) * param.Th;
3173
+ const R5 = param.D5 / 2;
3174
+ const a5 = 2 * Math.PI / param.N5;
3175
+ const a52 = a5 / 2;
3176
+ const W22 = (param.W2 + param.Th) / 2;
3177
+ const LiY = R5 - W22;
3178
+ const Lii = 2 * LiY * Math.tan(a52);
3179
+ const Lee = 2 * (R5 + W22) * Math.tan(a52);
3180
+ const Lm = aJr * Math.tan(a52);
3181
+ const Li = Lii - 2 * Lm;
3182
+ const Le = Lee - 2 * Lm;
3183
+ const W1 = param.W2 + 2 * param.Th - 2 * Hfoot;
3184
+ const W12 = W1 / 2;
3185
+ const Le2 = (Le - Li) / 2;
3186
+ const R3 = W1 / 8;
3187
+ const D3 = 2 * R3;
3188
+ const Lih = Li / 2;
3189
+ const Leh = Le / 2;
3190
+ const R1 = param.D1 / 2;
3191
+ const Hwall = param.H1 + param.H2 + param.R2;
3192
+ const aBAC = Math.atan2(param.H2, Lih);
3193
+ const lAC = Math.sqrt(Lih ** 2 + param.H2 ** 2);
3194
+ if (param.R2 > lAC) {
3195
+ throw `err141: R2 ${param.R2} is too large comapre to lAC ${ffix11(lAC)} mm`;
3196
+ }
3197
+ const aCAD = Math.asin(param.R2 / lAC);
3198
+ const lAD = lAC * Math.cos(aCAD);
3199
+ const xAD = lAD * Math.cos(aBAC + aCAD);
3200
+ const yAD = lAD * Math.sin(aBAC + aCAD);
3201
+ const cotanBAD = xAD / yAD;
3202
+ const aBACb = Math.atan2(param.H2, Leh);
3203
+ const lACb = Math.sqrt(Leh ** 2 + param.H2 ** 2);
3204
+ const aCADb = Math.asin(param.R2 / lACb);
3205
+ const lADb = lACb * Math.cos(aCADb);
3206
+ const xADb = lADb * Math.cos(aBACb + aCADb);
3207
+ const yADb = lADb * Math.sin(aBACb + aCADb);
3208
+ const cotanBADb = xADb / yADb;
3209
+ const sHeight = param.H1 + param.H2 - R1 - param.E1 - param.E2;
3210
+ const sStepY = param.smEy + param.shEy;
3211
+ const sNy = Math.floor((sHeight + param.smEy) / sStepY);
3212
+ const sRc = param.shEy * param.shPr / 200;
3213
+ if (R1 < 0.1) {
3214
+ throw `err087: R1 ${ffix11(R1)} is too small because of D1 ${param.D1}`;
3215
+ }
3216
+ if (LiY < 0.1) {
3217
+ throw `err168: R5 ${ffix11(R5)} is too small compare to W2 ${ffix11(W22)} or Th ${param.Th} mm`;
3218
+ }
3219
+ if (Li < 0.1) {
3220
+ throw `err171: Li ${ffix11(Li)} is too small because of aJr ${aJr} mm`;
3221
+ }
3222
+ if (W1 < 0.1) {
3223
+ throw `err174: W1 ${ffix11(W1)} is too small because of Hfoot ${ffix11(Hfoot)} mm`;
3224
+ }
3225
+ if (param.spring === 1) {
3226
+ if (sHeight < 0.1) {
3227
+ throw `err189: sHeight ${ffix11(sHeight)} is too small because of E1 ${param.E1} or E2 ${param.E2}`;
3228
+ }
3229
+ }
3230
+ rGeome.logstr += `Bearing holder wall: Hwall ${ffix11(Hwall)}, Hfoot ${ffix11(Hfoot)} mm
3231
+ `;
3232
+ rGeome.logstr += `Width of one unit interior: Lii ${ffix11(Lii)}, Li ${ffix11(Li)} mm
3233
+ `;
3234
+ rGeome.logstr += `Width of one unit exterior: Lee ${ffix11(Lee)}, Le ${ffix11(Le)} mm
3235
+ `;
3236
+ rGeome.logstr += `Ratio R2/Li ${ffix11(100 * param.R2 / Lih)} %
3237
+ `;
3238
+ rGeome.logstr += `Width of bottom: W1 ${ffix11(W1)}, D3 ${ffix11(D3)} mm
3239
+ `;
3240
+ if (param.spring === 1) {
3241
+ rGeome.logstr += `spring: sNy ${sNy}, sRc ${ffix11(sRc)} mm
3242
+ `;
3243
+ } else {
3244
+ rGeome.logstr += `No spring
3245
+ `;
3246
+ }
3247
+ const sWi = [];
3248
+ const sWe = [];
3249
+ if (param.spring === 1) {
3250
+ for (let jj = 0; jj < sNy; jj++) {
3251
+ const yy = Hfoot + param.E1 + jj * sStepY;
3252
+ const yRef = yy + param.shEy / 2;
3253
+ const [xRef, lxAZ, lx, nx] = calcXref2(yRef, 0, jj);
3254
+ const [xRefB, lxAZb, lxb] = calcXref2(yRef, 1, jj);
3255
+ let xx = xRef;
3256
+ let xxb = xRefB;
3257
+ sWi.push(makeSpringHollow2(lxAZ).translate(xx, yy));
3258
+ sWe.push(makeSpringHollow2(lxAZb).translate(xxb, yy));
3259
+ xx += lxAZ + param.smEx;
3260
+ xxb += lxAZb + param.smEx;
3261
+ for (let ii = 0; ii < nx - 1; ii++) {
3262
+ sWi.push(makeSpringHollow2(lx).translate(xx, yy));
3263
+ sWe.push(makeSpringHollow2(lxb).translate(xxb, yy));
3264
+ xx += lx + param.smEx;
3265
+ xxb += lxb + param.smEx;
3266
+ }
3267
+ sWi.push(makeSpringHollow2(lxAZ).translate(xx, yy));
3268
+ sWe.push(makeSpringHollow2(lxAZb).translate(xxb, yy));
3269
+ }
3270
+ }
3271
+ const ctrAxisi = contourCircle8(Lih, Hfoot + param.H1 + param.H2, R1);
3272
+ const ctrAxise = contourCircle8(Leh, Hfoot + param.H1 + param.H2, R1);
3273
+ const ctrBase = contourJ2(0, 0).startJunction("Jbi0", tJDir2.eA, tJSide2.eABLeft).addSegStrokeR(Li, 0).addSegStrokeR(0, W1).startJunction("Jbe0", tJDir2.eA, tJSide2.eABLeft).addSegStrokeR(-Li, 0).closeSegStroke();
3274
+ const ctrsHole = [];
3275
+ ctrsHole.push(contourCircle8(D3, D3, R3));
3276
+ ctrsHole.push(contourCircle8(Li - D3, D3, R3));
3277
+ ctrsHole.push(contourCircle8(D3, W1 - D3, R3));
3278
+ ctrsHole.push(contourCircle8(Li - D3, W1 - D3, R3));
3279
+ const faBase = facet2([ctrBase, ...ctrsHole]);
3280
+ const fasInt = [];
3281
+ const junctionInt = {};
3282
+ for (let ii = 0; ii < param.N5; ii++) {
3283
+ const Jcond = ii < param.N5 - 1;
3284
+ const iCtr = makeCtrWall2(`Ji${ii}`, `Ji${ii + 1}`, `Jbi${ii}`, Li, 0, Jcond, false);
3285
+ fasInt.push(facet2([iCtr, ctrAxisi, ...sWi]));
3286
+ junctionInt[`Ji${ii}`] = { angle: -a5, radius: aJr, neutral: aJn, mark: aJm };
3287
+ junctionInt[`Jbi${ii}`] = { angle: pi2, radius: aJr, neutral: aJn, mark: aJm };
3288
+ if (ii > 0) {
3289
+ const iCtr2 = contourJ2(0, 0).startJunction(`Jbi${ii}`, tJDir2.eA, tJSide2.eABLeft).addSegStrokeR(Li, 0).addSegStrokeR(0, W12).addSegStrokeR(-Li, 0).closeSegStroke();
3290
+ const iCtr2Hole = [];
3291
+ iCtr2Hole.push(contourCircle8(D3, D3, R3));
3292
+ iCtr2Hole.push(contourCircle8(Li - D3, D3, R3));
3293
+ fasInt.push(facet2([iCtr2, ...iCtr2Hole]));
3294
+ }
3295
+ }
3296
+ const fasExt = [];
3297
+ const junctionExt = {};
3298
+ for (let ii = 0; ii < param.N5; ii++) {
3299
+ const Jcond = ii < param.N5 - 1;
3300
+ const iCtr = makeCtrWall2(`Je${ii}`, `Je${ii + 1}`, `Jbe${ii}`, Li, Le2, Jcond, true);
3301
+ fasExt.push(facet2([iCtr, ctrAxise, ...sWe]));
3302
+ junctionExt[`Je${ii}`] = { angle: a5, radius: aJr, neutral: aJn, mark: aJm };
3303
+ junctionExt[`Jbe${ii}`] = { angle: pi2, radius: aJr, neutral: aJn, mark: aJm };
3304
+ if (ii > 0) {
3305
+ const iCtr2 = contourJ2(0, 0).addSegStrokeR(Li, 0).addSegStrokeR(0, W12).startJunction(`Jbe${ii}`, tJDir2.eA, tJSide2.eABLeft).addSegStrokeR(-Li, 0).closeSegStroke();
3306
+ const iCtr2Hole = [];
3307
+ iCtr2Hole.push(contourCircle8(D3, D3, R3));
3308
+ iCtr2Hole.push(contourCircle8(Li - D3, D3, R3));
3309
+ fasExt.push(facet2([iCtr2, ...iCtr2Hole]));
3310
+ }
3311
+ }
3312
+ const postHi = [];
3313
+ const postHe = [];
3314
+ for (let ii = 1; ii < param.N5; ii++) {
3315
+ postHi.push(...[`Ji${ii}`, Li]);
3316
+ postHe.push(...[`Je${ii}`, Le]);
3317
+ }
3318
+ const deltaY = param.Th + param.W2;
3319
+ const sFold = sheetFold2(
3320
+ [faBase, ...fasInt, ...fasExt],
3321
+ {
3322
+ Jbi0: { angle: pi2, radius: aJr, neutral: aJn, mark: aJm },
3323
+ Jbe0: { angle: pi2, radius: aJr, neutral: aJn, mark: aJm },
3324
+ ...junctionInt,
3325
+ ...junctionExt
3326
+ },
3327
+ [
3328
+ { x1: 0, y1: deltaY, a1: 0, l1: W1, ante: ["Jbi0", Hwall], post: ["Jbe0", Hwall] },
3329
+ { x1: -Le2, y1: 0, a1: 0, l1: Le, ante: ["Je0"], post: postHe },
3330
+ { x1: 0, y1: -deltaY, a1: 0, l1: Li, ante: ["Ji0"], post: postHi }
3331
+ ],
3332
+ param.Th,
3333
+ rGeome.partName
3334
+ );
3335
+ const ffObj = sFold.makeFigures();
3336
+ for (const iFace of Object.keys(ffObj)) {
3337
+ rGeome.fig[iFace] = ffObj[iFace];
3338
+ }
3339
+ rGeome.vol = sFold.makeVolume();
3340
+ rGeome.sub = {};
3341
+ rGeome.logstr += "springSide drawn successfully!\n";
3342
+ rGeome.calcErr = false;
3343
+ } catch (emsg) {
3344
+ rGeome.logstr += emsg;
3345
+ console.log(emsg);
3346
+ }
3347
+ return rGeome;
3348
+ }
3349
+ var springSideDef = {
3350
+ pTitle: "springSide",
3351
+ pDescription: "bearing-holder on the side of a ring",
3352
+ pDef: pDef10,
3353
+ pGeom: pGeom10
3354
+ };
3355
+
3356
+ // src/spring/springInt.ts
3357
+ import {
3358
+ contour as contour12,
3359
+ contourCircle as contourCircle9,
3360
+ degToRad as degToRad4,
3361
+ ffix as ffix12,
3362
+ pNumber as pNumber11,
3363
+ pCheckbox as pCheckbox7,
3364
+ pSectionSeparator as pSectionSeparator11,
3365
+ initGeom as initGeom11
3366
+ } from "geometrix";
3367
+ import {
3368
+ tJDir as tJDir3,
3369
+ tJSide as tJSide3,
3370
+ contourJ as contourJ3,
3371
+ facet as facet3,
3372
+ sheetFold as sheetFold3
3373
+ } from "sheetfold";
3374
+ var pDef11 = {
3375
+ partName: "springInt",
3376
+ params: [
3377
+ //pNumber(name, unit, init, min, max, step)
3378
+ pNumber11("D5", "mm", 140, 10, 5e3, 1),
3379
+ pNumber11("N5", "unit", 8, 3, 100, 1),
3380
+ pNumber11("W2", "mm", 20, 1, 200, 1),
3381
+ pSectionSeparator11("One unit"),
3382
+ pNumber11("D1", "mm", 16, 1, 100, 0.1),
3383
+ pNumber11("H1", "mm", 5, 1, 100, 1),
3384
+ pNumber11("H2", "mm", 15, 1, 100, 1),
3385
+ pNumber11("R2", "mm", 15, 1, 100, 1),
3386
+ pSectionSeparator11("Spring zone"),
3387
+ pCheckbox7("spring", true),
3388
+ pNumber11("E1", "mm", 2, 1, 100, 1),
3389
+ pNumber11("E2", "mm", 2, 1, 100, 1),
3390
+ pNumber11("smEy", "mm", 1, 0.1, 10, 0.1),
3391
+ pNumber11("shEy", "mm", 1, 0.1, 10, 0.1),
3392
+ pNumber11("shPr", "%", 90, 0, 99, 1),
3393
+ pNumber11("sNx", "xHoles", 2, 2, 200, 1),
3394
+ pNumber11("smEx", "mm", 1, 0.1, 10, 0.1),
3395
+ pNumber11("smExS", "mm", 0.5, 0.1, 10, 0.1),
3396
+ pSectionSeparator11("Folding"),
3397
+ pNumber11("Th", "mm", 1, 0.1, 10, 0.1),
3398
+ pNumber11("Jangle", "degree", 90, 0, 120, 1),
3399
+ pNumber11("Jradius", "mm", 2, 0.1, 10, 0.1),
3400
+ pNumber11("Jneutral", "%", 50, 0, 100, 1),
3401
+ pNumber11("Jmark", "mm", 1, 0.1, 10, 0.1)
3402
+ ],
3403
+ paramSvg: {
3404
+ D5: "springInt_global.svg",
3405
+ N5: "springInt_global.svg",
3406
+ W2: "springInt_global.svg",
3407
+ D1: "springInt_face.svg",
3408
+ H1: "springInt_face.svg",
3409
+ H2: "springInt_face.svg",
3410
+ R2: "springInt_face.svg",
3411
+ spring: "springInt_spring.svg",
3412
+ E1: "springInt_face.svg",
3413
+ E2: "springInt_face.svg",
3414
+ smEy: "springInt_spring.svg",
3415
+ shEy: "springInt_spring.svg",
3416
+ shPr: "springInt_spring.svg",
3417
+ sNx: "springInt_spring.svg",
3418
+ smEx: "springInt_spring.svg",
3419
+ smExS: "springInt_spring.svg",
3420
+ Th: "springInt_section.svg",
3421
+ Jangle: "springInt_face.svg",
3422
+ Jradius: "springInt_face.svg",
3423
+ Jneutral: "springInt_face.svg",
3424
+ Jmark: "springInt_face.svg"
3425
+ },
3426
+ sim: {
3427
+ tMax: 180,
3428
+ tStep: 0.5,
3429
+ tUpdate: 500
3430
+ // every 0.5 second
3431
+ }
3432
+ };
3433
+ function pGeom11(t, param, suffix = "") {
3434
+ const rGeome = initGeom11(pDef11.partName + suffix);
3435
+ rGeome.logstr += `${rGeome.partName} simTime: ${t}
3436
+ `;
3437
+ try {
3438
+ let makeSpringHollow2 = function(iLen) {
3439
+ const rCtr = contour12(0, 0).addCornerRounded(sRc).addSegStrokeR(iLen, 0).addCornerRounded(sRc).addSegStrokeR(0, param.shEy).addCornerRounded(sRc).addSegStrokeR(-iLen, 0).addCornerRounded(sRc).closeSegStroke();
3440
+ return rCtr;
3441
+ }, calcXref2 = function(iyRef, idx) {
3442
+ const cotan = cotanBAD;
3443
+ const cL = Li;
3444
+ const cy = iyRef - Hfoot - param.H1;
3445
+ const cx = cy < 0 ? cL : cL - 2 * cy * cotan;
3446
+ const cx0 = cL / 2 - cx / 2 + param.smExS;
3447
+ const nx = idx % 2 === 0 ? param.sNx + 1 : param.sNx;
3448
+ const lx = (cx - 2 * param.smExS + param.smEx) / (param.sNx + 1) - param.smEx;
3449
+ const lxAZpre = lx / 2 - param.smEx / 2;
3450
+ const lxAZ = idx % 2 === 0 ? lxAZpre : lx;
3451
+ if (lxAZ < 2 * sRc) {
3452
+ throw `err228: lxAZ ${ffix12(lxAZ)} is too small compare to ${param.sNx} or ${param.smEx}`;
3453
+ }
3454
+ return [cx0, lxAZ, lx, nx];
3455
+ }, makeCtrWall2 = function(iJb) {
3456
+ const Xad = xAD;
3457
+ const Yad = yAD;
3458
+ const rCtr = contourJ3(0, Hfoot).startJunction(iJb, tJDir3.eB, tJSide3.eABRight).addSegStrokeR(Li, 0).addSegStrokeR(0, param.H1).addSegStrokeR(-Xad, Yad).addPointA(Li / 2, Hwall + Hfoot).addPointA(Xad, param.H1 + Yad + Hfoot).addSegArc2().addSegStrokeR(-Xad, -Yad).closeSegStroke();
3459
+ return rCtr;
3460
+ }, makeFaBottom2 = function(iJb0, iJb1, iJl, iJr, iJcond) {
3461
+ const ctrBase = contourJ3(0, 0).startJunction(iJl, tJDir3.eA, tJSide3.eABLeft).addSegStrokeR(Li, 0).startJunction(iJb0, tJDir3.eA, tJSide3.eABLeft).addSegStrokeR(0, W1).startJunction(iJr, tJDir3.eA, tJSide3.eABLeft).addSegStrokeR(-Li, 0);
3462
+ if (iJcond) {
3463
+ ctrBase.startJunction(iJb1, tJDir3.eB, tJSide3.eABRight);
3464
+ }
3465
+ ctrBase.closeSegStroke();
3466
+ const ctrsHole = [];
3467
+ ctrsHole.push(contourCircle9(D3, D3, R3));
3468
+ ctrsHole.push(contourCircle9(Li - D3, D3, R3));
3469
+ ctrsHole.push(contourCircle9(D3, W1 - D3, R3));
3470
+ ctrsHole.push(contourCircle9(Li - D3, W1 - D3, R3));
3471
+ const rFa = facet3([ctrBase, ...ctrsHole]);
3472
+ return rFa;
3473
+ };
3474
+ var makeSpringHollow = makeSpringHollow2, calcXref = calcXref2, makeCtrWall = makeCtrWall2, makeFaBottom = makeFaBottom2;
3475
+ const aJa = degToRad4(param.Jangle);
3476
+ const aJn = param.Jneutral / 100;
3477
+ const aJr = param.Jradius;
3478
+ const aJm = param.Jmark;
3479
+ const Hfoot = aJr + (1 - aJn) * param.Th;
3480
+ const R5 = param.D5 / 2;
3481
+ const R5b = R5 - (Hfoot + param.H1 + param.H2);
3482
+ const a5 = 2 * Math.PI / param.N5;
3483
+ const a52 = a5 / 2;
3484
+ const Lii = 2 * R5b * Math.tan(a52);
3485
+ const Lm = aJr * Math.tan(a52);
3486
+ const Li = Lii - 2 * Lm;
3487
+ const W1 = param.W2 + 2 * param.Th - 2 * Hfoot;
3488
+ const R3 = W1 / 8;
3489
+ const D3 = 2 * R3;
3490
+ const Lih = Li / 2;
3491
+ const R1 = param.D1 / 2;
3492
+ const Hwall = param.H1 + param.H2 + param.R2;
3493
+ const aBAC = Math.atan2(param.H2, Lih);
3494
+ const lAC = Math.sqrt(Lih ** 2 + param.H2 ** 2);
3495
+ if (param.R2 > lAC) {
3496
+ throw `err141: R2 ${param.R2} is too large comapre to lAC ${ffix12(lAC)} mm`;
3497
+ }
3498
+ const aCAD = Math.asin(param.R2 / lAC);
3499
+ const lAD = lAC * Math.cos(aCAD);
3500
+ const xAD = lAD * Math.cos(aBAC + aCAD);
3501
+ const yAD = lAD * Math.sin(aBAC + aCAD);
3502
+ const cotanBAD = xAD / yAD;
3503
+ const sHeight = param.H1 + param.H2 - R1 - param.E1 - param.E2;
3504
+ const sStepY = param.smEy + param.shEy;
3505
+ const sNy = Math.floor((sHeight + param.smEy) / sStepY);
3506
+ const sRc = param.shEy * param.shPr / 200;
3507
+ if (R1 < 0.1) {
3508
+ throw `err087: R1 ${ffix12(R1)} is too small because of D1 ${param.D1}`;
3509
+ }
3510
+ if (param.R2 < R1 + 0.1) {
3511
+ throw `err150: R2 ${ffix12(param.R2)} is too small compare to R1 ${R1} mm`;
3512
+ }
3513
+ if (R5b < aJr) {
3514
+ throw `err154: R5b ${ffix12(R5b)} is too small because of H2 ${param.D2}, H1 ${param.H1} or Hfoot ${ffix12(Hfoot)}`;
3515
+ }
3516
+ if (Li < 0.1) {
3517
+ throw `err158: Li ${ffix12(Li)} is too small because of aJr ${ffix12(aJr)} radian`;
3518
+ }
3519
+ if (W1 < 0.1) {
3520
+ throw `err161: W1 ${ffix12(W1)} is too small because of Hfoot ${ffix12(Hfoot)} mm`;
3521
+ }
3522
+ if (Li < 3 * D3) {
3523
+ throw `err166: D3 ${ffix12(D3)} is too large compare to Li ${ffix12(Li)} mm`;
3524
+ }
3525
+ if (param.spring === 1) {
3526
+ if (sHeight < 0.1) {
3527
+ throw `err189: sHeight ${ffix12(sHeight)} is too small because of E1 ${param.E1} or E2 ${param.E2}`;
3528
+ }
3529
+ }
3530
+ rGeome.logstr += `Bearing holder wall: Hwall ${ffix12(Hwall)}, Hfoot ${ffix12(Hfoot)} mm
3531
+ `;
3532
+ rGeome.logstr += `Width of one unit: Lii ${ffix12(Lii)}, Li ${ffix12(Li)} mm
3533
+ `;
3534
+ rGeome.logstr += `Ratio R2/Li ${ffix12(100 * param.R2 / Lih)} %
3535
+ `;
3536
+ rGeome.logstr += `Width of bottom: W1 ${ffix12(W1)}, D3 ${ffix12(D3)} mm
3537
+ `;
3538
+ if (param.spring === 1) {
3539
+ rGeome.logstr += `spring: sNy ${sNy}, sRc ${ffix12(sRc)} mm
3540
+ `;
3541
+ } else {
3542
+ rGeome.logstr += `No spring
3543
+ `;
3544
+ }
3545
+ const sWi = [];
3546
+ if (param.spring === 1) {
3547
+ for (let jj = 0; jj < sNy; jj++) {
3548
+ const yy = Hfoot + param.E1 + jj * sStepY;
3549
+ const yRef = yy + param.shEy / 2;
3550
+ const [xRef, lxAZ, lx, nx] = calcXref2(yRef, jj);
3551
+ let xx = xRef;
3552
+ sWi.push(makeSpringHollow2(lxAZ).translate(xx, yy));
3553
+ xx += lxAZ + param.smEx;
3554
+ for (let ii = 0; ii < nx - 1; ii++) {
3555
+ sWi.push(makeSpringHollow2(lx).translate(xx, yy));
3556
+ xx += lx + param.smEx;
3557
+ }
3558
+ sWi.push(makeSpringHollow2(lxAZ).translate(xx, yy));
3559
+ }
3560
+ }
3561
+ const ctrAxisi = contourCircle9(Lih, Hfoot + param.H1 + param.H2, R1);
3562
+ const fas = [];
3563
+ const junction = {};
3564
+ for (let ii = 0; ii < param.N5; ii++) {
3565
+ const Jcond = ii < param.N5 - 1;
3566
+ fas.push(makeFaBottom2(`Jb${ii}`, `Jb${ii + 1}`, `Jl${ii}`, `Jr${ii}`, Jcond));
3567
+ const ctrL = makeCtrWall2(`Jl${ii}`);
3568
+ const ctrR = makeCtrWall2(`Jr${ii}`);
3569
+ fas.push(facet3([ctrL, ctrAxisi, ...sWi]));
3570
+ fas.push(facet3([ctrR, ctrAxisi, ...sWi]));
3571
+ junction[`Jb${ii}`] = { angle: -a5, radius: aJr, neutral: aJn, mark: aJm };
3572
+ junction[`Jl${ii}`] = { angle: aJa, radius: aJr, neutral: aJn, mark: aJm };
3573
+ junction[`Jr${ii}`] = { angle: aJa, radius: aJr, neutral: aJn, mark: aJm };
3574
+ }
3575
+ const postHalf = [];
3576
+ for (let ii = 1; ii < param.N5; ii++) {
3577
+ postHalf.push(...[`Jb${ii}`, Li]);
3578
+ }
3579
+ const sFold = sheetFold3(
3580
+ [...fas],
3581
+ {
3582
+ ...junction
3583
+ },
3584
+ [
3585
+ { x1: 0, y1: 0, a1: 0, l1: W1, ante: ["Jl0", Hwall], post: ["Jr0", Hwall] },
3586
+ { x1: 0, y1: -param.Th - param.W2, a1: 0, l1: Li, ante: ["Jb0"], post: postHalf }
3587
+ ],
3588
+ param.Th,
3589
+ rGeome.partName
3590
+ );
3591
+ const ffObj = sFold.makeFigures();
3592
+ for (const iFace of Object.keys(ffObj)) {
3593
+ rGeome.fig[iFace] = ffObj[iFace];
3594
+ }
3595
+ rGeome.vol = sFold.makeVolume();
3596
+ rGeome.sub = {};
3597
+ rGeome.logstr += "springInt drawn successfully!\n";
3598
+ rGeome.calcErr = false;
3599
+ } catch (emsg) {
3600
+ rGeome.logstr += emsg;
3601
+ console.log(emsg);
3602
+ }
3603
+ return rGeome;
3604
+ }
3605
+ var springIntDef = {
3606
+ pTitle: "springInt",
3607
+ pDescription: "bearing-holder in the interior of a ring",
3608
+ pDef: pDef11,
3609
+ pGeom: pGeom11
2157
3610
  };
2158
3611
  export {
2159
3612
  door1arcDef,
3613
+ houseDef,
2160
3614
  plugTorqueDef,
3615
+ springIntDef,
3616
+ springOneDef,
3617
+ springSideDef,
2161
3618
  springTorqueADef,
2162
3619
  springTorqueBDef,
2163
3620
  springTorqueCDef,
3621
+ springWormDef,
2164
3622
  stoneTowerDef
2165
3623
  };
2166
3624
  //# sourceMappingURL=index.js.map