desi77 0.1.14 → 0.1.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +7 -1
- package/dist/index.js +920 -105
- package/dist/pgdsvg/doubleBone_face.svg +1 -0
- package/dist/pgdsvg/doubleBone_folding.svg +1 -0
- package/dist/pgdsvg/doubleBone_side.svg +1 -0
- package/dist/pgdsvg/doubleBone_top.svg +1 -0
- package/dist/pgdsvg/pcar_front.svg +3 -0
- package/dist/pgdsvg/pcar_side.svg +1 -0
- package/dist/pgdsvg/pcar_top.svg +1 -0
- package/dist/pgdsvg/singleBone_face.svg +1 -0
- package/dist/pgdsvg/src_doubleBone.svg +1 -0
- package/dist/pgdsvg/src_pcar.svg +6 -0
- package/dist/pgdsvg/src_singleBone.svg +1 -0
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -4867,78 +4867,890 @@ var rccarDef = {
|
|
|
4867
4867
|
pGeom: pGeom13
|
|
4868
4868
|
};
|
|
4869
4869
|
|
|
4870
|
-
// src/
|
|
4870
|
+
// src/rccar/singleBone.ts
|
|
4871
4871
|
import {
|
|
4872
|
-
point as point8,
|
|
4873
4872
|
contour as contour15,
|
|
4874
4873
|
contourCircle as contourCircle12,
|
|
4875
|
-
ctrRectangle as ctrRectangle7,
|
|
4876
4874
|
figure as figure12,
|
|
4877
4875
|
ffix as ffix15,
|
|
4878
4876
|
pNumber as pNumber14,
|
|
4879
|
-
pCheckbox as pCheckbox9,
|
|
4880
|
-
pDropdown as pDropdown8,
|
|
4881
4877
|
pSectionSeparator as pSectionSeparator14,
|
|
4882
4878
|
EExtrude as EExtrude11,
|
|
4883
4879
|
EBVolume as EBVolume11,
|
|
4884
4880
|
initGeom as initGeom14
|
|
4885
4881
|
} from "geometrix";
|
|
4886
4882
|
var pDef14 = {
|
|
4883
|
+
partName: "singleBone",
|
|
4884
|
+
params: [
|
|
4885
|
+
//pNumber(name, unit, init, min, max, step)
|
|
4886
|
+
pNumber14("D1", "mm", 30, 1, 500, 1),
|
|
4887
|
+
pNumber14("D2", "mm", 70, 1, 500, 1),
|
|
4888
|
+
pNumber14("L1", "mm", 200, 10, 1e3, 1),
|
|
4889
|
+
pSectionSeparator14("Details"),
|
|
4890
|
+
pNumber14("R3", "mm", 50, 0, 1e3, 1),
|
|
4891
|
+
pNumber14("W1", "mm", 30, 1, 500, 1),
|
|
4892
|
+
pNumber14("T1", "mm", 10, 1, 100, 1),
|
|
4893
|
+
pSectionSeparator14("Holes"),
|
|
4894
|
+
pNumber14("P2", "%", 50, 0, 99, 1),
|
|
4895
|
+
pNumber14("W2", "mm", 10, 1, 500, 1)
|
|
4896
|
+
],
|
|
4897
|
+
paramSvg: {
|
|
4898
|
+
D1: "singleBone_face.svg",
|
|
4899
|
+
D2: "singleBone_face.svg",
|
|
4900
|
+
L1: "singleBone_face.svg",
|
|
4901
|
+
R3: "singleBone_face.svg",
|
|
4902
|
+
W1: "singleBone_face.svg",
|
|
4903
|
+
T1: "singleBone_face.svg",
|
|
4904
|
+
P2: "singleBone_face.svg",
|
|
4905
|
+
W2: "singleBone_face.svg"
|
|
4906
|
+
},
|
|
4907
|
+
sim: {
|
|
4908
|
+
tMax: 200,
|
|
4909
|
+
tStep: 0.5,
|
|
4910
|
+
tUpdate: 500
|
|
4911
|
+
// every 0.5 second
|
|
4912
|
+
}
|
|
4913
|
+
};
|
|
4914
|
+
function pGeom14(t, param, suffix = "") {
|
|
4915
|
+
const rGeome = initGeom14(pDef14.partName + suffix);
|
|
4916
|
+
const figBone = figure12();
|
|
4917
|
+
rGeome.logstr += `${rGeome.partName} simTime: ${t}
|
|
4918
|
+
`;
|
|
4919
|
+
try {
|
|
4920
|
+
const W12 = param.W1 / 2;
|
|
4921
|
+
const R12 = param.D1 / 2;
|
|
4922
|
+
const R22 = param.D2 / 2;
|
|
4923
|
+
const boneLen = param.L1 + 2 * R22;
|
|
4924
|
+
const dX2 = R22 ** 2 - W12 ** 2;
|
|
4925
|
+
if (dX2 < 0) {
|
|
4926
|
+
throw `err086: D2 ${ffix15(param.D2)} is too small compare to W1 ${ffix15(param.W1)} mm`;
|
|
4927
|
+
}
|
|
4928
|
+
const dX = Math.sqrt(dX2);
|
|
4929
|
+
const L1b = param.L1 - 2 * dX;
|
|
4930
|
+
const Rh = W12 * param.P2 / 100;
|
|
4931
|
+
const hX1 = param.W2 + 2 * Rh;
|
|
4932
|
+
const N2 = Math.max(Math.floor((param.L1 - 2 * R22 - param.W2) / hX1), 0);
|
|
4933
|
+
const W2b = (param.L1 - 2 * R22 - N2 * 2 * Rh) / (N2 + 1);
|
|
4934
|
+
const hX0b = R22 + W2b + Rh;
|
|
4935
|
+
const hX1b = W2b + 2 * Rh;
|
|
4936
|
+
if (R22 < R12) {
|
|
4937
|
+
throw `err085: D2 ${ffix15(param.D2)} is too small compare to D1 ${ffix15(param.D1)} mm`;
|
|
4938
|
+
}
|
|
4939
|
+
if (L1b < 0) {
|
|
4940
|
+
throw `err095: L1 ${ffix15(param.L1)} is too small compare to D2 ${ffix15(param.D2)} mm`;
|
|
4941
|
+
}
|
|
4942
|
+
rGeome.logstr += `Bone length ${ffix15(boneLen)} mm
|
|
4943
|
+
`;
|
|
4944
|
+
rGeome.logstr += `Bone with N2 ${N2} holes of diameter ${ffix15(2 * Rh)} mm
|
|
4945
|
+
`;
|
|
4946
|
+
rGeome.logstr += `Bone W2b ${ffix15(W2b)} mm
|
|
4947
|
+
`;
|
|
4948
|
+
const ctrBone = contour15(dX, W12).addCornerRounded(param.R3).addPointR(-dX - R22, -W12).addPointR(0, -2 * W12).addSegArc2().addCornerRounded(param.R3).addSegStrokeR(L1b, 0).addCornerRounded(param.R3).addPointR(dX + R22, W12).addPointR(0, 2 * W12).addSegArc2().addCornerRounded(param.R3).closeSegStroke();
|
|
4949
|
+
const ctrAxis1 = contourCircle12(0, 0, R12);
|
|
4950
|
+
const ctrAxis2 = contourCircle12(param.L1, 0, R12);
|
|
4951
|
+
const ctrMinis = [];
|
|
4952
|
+
if (Rh > 0) {
|
|
4953
|
+
for (let ii = 0; ii < N2; ii++) {
|
|
4954
|
+
ctrMinis.push(contourCircle12(hX0b + ii * hX1b, 0, Rh));
|
|
4955
|
+
}
|
|
4956
|
+
}
|
|
4957
|
+
figBone.addMainOI([ctrBone, ctrAxis1, ctrAxis2, ...ctrMinis]);
|
|
4958
|
+
rGeome.fig = {
|
|
4959
|
+
faceBone: figBone
|
|
4960
|
+
};
|
|
4961
|
+
const designName = rGeome.partName;
|
|
4962
|
+
rGeome.vol = {
|
|
4963
|
+
extrudes: [
|
|
4964
|
+
{
|
|
4965
|
+
outName: `subpax_${designName}_bone`,
|
|
4966
|
+
face: `${designName}_faceBone`,
|
|
4967
|
+
extrudeMethod: EExtrude11.eLinearOrtho,
|
|
4968
|
+
length: param.T1,
|
|
4969
|
+
rotate: [0, 0, 0],
|
|
4970
|
+
translate: [0, 0, 0]
|
|
4971
|
+
}
|
|
4972
|
+
],
|
|
4973
|
+
volumes: [
|
|
4974
|
+
{
|
|
4975
|
+
outName: `pax_${designName}`,
|
|
4976
|
+
boolMethod: EBVolume11.eIdentity,
|
|
4977
|
+
inList: [`subpax_${designName}_bone`]
|
|
4978
|
+
}
|
|
4979
|
+
]
|
|
4980
|
+
};
|
|
4981
|
+
rGeome.sub = {};
|
|
4982
|
+
rGeome.logstr += "singleBone drawn successfully!\n";
|
|
4983
|
+
rGeome.calcErr = false;
|
|
4984
|
+
} catch (emsg) {
|
|
4985
|
+
rGeome.logstr += emsg;
|
|
4986
|
+
console.log(emsg);
|
|
4987
|
+
}
|
|
4988
|
+
return rGeome;
|
|
4989
|
+
}
|
|
4990
|
+
var singleBoneDef = {
|
|
4991
|
+
pTitle: "singleBone",
|
|
4992
|
+
pDescription: "detailed design of the suspension bone of the rccar",
|
|
4993
|
+
pDef: pDef14,
|
|
4994
|
+
pGeom: pGeom14
|
|
4995
|
+
};
|
|
4996
|
+
|
|
4997
|
+
// src/rccar/doubleBone.ts
|
|
4998
|
+
import {
|
|
4999
|
+
contourCircle as contourCircle13,
|
|
5000
|
+
degToRad as degToRad7,
|
|
5001
|
+
ffix as ffix16,
|
|
5002
|
+
pNumber as pNumber15,
|
|
5003
|
+
pSectionSeparator as pSectionSeparator15,
|
|
5004
|
+
initGeom as initGeom15
|
|
5005
|
+
} from "geometrix";
|
|
5006
|
+
import {
|
|
5007
|
+
tJDir as tJDir4,
|
|
5008
|
+
tJSide as tJSide4,
|
|
5009
|
+
contourJ as contourJ4,
|
|
5010
|
+
facet as facet4,
|
|
5011
|
+
sheetFold as sheetFold4
|
|
5012
|
+
} from "sheetfold";
|
|
5013
|
+
var pDef15 = {
|
|
5014
|
+
partName: "doubleBone",
|
|
5015
|
+
params: [
|
|
5016
|
+
//pNumber(name, unit, init, min, max, step)
|
|
5017
|
+
pNumber15("D1", "mm", 30, 1, 500, 1),
|
|
5018
|
+
pNumber15("D2", "mm", 70, 1, 500, 1),
|
|
5019
|
+
pNumber15("L1", "mm", 300, 10, 1e3, 1),
|
|
5020
|
+
pNumber15("L2", "mm", 200, 10, 1e3, 1),
|
|
5021
|
+
pNumber15("E1", "mm", 40, 1, 1e3, 1),
|
|
5022
|
+
pSectionSeparator15("Side"),
|
|
5023
|
+
pNumber15("W1", "mm", 30, 1, 500, 1),
|
|
5024
|
+
pNumber15("P2", "%", 50, 0, 99, 1),
|
|
5025
|
+
pNumber15("W2", "mm", 10, 1, 500, 1),
|
|
5026
|
+
pSectionSeparator15("Top"),
|
|
5027
|
+
pNumber15("S1", "mm", 20, 1, 100, 1),
|
|
5028
|
+
pNumber15("S2", "mm", 20, 1, 100, 1),
|
|
5029
|
+
pNumber15("S3", "mm", 20, 1, 100, 1),
|
|
5030
|
+
pNumber15("R3", "mm", 10, 0, 1e3, 1),
|
|
5031
|
+
pSectionSeparator15("Wing width"),
|
|
5032
|
+
pNumber15("P11", "%", 8, 0, 90, 1),
|
|
5033
|
+
pNumber15("P12", "%", 20, 0, 90, 1),
|
|
5034
|
+
pNumber15("P21", "%", 18, 0, 90, 1),
|
|
5035
|
+
pNumber15("P22", "%", 20, 0, 90, 1),
|
|
5036
|
+
pSectionSeparator15("Folding"),
|
|
5037
|
+
pNumber15("T1", "mm", 2, 0.5, 10, 0.1),
|
|
5038
|
+
pNumber15("Jangle", "degree", 90, 30, 120, 1),
|
|
5039
|
+
pNumber15("Jradius", "mm", 10, 0.1, 50, 0.1),
|
|
5040
|
+
pNumber15("Jneutral", "%", 50, 0, 100, 1),
|
|
5041
|
+
pNumber15("Jmark", "mm", 2, 0.1, 10, 0.1),
|
|
5042
|
+
pNumber15("Jradius2", "mm", 4, 0.1, 50, 0.1),
|
|
5043
|
+
pNumber15("Jmark2", "mm", 2, 0.1, 10, 0.1)
|
|
5044
|
+
],
|
|
5045
|
+
paramSvg: {
|
|
5046
|
+
D1: "doubleBone_face.svg",
|
|
5047
|
+
D2: "doubleBone_face.svg",
|
|
5048
|
+
L1: "doubleBone_face.svg",
|
|
5049
|
+
L2: "doubleBone_top.svg",
|
|
5050
|
+
E1: "doubleBone_top.svg",
|
|
5051
|
+
W1: "doubleBone_face.svg",
|
|
5052
|
+
P2: "doubleBone_side.svg",
|
|
5053
|
+
W2: "doubleBone_side.svg",
|
|
5054
|
+
S1: "doubleBone_top.svg",
|
|
5055
|
+
S2: "doubleBone_top.svg",
|
|
5056
|
+
S3: "doubleBone_top.svg",
|
|
5057
|
+
R3: "doubleBone_side.svg",
|
|
5058
|
+
P11: "doubleBone_top.svg",
|
|
5059
|
+
P12: "doubleBone_top.svg",
|
|
5060
|
+
P21: "doubleBone_top.svg",
|
|
5061
|
+
P22: "doubleBone_top.svg",
|
|
5062
|
+
T1: "doubleBone_folding.svg",
|
|
5063
|
+
Jangle: "doubleBone_folding.svg",
|
|
5064
|
+
Jradius: "doubleBone_folding.svg",
|
|
5065
|
+
Jneutral: "doubleBone_folding.svg",
|
|
5066
|
+
Jmark: "doubleBone_folding.svg",
|
|
5067
|
+
Jradius2: "doubleBone_folding.svg",
|
|
5068
|
+
Jmark2: "doubleBone_folding.svg"
|
|
5069
|
+
},
|
|
5070
|
+
sim: {
|
|
5071
|
+
tMax: 200,
|
|
5072
|
+
tStep: 0.5,
|
|
5073
|
+
tUpdate: 500
|
|
5074
|
+
// every 0.5 second
|
|
5075
|
+
}
|
|
5076
|
+
};
|
|
5077
|
+
function pGeom15(t, param, suffix = "") {
|
|
5078
|
+
const rGeome = initGeom15(pDef15.partName + suffix);
|
|
5079
|
+
rGeome.logstr += `${rGeome.partName} simTime: ${t}
|
|
5080
|
+
`;
|
|
5081
|
+
try {
|
|
5082
|
+
let calcInnerTri2 = function(iW, iH, iDW) {
|
|
5083
|
+
const rA = Math.atan2(iH, iW);
|
|
5084
|
+
const rInitDist = iDW / Math.sin(rA);
|
|
5085
|
+
return [rA, rInitDist];
|
|
5086
|
+
}, calcSplitTri2 = function(iL, iP) {
|
|
5087
|
+
if (iL < 0) {
|
|
5088
|
+
throw `err559: iL ${ffix16(iL)} is negative mm`;
|
|
5089
|
+
}
|
|
5090
|
+
let rLside = iL;
|
|
5091
|
+
let rLcenter = 0;
|
|
5092
|
+
if (iP > 0) {
|
|
5093
|
+
const pr = iP / 100;
|
|
5094
|
+
rLcenter = pr * iL;
|
|
5095
|
+
rLside = (iL - rLcenter) / 2;
|
|
5096
|
+
}
|
|
5097
|
+
return [rLside, rLcenter];
|
|
5098
|
+
}, makeCtrBone2 = function(iJ1, iJ2) {
|
|
5099
|
+
const rCtr = contourJ4(dX, W12).addPointR(-dX - R22, -W12).addPointR(0, -2 * W12).addSegArc2().startJunction(iJ1, tJDir4.eA, tJSide4.eABLeft).addSegStrokeR(L1b, 0).addPointR(dX + R22, W12).addPointR(0, 2 * W12).addSegArc2().startJunction(iJ2, tJDir4.eB, tJSide4.eABRight).closeSegStroke();
|
|
5100
|
+
return rCtr;
|
|
5101
|
+
}, makeCtrPlate2 = function(iJ1, iJ2, idx) {
|
|
5102
|
+
const tJ1 = `J${idx}1`;
|
|
5103
|
+
const tJ2 = `J${idx}2`;
|
|
5104
|
+
const rCtr = contourJ4(0, 0).addSegStrokeR(L2d, 0).startJunction(tJ1, tJDir4.eA, tJSide4.eABLeft).addSegStrokeR(L2c, 0).addSegStrokeR(L2d, 0);
|
|
5105
|
+
if (iJ2 !== "") {
|
|
5106
|
+
rCtr.startJunction(iJ2, tJDir4.eA, tJSide4.eABLeft);
|
|
5107
|
+
}
|
|
5108
|
+
rCtr.addSegStrokeR(0, L1b).addSegStrokeR(-L2d, 0).startJunction(tJ2, tJDir4.eA, tJSide4.eABLeft).addSegStrokeR(-L2c, 0).addSegStrokeR(-L2d, 0).startJunction(iJ1, tJDir4.eB, tJSide4.eABRight).closeSegStroke();
|
|
5109
|
+
return rCtr;
|
|
5110
|
+
}, makeCtrTri2 = function(jn, x0, y0, r0, ia, t1s, t1c, t2s, t2c) {
|
|
5111
|
+
const ctr = contourJ4(x0, y0).addCornerRounded(param.R3).addSegStrokeR(t1s, 0);
|
|
5112
|
+
if (t1c > 0) {
|
|
5113
|
+
ctr.startJunction(`${jn}1`, tJDir4.eA, tJSide4.eABRight).addSegStrokeR(t1c, 0).addSegStrokeR(t1s, 0);
|
|
5114
|
+
}
|
|
5115
|
+
const a2 = pi - ia;
|
|
5116
|
+
ctr.addCornerRounded(param.R3).addSegStrokeRP(a2, t2s);
|
|
5117
|
+
if (t2c > 0) {
|
|
5118
|
+
ctr.startJunction(`${jn}2`, tJDir4.eA, tJSide4.eABRight).addSegStrokeRP(a2, t2c).addSegStrokeRP(a2, t2s);
|
|
5119
|
+
}
|
|
5120
|
+
const a3 = pi + ia;
|
|
5121
|
+
ctr.addCornerRounded(param.R3).addSegStrokeRP(a3, t2s);
|
|
5122
|
+
if (t2c > 0) {
|
|
5123
|
+
ctr.startJunction(`${jn}3`, tJDir4.eA, tJSide4.eABRight).addSegStrokeRP(a3, t2c).addSegStrokeRP(a3, t2s);
|
|
5124
|
+
}
|
|
5125
|
+
const rCtr = ctr.rotate(x0, y0, r0);
|
|
5126
|
+
return rCtr;
|
|
5127
|
+
}, makeCtrSide2 = function(iJ1) {
|
|
5128
|
+
const rCtr = contourJ4(0, 0).addSegStrokeR(L2c, 0).addSegStrokeR(0, param.W1).startJunction(iJ1, tJDir4.eB, tJSide4.eABRight).addSegStrokeR(-L2c, 0).closeSegStroke();
|
|
5129
|
+
return rCtr;
|
|
5130
|
+
};
|
|
5131
|
+
var calcInnerTri = calcInnerTri2, calcSplitTri = calcSplitTri2, makeCtrBone = makeCtrBone2, makeCtrPlate = makeCtrPlate2, makeCtrTri = makeCtrTri2, makeCtrSide = makeCtrSide2;
|
|
5132
|
+
const pi = Math.PI;
|
|
5133
|
+
const pi2 = pi / 2;
|
|
5134
|
+
const W1 = param.W1;
|
|
5135
|
+
const W12 = W1 / 2;
|
|
5136
|
+
const R12 = param.D1 / 2;
|
|
5137
|
+
const R22 = param.D2 / 2;
|
|
5138
|
+
const boneLen = param.L1 + 2 * R22;
|
|
5139
|
+
const dX2 = R22 ** 2 - W12 ** 2;
|
|
5140
|
+
if (dX2 < 0) {
|
|
5141
|
+
throw `err086: D2 ${ffix16(param.D2)} is too small compare to W1 ${ffix16(param.W1)} mm`;
|
|
5142
|
+
}
|
|
5143
|
+
const dX = Math.sqrt(dX2);
|
|
5144
|
+
const L1b = param.L1 - 2 * dX;
|
|
5145
|
+
const Rh = W12 * param.P2 / 100;
|
|
5146
|
+
const hX1 = param.W2 + 2 * Rh;
|
|
5147
|
+
const N2 = Math.max(Math.floor((param.L1 - 2 * R22 - param.W2) / hX1), 0);
|
|
5148
|
+
const W2b = (param.L1 - 2 * R22 - N2 * 2 * Rh) / (N2 + 1);
|
|
5149
|
+
const hX0b = R22 + W2b + Rh;
|
|
5150
|
+
const hX1b = W2b + 2 * Rh;
|
|
5151
|
+
const aJa = degToRad7(param.Jangle);
|
|
5152
|
+
const aJn = param.Jneutral / 100;
|
|
5153
|
+
const aJr = param.Jradius;
|
|
5154
|
+
const aJm = param.Jmark;
|
|
5155
|
+
const aJr2 = param.Jradius2;
|
|
5156
|
+
const aJm2 = param.Jmark2;
|
|
5157
|
+
const cornerSizeExt = aJr + param.T1 * (1 - aJa);
|
|
5158
|
+
const cornerSizeInt = aJr - param.T1 * aJa;
|
|
5159
|
+
const cornerSizeInt2 = aJr2 - param.T1 * aJa;
|
|
5160
|
+
const L2b = param.L2 - 2 * cornerSizeExt;
|
|
5161
|
+
const L2c = L2b + 2 * cornerSizeInt - 2 * param.E1;
|
|
5162
|
+
const L2d = (L2b - L2c) / 2;
|
|
5163
|
+
const N2c = Math.max(Math.floor((L2c - param.W2) / hX1), 0);
|
|
5164
|
+
const W2c = (L2c - N2c * 2 * Rh) / (N2c + 1);
|
|
5165
|
+
const hX0c = W2c + Rh;
|
|
5166
|
+
const hX1c = W2c + 2 * Rh;
|
|
5167
|
+
const L1i = L1b - 2 * param.S2;
|
|
5168
|
+
const L2i = L2b - 2 * param.S1;
|
|
5169
|
+
const [tri1a, tri1d0] = calcInnerTri2(L2i, L1i, param.S3 / 2);
|
|
5170
|
+
const tri11L = L2i - 2 * tri1d0;
|
|
5171
|
+
const [tri2a, tri2d0] = calcInnerTri2(L1i, L2i, param.S3 / 2);
|
|
5172
|
+
const tri21L = L1i - 2 * tri2d0;
|
|
5173
|
+
const [tri11s, tri11c] = calcSplitTri2(tri11L, param.P11);
|
|
5174
|
+
const tri12L = tri11L / (2 * Math.cos(tri1a));
|
|
5175
|
+
const [tri12s, tri12c] = calcSplitTri2(tri12L, param.P12);
|
|
5176
|
+
const [tri21s, tri21c] = calcSplitTri2(tri21L, param.P21);
|
|
5177
|
+
const tri22L = tri21L / (2 * Math.cos(tri2a));
|
|
5178
|
+
const [tri22s, tri22c] = calcSplitTri2(tri22L, param.P22);
|
|
5179
|
+
const wingH = param.W1 / 2 + cornerSizeInt - cornerSizeInt2;
|
|
5180
|
+
if (R22 < R12) {
|
|
5181
|
+
throw `err085: D2 ${ffix16(param.D2)} is too small compare to D1 ${ffix16(param.D1)} mm`;
|
|
5182
|
+
}
|
|
5183
|
+
if (L1b < 0) {
|
|
5184
|
+
throw `err095: L1 ${ffix16(param.L1)} is too small compare to D2 ${ffix16(param.D2)} mm`;
|
|
5185
|
+
}
|
|
5186
|
+
if (param.E1 < cornerSizeInt) {
|
|
5187
|
+
throw `err151: E1 ${ffix16(param.E1)} is too small compare to Jradius ${ffix16(param.Jradius)} mm`;
|
|
5188
|
+
}
|
|
5189
|
+
if (L2c < 0) {
|
|
5190
|
+
throw `err150: L2 ${ffix16(param.L2)} is too small compare to E1 ${ffix16(param.E1)} mm`;
|
|
5191
|
+
}
|
|
5192
|
+
rGeome.logstr += `Bone length ${ffix16(boneLen)} mm
|
|
5193
|
+
`;
|
|
5194
|
+
rGeome.logstr += `Bone with N2 ${N2} holes of diameter ${ffix16(2 * Rh)} and W2b ${ffix16(W2b)} mm
|
|
5195
|
+
`;
|
|
5196
|
+
rGeome.logstr += `Side with N2c ${N2c} holes of diameter ${ffix16(2 * Rh)} and W2c ${ffix16(W2c)} mm
|
|
5197
|
+
`;
|
|
5198
|
+
const ctrAxis1 = contourCircle13(0, 0, R12);
|
|
5199
|
+
const ctrAxis2 = contourCircle13(param.L1, 0, R12);
|
|
5200
|
+
const ctrMinis = [];
|
|
5201
|
+
if (Rh > 0) {
|
|
5202
|
+
for (let ii = 0; ii < N2; ii++) {
|
|
5203
|
+
ctrMinis.push(contourCircle13(hX0b + ii * hX1b, 0, Rh));
|
|
5204
|
+
}
|
|
5205
|
+
}
|
|
5206
|
+
const ctrBone1 = makeCtrBone2("J1", "J2");
|
|
5207
|
+
const ctrBone2 = makeCtrBone2("J3", "J4");
|
|
5208
|
+
const faBone1 = facet4([ctrBone1, ctrAxis1, ctrAxis2, ...ctrMinis]);
|
|
5209
|
+
const faBone2 = facet4([ctrBone2, ctrAxis1, ctrAxis2, ...ctrMinis]);
|
|
5210
|
+
const ctrPlate1 = makeCtrPlate2("J1", "", 1);
|
|
5211
|
+
const ctrPlate2 = makeCtrPlate2("J3", "J2", 2);
|
|
5212
|
+
const x04 = param.S1 + tri1d0;
|
|
5213
|
+
const y04 = param.S2;
|
|
5214
|
+
const ctrTri14 = makeCtrTri2("J14", x04, y04, 0, tri1a, tri11s, tri11c, tri12s, tri12c);
|
|
5215
|
+
const ctrTri24 = makeCtrTri2("J24", x04, y04, 0, tri1a, tri11s, tri11c, tri12s, tri12c);
|
|
5216
|
+
const x02 = L2b - param.S1 - tri1d0;
|
|
5217
|
+
const y02 = L1b - param.S2;
|
|
5218
|
+
const ctrTri12 = makeCtrTri2("J12", x02, y02, pi, tri1a, tri11s, tri11c, tri12s, tri12c);
|
|
5219
|
+
const ctrTri22 = makeCtrTri2("J22", x02, y02, pi, tri1a, tri11s, tri11c, tri12s, tri12c);
|
|
5220
|
+
const x01 = L2b - param.S1;
|
|
5221
|
+
const y01 = param.S2 + tri2d0;
|
|
5222
|
+
const ctrTri11 = makeCtrTri2("J11", x01, y01, pi2, tri2a, tri21s, tri21c, tri22s, tri22c);
|
|
5223
|
+
const ctrTri21 = makeCtrTri2("J21", x01, y01, pi2, tri2a, tri21s, tri21c, tri22s, tri22c);
|
|
5224
|
+
const x03 = param.S1;
|
|
5225
|
+
const y03 = L1b - param.S2 - tri2d0;
|
|
5226
|
+
const ctrTri13 = makeCtrTri2("J13", x03, y03, -pi2, tri2a, tri21s, tri21c, tri22s, tri22c);
|
|
5227
|
+
const ctrTri23 = makeCtrTri2("J23", x03, y03, -pi2, tri2a, tri21s, tri21c, tri22s, tri22c);
|
|
5228
|
+
const faPlate1 = facet4([ctrPlate1, ctrTri14, ctrTri12, ctrTri11, ctrTri13]);
|
|
5229
|
+
const faPlate2 = facet4([ctrPlate2, ctrTri24, ctrTri22, ctrTri21, ctrTri23]);
|
|
5230
|
+
const ctrMinics = [];
|
|
5231
|
+
if (Rh > 0) {
|
|
5232
|
+
for (let ii = 0; ii < N2c; ii++) {
|
|
5233
|
+
ctrMinics.push(contourCircle13(hX0c + ii * hX1c, W12, Rh));
|
|
5234
|
+
}
|
|
5235
|
+
}
|
|
5236
|
+
const faSide1 = facet4([makeCtrSide2("J11"), ...ctrMinics]);
|
|
5237
|
+
const faSide2 = facet4([makeCtrSide2("J12"), ...ctrMinics]);
|
|
5238
|
+
const Jwings = [];
|
|
5239
|
+
const faWings = [];
|
|
5240
|
+
const tri13 = [tri21c, tri22c, tri22c];
|
|
5241
|
+
const tri24 = [tri11c, tri12c, tri12c];
|
|
5242
|
+
for (let i1 = 0; i1 < 2; i1++) {
|
|
5243
|
+
for (let i2 = 0; i2 < 4; i2++) {
|
|
5244
|
+
for (let i3 = 0; i3 < 3; i3++) {
|
|
5245
|
+
const jN = `J${i1 + 1}${i2 + 1}${i3 + 1}`;
|
|
5246
|
+
Jwings.push(jN);
|
|
5247
|
+
const triParity = i2 % 2;
|
|
5248
|
+
const triC = triParity === 1 ? tri24 : tri13;
|
|
5249
|
+
const lc = triC[i3];
|
|
5250
|
+
if (lc > 0) {
|
|
5251
|
+
const ctrJ = contourJ4(0, 0).addSegStrokeR(lc, 0).addSegStrokeR(0, wingH).startJunction(jN, tJDir4.eA, tJSide4.eABLeft).addSegStrokeR(-lc, 0).closeSegStroke();
|
|
5252
|
+
faWings.push(facet4([ctrJ]));
|
|
5253
|
+
}
|
|
5254
|
+
}
|
|
5255
|
+
}
|
|
5256
|
+
}
|
|
5257
|
+
const Jbase = ["J1", "J2", "J3", "J4", "J11", "J12", "J21", "J22"];
|
|
5258
|
+
const Jdef = { angle: aJa, radius: aJr, neutral: aJn, mark: aJm };
|
|
5259
|
+
const Jdef2 = { angle: aJa, radius: aJr2, neutral: aJn, mark: aJm2 };
|
|
5260
|
+
const juncs = {};
|
|
5261
|
+
for (const iJ of Jbase) {
|
|
5262
|
+
juncs[iJ] = Jdef;
|
|
5263
|
+
}
|
|
5264
|
+
for (const iJ of Jwings) {
|
|
5265
|
+
juncs[iJ] = Jdef2;
|
|
5266
|
+
}
|
|
5267
|
+
const half1A = ["J1", L2b, "J2", W1, "J3", L2b];
|
|
5268
|
+
const half2A = ["J11", W1, "J21", L1b];
|
|
5269
|
+
const half2P = ["J12", W1, "J22"];
|
|
5270
|
+
const sFold = sheetFold4(
|
|
5271
|
+
[faBone1, faPlate1, faPlate2, faBone2, faSide1, faSide2, ...faWings],
|
|
5272
|
+
juncs,
|
|
5273
|
+
[
|
|
5274
|
+
{ x1: 0, y1: 0, a1: 0, l1: W1, ante: half1A, post: ["J4"] },
|
|
5275
|
+
//{ x1: 2 * W1, y1: 0, a1: 0, l1: W1, ante: half3A, post: half3P },
|
|
5276
|
+
{ x1: 4 * W1, y1: 0, a1: 0, l1: L1b, ante: half2A, post: half2P }
|
|
5277
|
+
],
|
|
5278
|
+
param.T1,
|
|
5279
|
+
rGeome.partName
|
|
5280
|
+
);
|
|
5281
|
+
rGeome.fig = sFold.makeFigures();
|
|
5282
|
+
rGeome.vol = sFold.makeVolume();
|
|
5283
|
+
rGeome.sub = {};
|
|
5284
|
+
rGeome.logstr += "doubleBone drawn successfully!\n";
|
|
5285
|
+
rGeome.calcErr = false;
|
|
5286
|
+
} catch (emsg) {
|
|
5287
|
+
rGeome.logstr += emsg;
|
|
5288
|
+
console.log(emsg);
|
|
5289
|
+
}
|
|
5290
|
+
return rGeome;
|
|
5291
|
+
}
|
|
5292
|
+
var doubleBoneDef = {
|
|
5293
|
+
pTitle: "doubleBone",
|
|
5294
|
+
pDescription: "combined suspension bones of the rccar",
|
|
5295
|
+
pDef: pDef15,
|
|
5296
|
+
pGeom: pGeom15
|
|
5297
|
+
};
|
|
5298
|
+
|
|
5299
|
+
// src/rccar/pcar.ts
|
|
5300
|
+
import {
|
|
5301
|
+
contour as contour16,
|
|
5302
|
+
contourCircle as contourCircle14,
|
|
5303
|
+
figure as figure13,
|
|
5304
|
+
ffix as ffix17,
|
|
5305
|
+
pNumber as pNumber16,
|
|
5306
|
+
pSectionSeparator as pSectionSeparator16,
|
|
5307
|
+
EExtrude as EExtrude12,
|
|
5308
|
+
EBVolume as EBVolume12,
|
|
5309
|
+
initGeom as initGeom16
|
|
5310
|
+
} from "geometrix";
|
|
5311
|
+
var pDef16 = {
|
|
5312
|
+
partName: "pcar",
|
|
5313
|
+
params: [
|
|
5314
|
+
//pNumber(name, unit, init, min, max, step)
|
|
5315
|
+
pNumber16("LB1", "mm", 1e3, 100, 4e3, 1),
|
|
5316
|
+
pNumber16("LB2", "mm", 3e3, 100, 8e3, 1),
|
|
5317
|
+
pNumber16("LB3", "mm", 1e3, 100, 4e3, 1),
|
|
5318
|
+
pNumber16("LT1", "mm", 800, 100, 4e3, 1),
|
|
5319
|
+
pNumber16("LT3", "mm", 1200, 100, 4e3, 1),
|
|
5320
|
+
pNumber16("LT4", "mm", 1600, 100, 4e3, 1),
|
|
5321
|
+
pNumber16("HF1", "mm", 900, 100, 3e3, 1),
|
|
5322
|
+
pNumber16("HF3", "mm", 600, 100, 3e3, 1),
|
|
5323
|
+
pNumber16("HF4", "mm", 300, 100, 3e3, 1),
|
|
5324
|
+
pNumber16("HB1", "mm", 800, 100, 3e3, 1),
|
|
5325
|
+
pSectionSeparator16("Wheels"),
|
|
5326
|
+
pNumber16("HW1", "mm", 200, -1e3, 1e3, 1),
|
|
5327
|
+
pNumber16("DW1", "mm", 100, 1, 500, 1),
|
|
5328
|
+
pNumber16("DW2", "mm", 600, 1, 2e3, 1),
|
|
5329
|
+
pNumber16("DW3", "mm", 800, 1, 2e3, 1),
|
|
5330
|
+
pNumber16("WW1", "mm", 300, 1, 1e3, 1),
|
|
5331
|
+
pNumber16("WW2", "mm", 200, 1, 1e3, 1),
|
|
5332
|
+
pNumber16("RW2", "mm", 50, 1, 1e3, 1),
|
|
5333
|
+
pSectionSeparator16("Side"),
|
|
5334
|
+
pNumber16("C1", "mm", 50, 1, 500, 1),
|
|
5335
|
+
pNumber16("C2", "mm", 100, 1, 500, 1),
|
|
5336
|
+
pNumber16("C3", "mm", 50, 1, 500, 1),
|
|
5337
|
+
pNumber16("C4", "mm", 50, 1, 500, 1),
|
|
5338
|
+
pNumber16("Rs1", "mm", 100, 1, 2e3, 1),
|
|
5339
|
+
pNumber16("Rs2", "mm", 100, 1, 2e3, 1),
|
|
5340
|
+
pNumber16("Rs3", "mm", 100, 1, 2e3, 1),
|
|
5341
|
+
pNumber16("Rs4", "mm", 100, 1, 2e3, 1),
|
|
5342
|
+
pNumber16("Rs5", "mm", 100, 1, 2e3, 1),
|
|
5343
|
+
pNumber16("Rs6", "mm", 500, 1, 2e3, 1),
|
|
5344
|
+
pNumber16("Rs7", "mm", 100, 1, 2e3, 1),
|
|
5345
|
+
pSectionSeparator16("Top"),
|
|
5346
|
+
pNumber16("Wt1", "mm", 600, 1, 2e3, 1),
|
|
5347
|
+
pNumber16("Wt2", "mm", 800, 1, 2e3, 1),
|
|
5348
|
+
pNumber16("Ct1", "mm", 50, 1, 500, 1),
|
|
5349
|
+
pNumber16("Ct2", "mm", 50, 1, 500, 1),
|
|
5350
|
+
pNumber16("Ct3", "mm", 50, 1, 500, 1),
|
|
5351
|
+
pNumber16("Rt1", "mm", 100, 1, 2e3, 1),
|
|
5352
|
+
pNumber16("Rt2", "mm", 400, 1, 2e3, 1),
|
|
5353
|
+
pSectionSeparator16("Front"),
|
|
5354
|
+
pNumber16("Wf1", "mm", 800, 1, 2e3, 1),
|
|
5355
|
+
pNumber16("Wf2", "mm", 300, 1, 1e3, 1),
|
|
5356
|
+
pNumber16("Cf1", "mm", 50, 1, 500, 1),
|
|
5357
|
+
pNumber16("Cf2", "mm", 50, 1, 500, 1),
|
|
5358
|
+
pNumber16("Cf3", "mm", 50, 1, 500, 1),
|
|
5359
|
+
pNumber16("Rf1", "mm", 100, 1, 2e3, 1),
|
|
5360
|
+
pNumber16("Rf2", "mm", 100, 1, 2e3, 1),
|
|
5361
|
+
pNumber16("Rf3", "mm", 100, 1, 2e3, 1)
|
|
5362
|
+
],
|
|
5363
|
+
paramSvg: {
|
|
5364
|
+
LB1: "pcar_side.svg",
|
|
5365
|
+
LB2: "pcar_side.svg",
|
|
5366
|
+
LB3: "pcar_side.svg",
|
|
5367
|
+
LT1: "pcar_side.svg",
|
|
5368
|
+
LT3: "pcar_side.svg",
|
|
5369
|
+
LT4: "pcar_side.svg",
|
|
5370
|
+
HF1: "pcar_side.svg",
|
|
5371
|
+
HF3: "pcar_side.svg",
|
|
5372
|
+
HF4: "pcar_side.svg",
|
|
5373
|
+
HB1: "pcar_side.svg",
|
|
5374
|
+
HW1: "pcar_side.svg",
|
|
5375
|
+
DW1: "pcar_side.svg",
|
|
5376
|
+
DW2: "pcar_side.svg",
|
|
5377
|
+
DW3: "pcar_side.svg",
|
|
5378
|
+
WW1: "pcar_front.svg",
|
|
5379
|
+
WW2: "pcar_front.svg",
|
|
5380
|
+
RW2: "pcar_front.svg",
|
|
5381
|
+
C1: "pcar_side.svg",
|
|
5382
|
+
C2: "pcar_side.svg",
|
|
5383
|
+
C3: "pcar_side.svg",
|
|
5384
|
+
C4: "pcar_side.svg",
|
|
5385
|
+
Rs1: "pcar_side.svg",
|
|
5386
|
+
Rs2: "pcar_side.svg",
|
|
5387
|
+
Rs3: "pcar_side.svg",
|
|
5388
|
+
Rs4: "pcar_side.svg",
|
|
5389
|
+
Rs5: "pcar_side.svg",
|
|
5390
|
+
Rs6: "pcar_side.svg",
|
|
5391
|
+
Rs7: "pcar_side.svg",
|
|
5392
|
+
Wt1: "pcar_top.svg",
|
|
5393
|
+
Wt2: "pcar_top.svg",
|
|
5394
|
+
Ct1: "pcar_top.svg",
|
|
5395
|
+
Ct2: "pcar_top.svg",
|
|
5396
|
+
Ct3: "pcar_top.svg",
|
|
5397
|
+
Ct4: "pcar_top.svg",
|
|
5398
|
+
Rt1: "pcar_top.svg",
|
|
5399
|
+
Rt2: "pcar_top.svg",
|
|
5400
|
+
Wf1: "pcar_front.svg",
|
|
5401
|
+
Wf2: "pcar_front.svg",
|
|
5402
|
+
Cf1: "pcar_front.svg",
|
|
5403
|
+
Cf2: "pcar_front.svg",
|
|
5404
|
+
Cf3: "pcar_front.svg",
|
|
5405
|
+
Rf1: "pcar_front.svg",
|
|
5406
|
+
Rf2: "pcar_front.svg",
|
|
5407
|
+
Rf3: "pcar_front.svg"
|
|
5408
|
+
},
|
|
5409
|
+
sim: {
|
|
5410
|
+
tMax: 180,
|
|
5411
|
+
tStep: 0.5,
|
|
5412
|
+
tUpdate: 500
|
|
5413
|
+
// every 0.5 second
|
|
5414
|
+
}
|
|
5415
|
+
};
|
|
5416
|
+
function pGeom16(t, param, suffix = "") {
|
|
5417
|
+
const rGeome = initGeom16(pDef16.partName + suffix);
|
|
5418
|
+
const figSideWiWheels = figure13();
|
|
5419
|
+
const figSideWoWheels = figure13();
|
|
5420
|
+
const figTop = figure13();
|
|
5421
|
+
const figFront = figure13();
|
|
5422
|
+
const figWheel = figure13();
|
|
5423
|
+
rGeome.logstr += `${rGeome.partName} simTime: ${t}
|
|
5424
|
+
`;
|
|
5425
|
+
try {
|
|
5426
|
+
let calcCR2 = function(dX, dY, dC) {
|
|
5427
|
+
const AD2 = (dX ** 2 + dY ** 2) / 4;
|
|
5428
|
+
const AD = Math.sqrt(AD2);
|
|
5429
|
+
const EA = Math.sqrt(AD2 + dC ** 2);
|
|
5430
|
+
const EG = EA / 2;
|
|
5431
|
+
const aAED = Math.atan2(AD, dC);
|
|
5432
|
+
const rEF = EG / Math.cos(aAED);
|
|
5433
|
+
return rEF;
|
|
5434
|
+
}, makeCtrSide2 = function(withWheels) {
|
|
5435
|
+
const rCtr = contour16(-param.LB1, BodyY0).addCornerRounded(param.Rs1);
|
|
5436
|
+
if (withWheels) {
|
|
5437
|
+
rCtr.addSegStrokeR(LB1b, 0).addPointR(dXwheel, param.HW1 + RW3).addPointR(2 * dXwheel, 0).addSegArc2().addSegStrokeR(LB2b, 0).addPointR(dXwheel, param.HW1 + RW3).addPointR(2 * dXwheel, 0).addSegArc2().addSegStrokeR(LB3b, 0);
|
|
5438
|
+
} else {
|
|
5439
|
+
rCtr.addSegStrokeR(BodyLength, 0);
|
|
5440
|
+
}
|
|
5441
|
+
rCtr.addCornerRounded(param.Rs7).addSegStrokeR(0, param.HF1).addCornerRounded(param.Rs6).addPointR(-param.LT4, param.HF4).addSegArc(CR4, false, true).addCornerRounded(param.Rs5).addPointR(-param.LT3, HF3b).addSegArc(CR3, false, true).addCornerRounded(param.Rs4).addPointR(-LT2, 0).addSegArc(CR2, false, true).addCornerRounded(param.Rs3).addPointR(-param.LT1, -HB1b).addSegArc(CR1, false, true).addCornerRounded(param.Rs2).closeSegStroke();
|
|
5442
|
+
return rCtr;
|
|
5443
|
+
}, makeCtrWheel2 = function(sX, x0, y0, r0) {
|
|
5444
|
+
const rCtr = contour16(x0, y0).addSegStrokeR(sX * RW1, 0).addSegStrokeR(0, param.WW1).addSegStrokeR(sX * (RW2 - RW1), 0).addCornerRounded(param.RW2).addSegStrokeR(0, param.WW2).addCornerRounded(param.RW2).addSegStrokeR(-sX * RW2, 0).closeSegStroke().rotate(x0, y0, r0);
|
|
5445
|
+
return rCtr;
|
|
5446
|
+
};
|
|
5447
|
+
var calcCR = calcCR2, makeCtrSide = makeCtrSide2, makeCtrWheel = makeCtrWheel2;
|
|
5448
|
+
const pi = Math.PI;
|
|
5449
|
+
const pi2 = pi / 2;
|
|
5450
|
+
const RW1 = param.DW1 / 2;
|
|
5451
|
+
const RW2 = param.DW2 / 2;
|
|
5452
|
+
const RW3 = param.DW3 / 2;
|
|
5453
|
+
const BodyY0 = RW2 - param.HW1;
|
|
5454
|
+
const BodyHeight = param.HF1 + param.HF3 + param.HF4;
|
|
5455
|
+
const BodyLength = param.LB1 + param.LB2 + param.LB3;
|
|
5456
|
+
const BodyWidth = 2 * param.Wt1 + param.Wt2;
|
|
5457
|
+
const LT2 = BodyLength - (param.LT1 + param.LT3 + param.LT4);
|
|
5458
|
+
const HF3b = param.HF3 - param.C2;
|
|
5459
|
+
const HB1b = param.HB1 - param.C2;
|
|
5460
|
+
const HB2 = BodyHeight - param.HB1;
|
|
5461
|
+
const Wf1b = BodyHeight - param.Cf3 - param.Wf1;
|
|
5462
|
+
const Wf2b = BodyWidth - 2 * (param.Cf1 + param.Wf2);
|
|
5463
|
+
const Wtb = BodyWidth - 2 * param.Cf1;
|
|
5464
|
+
const Cf1b = param.Wt1 - (param.Cf1 + param.WW1 + param.WW2);
|
|
5465
|
+
const Ct2b = param.Wt1 - (param.Ct2 + param.WW1 + param.WW2);
|
|
5466
|
+
const Ct1b = param.LB1 - (param.Ct1 + RW3);
|
|
5467
|
+
const Ct3b = param.LB3 - (param.Ct3 + RW3);
|
|
5468
|
+
const dXwheel2 = RW3 ** 2 - param.HW1 ** 2;
|
|
5469
|
+
if (dXwheel2 < 0) {
|
|
5470
|
+
throw `err158: dXwheel2 ${ffix17(dXwheel2)} is negative because of HW1 ${ffix17(param.HW1)} and RW3 ${ffix17(RW3)} mm`;
|
|
5471
|
+
}
|
|
5472
|
+
const dXwheel = Math.sqrt(RW3 ** 2 - param.HW1 ** 2);
|
|
5473
|
+
const LB1b = param.LB1 - dXwheel;
|
|
5474
|
+
const LB2b = param.LB2 - 2 * dXwheel;
|
|
5475
|
+
const LB3b = param.LB3 - dXwheel;
|
|
5476
|
+
const CR1 = calcCR2(param.LT1, HB1b, param.C1);
|
|
5477
|
+
const CR2 = calcCR2(LT2, 0, param.C2);
|
|
5478
|
+
const CR3 = calcCR2(param.LT3, HF3b, param.C3);
|
|
5479
|
+
const CR4 = calcCR2(param.LT4, param.HF4, param.C4);
|
|
5480
|
+
const CRt1 = calcCR2(0, BodyWidth - 2 * param.Ct2, param.Ct1);
|
|
5481
|
+
const CRt3 = calcCR2(0, BodyWidth - 2 * param.Ct2, param.Ct3);
|
|
5482
|
+
const CRt2 = calcCR2(BodyLength - param.Ct1 - param.Ct3, 0, param.Ct2);
|
|
5483
|
+
const CRf1 = calcCR2(0, param.Wf1, param.Cf1);
|
|
5484
|
+
const CRf2 = calcCR2(param.Wf2, Wf1b, param.Cf2);
|
|
5485
|
+
const CRf3 = calcCR2(Wf2b, 0, param.Cf3);
|
|
5486
|
+
if (BodyY0 < 0) {
|
|
5487
|
+
throw `err147: DW2 ${ffix17(param.DW2)} is too small comapre to HW1 ${ffix17(param.HW1)} mm`;
|
|
5488
|
+
}
|
|
5489
|
+
if (LT2 < 0) {
|
|
5490
|
+
throw `err169: LT2 ${ffix17(LT2)} mm is negative`;
|
|
5491
|
+
}
|
|
5492
|
+
if (HF3b < 0) {
|
|
5493
|
+
throw `err174: HF3b ${ffix17(HF3b)} mm is negative`;
|
|
5494
|
+
}
|
|
5495
|
+
if (HB1b < 0) {
|
|
5496
|
+
throw `err178: HB1b ${ffix17(HB1b)} mm is negative`;
|
|
5497
|
+
}
|
|
5498
|
+
if (HB2 < 0) {
|
|
5499
|
+
throw `err172: HB2 ${ffix17(HB2)} mm is negative`;
|
|
5500
|
+
}
|
|
5501
|
+
if (Wf1b < 0) {
|
|
5502
|
+
throw `err161: Wf1b ${ffix17(Wf1b)} mm is negative`;
|
|
5503
|
+
}
|
|
5504
|
+
if (Wf2b < 0) {
|
|
5505
|
+
throw `err164: Wf2b ${ffix17(Wf2b)} mm is negative`;
|
|
5506
|
+
}
|
|
5507
|
+
if (Cf1b < 0) {
|
|
5508
|
+
throw `err167: Cf1b ${ffix17(Cf1b)} mm is negative`;
|
|
5509
|
+
}
|
|
5510
|
+
if (Ct1b < 0) {
|
|
5511
|
+
throw `err170: Ct1b ${ffix17(Ct1b)} mm is negative`;
|
|
5512
|
+
}
|
|
5513
|
+
if (Ct2b < 0) {
|
|
5514
|
+
throw `err173: Ct2b ${ffix17(Ct2b)} mm is negative`;
|
|
5515
|
+
}
|
|
5516
|
+
if (Ct3b < 0) {
|
|
5517
|
+
throw `err176: Ct3b ${ffix17(Ct3b)} mm is negative`;
|
|
5518
|
+
}
|
|
5519
|
+
if (LB1b < 0) {
|
|
5520
|
+
throw `err185: LB1b ${ffix17(LB1b)} mm is negative`;
|
|
5521
|
+
}
|
|
5522
|
+
if (LB2b < 0) {
|
|
5523
|
+
throw `err189: LB2b ${ffix17(LB2b)} mm is negative`;
|
|
5524
|
+
}
|
|
5525
|
+
if (LB3b < 0) {
|
|
5526
|
+
throw `err193: LB3b ${ffix17(LB3b)} mm is negative`;
|
|
5527
|
+
}
|
|
5528
|
+
rGeome.logstr += `Body: Y0 ${ffix17(BodyY0)}, Height ${ffix17(BodyHeight)}, Lenght: ${ffix17(BodyLength)}, Width: ${ffix17(BodyWidth)} mm
|
|
5529
|
+
`;
|
|
5530
|
+
figSideWiWheels.addMainO(makeCtrSide2(true));
|
|
5531
|
+
figSideWiWheels.addSecond(contourCircle14(0, RW2, RW2));
|
|
5532
|
+
figSideWiWheels.addSecond(contourCircle14(0, RW2, RW1));
|
|
5533
|
+
figSideWiWheels.addSecond(contourCircle14(param.LB2, RW2, RW2));
|
|
5534
|
+
figSideWiWheels.addSecond(contourCircle14(param.LB2, RW2, RW1));
|
|
5535
|
+
figSideWoWheels.addMainO(makeCtrSide2(false));
|
|
5536
|
+
figSideWoWheels.mergeFigure(figSideWiWheels, true);
|
|
5537
|
+
const ctrTop = contour16(-param.LB1 + param.Ct1, param.Ct2).addCornerRounded(param.Rt1).addPointR(BodyLength - param.Ct1 - param.Ct3, 0).addSegArc(CRt2, false, true).addCornerRounded(param.Rt2).addPointR(0, BodyWidth - 2 * param.Ct2).addSegArc(CRt3, false, true).addCornerRounded(param.Rt2).addPointR(-BodyLength + param.Ct1 + param.Ct3, 0).addSegArc(CRt2, false, true).addCornerRounded(param.Rt1).addPointR(0, -BodyWidth + 2 * param.Ct2).addSegArc(CRt1, false, true);
|
|
5538
|
+
figTop.addMainO(ctrTop);
|
|
5539
|
+
const ctrFront = contour16(param.Cf1, BodyY0).addCornerRounded(param.Rf1).addSegStrokeR(Wtb, 0).addCornerRounded(param.Rf1).addPointR(0, param.Wf1).addSegArc(CRf1, false, true).addCornerRounded(param.Rf2).addPointR(-param.Wf2, Wf1b).addSegArc(CRf2, false, true).addCornerRounded(param.Rf3).addPointR(-Wf2b, 0).addSegArc(CRf3, false, true).addCornerRounded(param.Rf3).addPointR(-param.Wf2, -Wf1b).addSegArc(CRf2, false, true).addCornerRounded(param.Rf2).addPointR(0, -param.Wf1).addSegArc(CRf1, false, true);
|
|
5540
|
+
figFront.addMainO(ctrFront);
|
|
5541
|
+
figWheel.addMainO(makeCtrWheel2(1, 0, 0, 0));
|
|
5542
|
+
figWheel.addSecond(makeCtrWheel2(-1, 0, 0, 0));
|
|
5543
|
+
figTop.addSecond(makeCtrWheel2(1, 0, param.Wt1 + param.Wt2, 0));
|
|
5544
|
+
figTop.addSecond(makeCtrWheel2(-1, 0, param.Wt1 + param.Wt2, 0));
|
|
5545
|
+
figTop.addSecond(makeCtrWheel2(1, param.LB2, param.Wt1 + param.Wt2, 0));
|
|
5546
|
+
figTop.addSecond(makeCtrWheel2(-1, param.LB2, param.Wt1 + param.Wt2, 0));
|
|
5547
|
+
figTop.addSecond(makeCtrWheel2(1, 0, param.Wt1, pi));
|
|
5548
|
+
figTop.addSecond(makeCtrWheel2(-1, 0, param.Wt1, pi));
|
|
5549
|
+
figTop.addSecond(makeCtrWheel2(1, param.LB2, param.Wt1, pi));
|
|
5550
|
+
figTop.addSecond(makeCtrWheel2(-1, param.LB2, param.Wt1, pi));
|
|
5551
|
+
figFront.addSecond(makeCtrWheel2(1, param.Wt1, RW2, pi2));
|
|
5552
|
+
figFront.addSecond(makeCtrWheel2(-1, param.Wt1, RW2, pi2));
|
|
5553
|
+
figFront.addSecond(makeCtrWheel2(1, param.Wt1 + param.Wt2, RW2, -pi2));
|
|
5554
|
+
figFront.addSecond(makeCtrWheel2(-1, param.Wt1 + param.Wt2, RW2, -pi2));
|
|
5555
|
+
rGeome.fig = {
|
|
5556
|
+
faceSideWiWheels: figSideWiWheels,
|
|
5557
|
+
faceSideWoWheels: figSideWoWheels,
|
|
5558
|
+
faceTop: figTop,
|
|
5559
|
+
faceFront: figFront,
|
|
5560
|
+
faceWheel: figWheel
|
|
5561
|
+
};
|
|
5562
|
+
const designName = rGeome.partName;
|
|
5563
|
+
rGeome.vol = {
|
|
5564
|
+
extrudes: [
|
|
5565
|
+
{
|
|
5566
|
+
outName: `subpax_${designName}_sideWiW1`,
|
|
5567
|
+
face: `${designName}_faceSideWiWheels`,
|
|
5568
|
+
extrudeMethod: EExtrude12.eLinearOrtho,
|
|
5569
|
+
length: param.Wt1,
|
|
5570
|
+
rotate: [pi2, 0, 0],
|
|
5571
|
+
translate: [0, param.Wt1, 0]
|
|
5572
|
+
},
|
|
5573
|
+
{
|
|
5574
|
+
outName: `subpax_${designName}_sideWiW2`,
|
|
5575
|
+
face: `${designName}_faceSideWiWheels`,
|
|
5576
|
+
extrudeMethod: EExtrude12.eLinearOrtho,
|
|
5577
|
+
length: param.Wt1,
|
|
5578
|
+
rotate: [pi2, 0, 0],
|
|
5579
|
+
translate: [0, param.Wt2 + 2 * param.Wt1, 0]
|
|
5580
|
+
},
|
|
5581
|
+
{
|
|
5582
|
+
outName: `subpax_${designName}_sideWoW`,
|
|
5583
|
+
face: `${designName}_faceSideWoWheels`,
|
|
5584
|
+
extrudeMethod: EExtrude12.eLinearOrtho,
|
|
5585
|
+
length: param.Wt2,
|
|
5586
|
+
rotate: [pi2, 0, 0],
|
|
5587
|
+
translate: [0, param.Wt2 + param.Wt1, 0]
|
|
5588
|
+
},
|
|
5589
|
+
{
|
|
5590
|
+
outName: `subpax_${designName}_front`,
|
|
5591
|
+
face: `${designName}_faceFront`,
|
|
5592
|
+
extrudeMethod: EExtrude12.eLinearOrtho,
|
|
5593
|
+
length: BodyLength,
|
|
5594
|
+
rotate: [pi2, 0, pi2],
|
|
5595
|
+
translate: [-param.LB1, 0, 0]
|
|
5596
|
+
},
|
|
5597
|
+
{
|
|
5598
|
+
outName: `subpax_${designName}_top`,
|
|
5599
|
+
face: `${designName}_faceTop`,
|
|
5600
|
+
extrudeMethod: EExtrude12.eLinearOrtho,
|
|
5601
|
+
length: BodyHeight + BodyY0,
|
|
5602
|
+
rotate: [0, 0, 0],
|
|
5603
|
+
translate: [0, 0, 0]
|
|
5604
|
+
},
|
|
5605
|
+
{
|
|
5606
|
+
outName: `subpax_${designName}_wheel11`,
|
|
5607
|
+
face: `${designName}_faceWheel`,
|
|
5608
|
+
extrudeMethod: EExtrude12.eRotate,
|
|
5609
|
+
rotate: [pi2, 0, 0],
|
|
5610
|
+
translate: [0, param.Wt1, RW2]
|
|
5611
|
+
},
|
|
5612
|
+
{
|
|
5613
|
+
outName: `subpax_${designName}_wheel12`,
|
|
5614
|
+
face: `${designName}_faceWheel`,
|
|
5615
|
+
extrudeMethod: EExtrude12.eRotate,
|
|
5616
|
+
rotate: [-pi2, 0, 0],
|
|
5617
|
+
translate: [0, param.Wt1 + param.Wt2, RW2]
|
|
5618
|
+
},
|
|
5619
|
+
{
|
|
5620
|
+
outName: `subpax_${designName}_wheel21`,
|
|
5621
|
+
face: `${designName}_faceWheel`,
|
|
5622
|
+
extrudeMethod: EExtrude12.eRotate,
|
|
5623
|
+
rotate: [pi2, 0, 0],
|
|
5624
|
+
translate: [param.LB2, param.Wt1, RW2]
|
|
5625
|
+
},
|
|
5626
|
+
{
|
|
5627
|
+
outName: `subpax_${designName}_wheel22`,
|
|
5628
|
+
face: `${designName}_faceWheel`,
|
|
5629
|
+
extrudeMethod: EExtrude12.eRotate,
|
|
5630
|
+
rotate: [-pi2, 0, 0],
|
|
5631
|
+
translate: [param.LB2, param.Wt1 + param.Wt2, RW2]
|
|
5632
|
+
}
|
|
5633
|
+
],
|
|
5634
|
+
volumes: [
|
|
5635
|
+
{
|
|
5636
|
+
outName: `ipax_${designName}_side`,
|
|
5637
|
+
boolMethod: EBVolume12.eUnion,
|
|
5638
|
+
inList: [
|
|
5639
|
+
`subpax_${designName}_sideWiW1`,
|
|
5640
|
+
`subpax_${designName}_sideWiW2`,
|
|
5641
|
+
`subpax_${designName}_sideWoW`
|
|
5642
|
+
]
|
|
5643
|
+
},
|
|
5644
|
+
{
|
|
5645
|
+
outName: `ipax_${designName}_body`,
|
|
5646
|
+
boolMethod: EBVolume12.eIntersection,
|
|
5647
|
+
inList: [
|
|
5648
|
+
`ipax_${designName}_side`,
|
|
5649
|
+
`subpax_${designName}_front`,
|
|
5650
|
+
`subpax_${designName}_top`
|
|
5651
|
+
]
|
|
5652
|
+
},
|
|
5653
|
+
{
|
|
5654
|
+
outName: `pax_${designName}`,
|
|
5655
|
+
boolMethod: EBVolume12.eUnion,
|
|
5656
|
+
inList: [
|
|
5657
|
+
`ipax_${designName}_body`,
|
|
5658
|
+
`subpax_${designName}_wheel11`,
|
|
5659
|
+
`subpax_${designName}_wheel12`,
|
|
5660
|
+
`subpax_${designName}_wheel21`,
|
|
5661
|
+
`subpax_${designName}_wheel22`
|
|
5662
|
+
]
|
|
5663
|
+
}
|
|
5664
|
+
]
|
|
5665
|
+
};
|
|
5666
|
+
rGeome.sub = {};
|
|
5667
|
+
rGeome.logstr += "pcar drawn successfully!\n";
|
|
5668
|
+
rGeome.calcErr = false;
|
|
5669
|
+
} catch (emsg) {
|
|
5670
|
+
rGeome.logstr += emsg;
|
|
5671
|
+
console.log(emsg);
|
|
5672
|
+
}
|
|
5673
|
+
return rGeome;
|
|
5674
|
+
}
|
|
5675
|
+
var pcarDef = {
|
|
5676
|
+
pTitle: "pcar",
|
|
5677
|
+
pDescription: "the envelop of a passager car",
|
|
5678
|
+
pDef: pDef16,
|
|
5679
|
+
pGeom: pGeom16
|
|
5680
|
+
};
|
|
5681
|
+
|
|
5682
|
+
// src/capsule/capsule.ts
|
|
5683
|
+
import {
|
|
5684
|
+
point as point8,
|
|
5685
|
+
contour as contour17,
|
|
5686
|
+
contourCircle as contourCircle15,
|
|
5687
|
+
ctrRectangle as ctrRectangle7,
|
|
5688
|
+
figure as figure14,
|
|
5689
|
+
ffix as ffix18,
|
|
5690
|
+
pNumber as pNumber17,
|
|
5691
|
+
pCheckbox as pCheckbox9,
|
|
5692
|
+
pDropdown as pDropdown8,
|
|
5693
|
+
pSectionSeparator as pSectionSeparator17,
|
|
5694
|
+
EExtrude as EExtrude13,
|
|
5695
|
+
EBVolume as EBVolume13,
|
|
5696
|
+
initGeom as initGeom17
|
|
5697
|
+
} from "geometrix";
|
|
5698
|
+
var pDef17 = {
|
|
4887
5699
|
partName: "capsule",
|
|
4888
5700
|
params: [
|
|
4889
5701
|
//pNumber(name, unit, init, min, max, step)
|
|
4890
|
-
|
|
4891
|
-
|
|
4892
|
-
|
|
4893
|
-
|
|
4894
|
-
|
|
4895
|
-
|
|
4896
|
-
|
|
4897
|
-
|
|
4898
|
-
|
|
4899
|
-
|
|
4900
|
-
|
|
4901
|
-
|
|
4902
|
-
|
|
4903
|
-
|
|
4904
|
-
|
|
4905
|
-
|
|
4906
|
-
|
|
4907
|
-
|
|
4908
|
-
|
|
4909
|
-
|
|
4910
|
-
|
|
4911
|
-
|
|
4912
|
-
|
|
4913
|
-
|
|
4914
|
-
|
|
4915
|
-
|
|
4916
|
-
|
|
4917
|
-
|
|
4918
|
-
|
|
4919
|
-
|
|
4920
|
-
|
|
4921
|
-
|
|
4922
|
-
|
|
5702
|
+
pNumber17("L1", "mm", 5e3, 1e3, 2e4, 1),
|
|
5703
|
+
pNumber17("WW1", "mm", 1800, 100, 4e3, 1),
|
|
5704
|
+
pNumber17("E1", "mm", 10, 1, 100, 1),
|
|
5705
|
+
pSectionSeparator17("Nose"),
|
|
5706
|
+
pNumber17("H1", "mm", 300, 10, 4e3, 1),
|
|
5707
|
+
pNumber17("H2", "mm", 500, 10, 4e3, 1),
|
|
5708
|
+
pNumber17("H3", "mm", 1200, 10, 4e3, 1),
|
|
5709
|
+
pNumber17("W1", "mm", 300, 10, 4e3, 1),
|
|
5710
|
+
pNumber17("W3", "mm", 1500, 10, 4e3, 1),
|
|
5711
|
+
pNumber17("C3", "mm", 200, 1, 1e3, 1),
|
|
5712
|
+
pNumber17("R1", "mm", 100, 0, 500, 1),
|
|
5713
|
+
pNumber17("R2", "mm", 100, 0, 500, 1),
|
|
5714
|
+
pNumber17("R3", "mm", 100, 0, 500, 1),
|
|
5715
|
+
pNumber17("R4", "mm", 100, 0, 500, 1),
|
|
5716
|
+
pSectionSeparator17("Wheels"),
|
|
5717
|
+
pNumber17("H0", "mm", 600, 100, 2e3, 1),
|
|
5718
|
+
pNumber17("D7", "mm", 500, 10, 2e3, 1),
|
|
5719
|
+
pNumber17("D8", "mm", 100, 10, 2e3, 1),
|
|
5720
|
+
pNumber17("WW2", "mm", 1e3, 100, 4e3, 1),
|
|
5721
|
+
pNumber17("WW3", "mm", 100, 1, 500, 1),
|
|
5722
|
+
pSectionSeparator17("Wheels details"),
|
|
5723
|
+
pNumber17("W6", "mm", 500, 10, 2e3, 1),
|
|
5724
|
+
pNumber17("W7", "mm", 600, 10, 2e3, 1),
|
|
5725
|
+
pNumber17("W8", "mm", 300, 10, 2e3, 1),
|
|
5726
|
+
pNumber17("H6", "mm", 300, 10, 2e3, 1),
|
|
5727
|
+
pSectionSeparator17("Front window"),
|
|
5728
|
+
pNumber17("FH1", "mm", 600, 10, 3e3, 1),
|
|
5729
|
+
pNumber17("FW1", "mm", 100, 10, 3e3, 1),
|
|
5730
|
+
pNumber17("FR1", "mm", 100, 0, 500, 1),
|
|
5731
|
+
pNumber17("FH3", "mm", 100, 10, 3e3, 1),
|
|
5732
|
+
pNumber17("FW3", "mm", 300, 10, 3e3, 1),
|
|
5733
|
+
pNumber17("FR3", "mm", 100, 0, 500, 1),
|
|
5734
|
+
pSectionSeparator17("Top"),
|
|
4923
5735
|
pDropdown8("topStyle", ["mirador", "sky", "roof"]),
|
|
4924
|
-
|
|
4925
|
-
|
|
4926
|
-
|
|
4927
|
-
|
|
4928
|
-
|
|
4929
|
-
|
|
5736
|
+
pNumber17("H5", "mm", 300, 10, 2e3, 1),
|
|
5737
|
+
pNumber17("W4", "mm", 500, 10, 5e3, 1),
|
|
5738
|
+
pNumber17("W5", "mm", 1e3, 10, 5e3, 1),
|
|
5739
|
+
pNumber17("R5", "mm", 50, 1, 500, 1),
|
|
5740
|
+
pNumber17("S5", "mm", 200, 10, 500, 1),
|
|
5741
|
+
pSectionSeparator17("Wall"),
|
|
4930
5742
|
pCheckbox9("sideWall", true),
|
|
4931
|
-
|
|
4932
|
-
|
|
4933
|
-
|
|
4934
|
-
|
|
4935
|
-
|
|
4936
|
-
|
|
4937
|
-
|
|
4938
|
-
|
|
4939
|
-
|
|
4940
|
-
|
|
4941
|
-
|
|
5743
|
+
pNumber17("U1", "mm", 100, 10, 1e3, 1),
|
|
5744
|
+
pNumber17("U2", "mm", 500, 10, 3e3, 1),
|
|
5745
|
+
pNumber17("U3", "mm", 400, 10, 3e3, 1),
|
|
5746
|
+
pNumber17("V1", "mm", 600, 10, 3e3, 1),
|
|
5747
|
+
pNumber17("V2", "mm", 400, 10, 3e3, 1),
|
|
5748
|
+
pNumber17("JR1", "mm", 100, 0, 2e3, 1),
|
|
5749
|
+
pNumber17("JR2", "mm", 100, 0, 2e3, 1),
|
|
5750
|
+
pNumber17("JR3", "mm", 100, 0, 2e3, 1),
|
|
5751
|
+
pNumber17("JR4", "mm", 100, 0, 2e3, 1),
|
|
5752
|
+
pNumber17("JR5", "mm", 100, 0, 2e3, 1),
|
|
5753
|
+
pNumber17("JR6", "mm", 100, 0, 2e3, 1)
|
|
4942
5754
|
],
|
|
4943
5755
|
paramSvg: {
|
|
4944
5756
|
L1: "capsule_side.svg",
|
|
@@ -4995,21 +5807,21 @@ var pDef14 = {
|
|
|
4995
5807
|
// every 0.5 second
|
|
4996
5808
|
}
|
|
4997
5809
|
};
|
|
4998
|
-
function
|
|
4999
|
-
const rGeome =
|
|
5000
|
-
const figBody =
|
|
5001
|
-
const figWheels =
|
|
5002
|
-
const figFront =
|
|
5003
|
-
const figTop =
|
|
5004
|
-
const figTopInt =
|
|
5005
|
-
const figTopTop =
|
|
5006
|
-
const figTopLeg =
|
|
5007
|
-
const figWall =
|
|
5810
|
+
function pGeom17(t, param, suffix = "") {
|
|
5811
|
+
const rGeome = initGeom17(pDef17.partName + suffix);
|
|
5812
|
+
const figBody = figure14();
|
|
5813
|
+
const figWheels = figure14();
|
|
5814
|
+
const figFront = figure14();
|
|
5815
|
+
const figTop = figure14();
|
|
5816
|
+
const figTopInt = figure14();
|
|
5817
|
+
const figTopTop = figure14();
|
|
5818
|
+
const figTopLeg = figure14();
|
|
5819
|
+
const figWall = figure14();
|
|
5008
5820
|
rGeome.logstr += `${rGeome.partName} simTime: ${t}
|
|
5009
5821
|
`;
|
|
5010
5822
|
try {
|
|
5011
5823
|
let ctrBody2 = function(withBat) {
|
|
5012
|
-
const rCtr =
|
|
5824
|
+
const rCtr = contour17(-L12, param.H0);
|
|
5013
5825
|
if (withBat) {
|
|
5014
5826
|
rCtr.addSegStrokeR(Wwheels, 0).addSegStrokeR(0, -Hbatterie).addSegStrokeR(Lbatterie, 0).addSegStrokeR(0, Hbatterie).addSegStrokeR(Wwheels, 0);
|
|
5015
5827
|
} else {
|
|
@@ -5018,21 +5830,21 @@ function pGeom14(t, param, suffix = "") {
|
|
|
5018
5830
|
rCtr.addCornerRounded(param.R1).addSegStrokeR(param.W1, param.H1).addCornerRounded(param.R2).addSegStrokeR(0, param.H2).addCornerRounded(param.R3).addPointR(p1.cx, p1.cy).addPointR(-param.W3, param.H3).addSegArc2().addCornerRounded(param.R4).addSegStrokeR(-Lroof, 0).addCornerRounded(param.R4).addPointR(p2.cx, p2.cy).addPointR(-param.W3, -param.H3).addSegArc2().addCornerRounded(param.R3).addSegStrokeR(0, -param.H2).addCornerRounded(param.R2).closeSegStroke().addCornerRounded(param.R1);
|
|
5019
5831
|
return rCtr;
|
|
5020
5832
|
}, ctrWheels2 = function(sign) {
|
|
5021
|
-
const rCtr =
|
|
5833
|
+
const rCtr = contour17(0, posYwheels).addSegStrokeR(sign * R7, 0).addSegStrokeR(0, param.WW3).addSegStrokeR(sign * (R8 - R7), 0).addSegStrokeR(0, 2 * WW22).addSegStrokeR(-sign * (R8 - R7), 0).addSegStrokeR(0, param.WW3).addSegStrokeR(-sign * R7, 0).closeSegStroke();
|
|
5022
5834
|
return rCtr;
|
|
5023
5835
|
}, makeCtrTop2 = function(radius) {
|
|
5024
|
-
const rCtr =
|
|
5836
|
+
const rCtr = contour17(-L52 + topR - radius, -R52).addPointR(radius, -radius).addSegArc(radius, false, true).addSegStrokeR(L53, 0).addPointR(radius, radius).addSegArc(radius, false, true).addSegStrokeR(0, R53).addPointR(-radius, radius).addSegArc(radius, false, true).addSegStrokeR(-L53, 0).addPointR(-radius, -radius).addSegArc(radius, false, true).closeSegStroke();
|
|
5025
5837
|
return rCtr;
|
|
5026
5838
|
}, ctrSideWindow2 = function(sign) {
|
|
5027
5839
|
const p0x = sign * (Ltotal / 2 - param.U1);
|
|
5028
5840
|
const p0y = param.H0 + param.H1 + param.H2 - UH2dy;
|
|
5029
|
-
const rCtr =
|
|
5841
|
+
const rCtr = contour17(p0x, p0y).addCornerRounded(param.JR1).addPointR(sign * p1ub.cx, p1ub.cy).addPointR(-sign * UW3b, UH3b).addSegArc2().addCornerRounded(param.JR4).addSegStrokeR(-sign * param.U2, 0).addCornerRounded(param.JR3).addSegStrokeR(0, -UH3b).addCornerRounded(param.JR2).closeSegStroke();
|
|
5030
5842
|
return rCtr;
|
|
5031
5843
|
}, volWheel2 = function(posX, idx) {
|
|
5032
5844
|
return {
|
|
5033
5845
|
outName: `subpax_${designName}_wheel${idx}`,
|
|
5034
5846
|
face: `${designName}_faceWheels`,
|
|
5035
|
-
extrudeMethod:
|
|
5847
|
+
extrudeMethod: EExtrude13.eRotate,
|
|
5036
5848
|
rotate: [0, 0, 0],
|
|
5037
5849
|
translate: [posX, R7, 0]
|
|
5038
5850
|
};
|
|
@@ -5040,7 +5852,7 @@ function pGeom14(t, param, suffix = "") {
|
|
|
5040
5852
|
return {
|
|
5041
5853
|
outName: `subpax_${designName}_topLeg${idx}`,
|
|
5042
5854
|
face: `${designName}_faceTopLeg`,
|
|
5043
|
-
extrudeMethod:
|
|
5855
|
+
extrudeMethod: EExtrude13.eLinearOrtho,
|
|
5044
5856
|
length: E1,
|
|
5045
5857
|
rotate: [0, rotY, 0],
|
|
5046
5858
|
translate: [posX, 0, posZ]
|
|
@@ -5112,45 +5924,45 @@ function pGeom14(t, param, suffix = "") {
|
|
|
5112
5924
|
const HfrontWin = Htotal - param.FH1 - param.FH3;
|
|
5113
5925
|
const Ltot2 = Ltotal + 200;
|
|
5114
5926
|
if (param.L1 - 2 * Wwheels < 2 * E1) {
|
|
5115
|
-
throw `err176: L1 ${
|
|
5927
|
+
throw `err176: L1 ${ffix18(param.L1)} is too small compare to W6 ${ffix18(param.W6)}, W7 ${ffix18(param.W7)} and W8 ${ffix18(param.W8)} mm`;
|
|
5116
5928
|
}
|
|
5117
5929
|
if (Hbatterie < E1) {
|
|
5118
|
-
throw `err114: Hbatterie ${
|
|
5930
|
+
throw `err114: Hbatterie ${ffix18(Hbatterie)} is too small compare to E1 ${ffix18(E1)} mm`;
|
|
5119
5931
|
}
|
|
5120
5932
|
if (Lbatterie < 2 * E1) {
|
|
5121
|
-
throw `err118: Lbatterie ${
|
|
5933
|
+
throw `err118: Lbatterie ${ffix18(Lbatterie)} is too small compare to E1 ${ffix18(E1)} mm`;
|
|
5122
5934
|
}
|
|
5123
5935
|
if (L5 < 3 * param.R5 + param.W5) {
|
|
5124
|
-
throw `err122: L5 ${
|
|
5936
|
+
throw `err122: L5 ${ffix18(L5)} is too small compare to W5 ${ffix18(param.W5)} and R5 ${ffix18(param.R5)} mm`;
|
|
5125
5937
|
}
|
|
5126
5938
|
if (H53 < 0.1) {
|
|
5127
|
-
throw `err220: H5 ${
|
|
5939
|
+
throw `err220: H5 ${ffix18(param.H5)} is too small compare to R5 ${ffix18(param.R5)} mm`;
|
|
5128
5940
|
}
|
|
5129
|
-
rGeome.logstr += `Platform surface: ${
|
|
5941
|
+
rGeome.logstr += `Platform surface: ${ffix18(platSurface)} m2, height: ${ffix18(heightTot / 1e3)} m
|
|
5130
5942
|
`;
|
|
5131
|
-
rGeome.logstr += `Lroof: ${
|
|
5943
|
+
rGeome.logstr += `Lroof: ${ffix18(Lroof)}, L5: ${ffix18(L5)} mm
|
|
5132
5944
|
`;
|
|
5133
|
-
rGeome.logstr += `Ltotal: ${
|
|
5945
|
+
rGeome.logstr += `Ltotal: ${ffix18(Ltotal / 1e3)}, Htotal: ${ffix18(Htotal / 1e3)} m
|
|
5134
5946
|
`;
|
|
5135
|
-
rGeome.logstr += `Batterie: LbatInt ${
|
|
5947
|
+
rGeome.logstr += `Batterie: LbatInt ${ffix18(LbatInt)}, HbatInt: ${ffix18(HbatInt)}, WW1 ${ffix18(param.WW1)} mm
|
|
5136
5948
|
`;
|
|
5137
5949
|
const ctrBodyExt = ctrBody2(true);
|
|
5138
|
-
const ctrBodyInt =
|
|
5950
|
+
const ctrBodyInt = contour17(-L12 + L1dx, param.H0 + E1).addSegStrokeR(2 * L12 - 2 * L1dx, 0).addCornerRounded(iR1).addSegStrokeR(param.W1 - E1 + L1dx, param.H1 - E1 + H2dy).addCornerRounded(iR2).addSegStrokeR(0, param.H2 - 2 * H2dy).addCornerRounded(iR3).addPointR(p1b.cx, p1b.cy).addPointR(-W3b, H3b).addSegArc2().addCornerRounded(iR4).addSegStrokeR(-Lroof + 2 * W3dx, 0).addCornerRounded(iR4).addPointR(p2b.cx, p2b.cy).addPointR(-W3b, -H3b).addSegArc2().addCornerRounded(iR3).addSegStrokeR(0, -param.H2 + 2 * H2dy).addCornerRounded(iR2).closeSegStroke().addCornerRounded(iR1);
|
|
5139
5951
|
const ctrBatterie = ctrRectangle7(-LbatInt2, posYbatterie, LbatInt, HbatInt);
|
|
5140
5952
|
figBody.addMainOI([ctrBodyExt, ctrBodyInt, ctrBatterie]);
|
|
5141
|
-
figBody.addSecond(
|
|
5142
|
-
figBody.addSecond(
|
|
5143
|
-
figBody.addSecond(
|
|
5144
|
-
figBody.addSecond(
|
|
5145
|
-
figBody.addSecond(
|
|
5146
|
-
figBody.addSecond(
|
|
5147
|
-
figBody.addSecond(
|
|
5148
|
-
figBody.addSecond(
|
|
5953
|
+
figBody.addSecond(contourCircle15(-posXwheel1, R7, R7));
|
|
5954
|
+
figBody.addSecond(contourCircle15(-posXwheel1, R7, R8));
|
|
5955
|
+
figBody.addSecond(contourCircle15(-posXwheel2, R7, R7));
|
|
5956
|
+
figBody.addSecond(contourCircle15(-posXwheel2, R7, R8));
|
|
5957
|
+
figBody.addSecond(contourCircle15(posXwheel1, R7, R7));
|
|
5958
|
+
figBody.addSecond(contourCircle15(posXwheel1, R7, R8));
|
|
5959
|
+
figBody.addSecond(contourCircle15(posXwheel2, R7, R7));
|
|
5960
|
+
figBody.addSecond(contourCircle15(posXwheel2, R7, R8));
|
|
5149
5961
|
figBody.addSecond(ctrRectangle7(-L52, posYtop, L5, param.H5));
|
|
5150
5962
|
figBody.addSecond(ctrRectangle7(-L52 - param.S5, posYtop2, L5 + 2 * param.S5, E1));
|
|
5151
5963
|
figWheels.addMainO(ctrWheels2(1));
|
|
5152
5964
|
figWheels.addSecond(ctrWheels2(-1));
|
|
5153
|
-
const ctrFront =
|
|
5965
|
+
const ctrFront = contour17(-FWL1 / 2, param.H0 + param.FH1).addCornerRounded(param.FR1).addSegStrokeR(FWL1, 0).addCornerRounded(param.FR1).addSegStrokeR(param.FW1 - param.FW3, HfrontWin).addCornerRounded(param.FR3).addSegStrokeR(-FWL3, 0).addCornerRounded(param.FR3).closeSegStroke();
|
|
5154
5966
|
figFront.addMainO(ctrFront);
|
|
5155
5967
|
figFront.addSecond(ctrWheels2(1).rotate(0, 0, pi2).translate(WW12, R7));
|
|
5156
5968
|
figFront.addSecond(ctrWheels2(-1).rotate(0, 0, pi2).translate(WW12, R7));
|
|
@@ -5180,10 +5992,10 @@ function pGeom14(t, param, suffix = "") {
|
|
|
5180
5992
|
figTopInt.mergeFigure(figTop, true);
|
|
5181
5993
|
figTopTop.addMainO(ctrTopTop);
|
|
5182
5994
|
figTopTop.mergeFigure(figTop, true);
|
|
5183
|
-
const ctrTopLeg =
|
|
5995
|
+
const ctrTopLeg = contour17(-R52, posYtop).addSegStrokeR(R53, 0).addSegStrokeR(0, param.R5).addPointR(-param.R5, param.R5).addSegArc(param.R5, false, false).addSegStrokeR(0, H53).addPointR(param.R5, param.R5).addSegArc(param.R5, false, false).addSegStrokeR(0, param.R5).addSegStrokeR(-R53, 0).addSegStrokeR(0, -param.R5).addPointR(param.R5, -param.R5).addSegArc(param.R5, false, false).addSegStrokeR(0, -H53).addPointR(-param.R5, -param.R5).addSegArc(param.R5, false, false).closeSegStroke();
|
|
5184
5996
|
figTopLeg.addMainO(ctrTopLeg);
|
|
5185
5997
|
figFront.addSecond(ctrTopLeg);
|
|
5186
|
-
const ctrDoor =
|
|
5998
|
+
const ctrDoor = contour17(-LwallDoor / 2, param.H0 + param.V1).addCornerRounded(param.JR5).addSegStrokeR(LwallDoor, 0).addCornerRounded(param.JR5).addSegStrokeR(0, HwallDoor).addCornerRounded(param.JR6).addSegStrokeR(-LwallDoor, 0).addCornerRounded(param.JR6).closeSegStroke();
|
|
5187
5999
|
figWall.addMainOI([ctrBody2(false), ctrSideWindow2(1), ctrSideWindow2(-1), ctrDoor]);
|
|
5188
6000
|
figWall.mergeFigure(figBody, true);
|
|
5189
6001
|
rGeome.fig = {
|
|
@@ -5226,7 +6038,7 @@ function pGeom14(t, param, suffix = "") {
|
|
|
5226
6038
|
{
|
|
5227
6039
|
outName: `subpax_${designName}_body`,
|
|
5228
6040
|
face: `${designName}_faceBody`,
|
|
5229
|
-
extrudeMethod:
|
|
6041
|
+
extrudeMethod: EExtrude13.eLinearOrtho,
|
|
5230
6042
|
length: param.WW1,
|
|
5231
6043
|
rotate: [0, 0, 0],
|
|
5232
6044
|
translate: [0, 0, 0]
|
|
@@ -5238,7 +6050,7 @@ function pGeom14(t, param, suffix = "") {
|
|
|
5238
6050
|
{
|
|
5239
6051
|
outName: `subpax_${designName}_frontWin`,
|
|
5240
6052
|
face: `${designName}_faceFront`,
|
|
5241
|
-
extrudeMethod:
|
|
6053
|
+
extrudeMethod: EExtrude13.eLinearOrtho,
|
|
5242
6054
|
length: Ltot2,
|
|
5243
6055
|
rotate: [0, pi2, 0],
|
|
5244
6056
|
translate: [-Ltot2 / 2, 0, WW12]
|
|
@@ -5246,7 +6058,7 @@ function pGeom14(t, param, suffix = "") {
|
|
|
5246
6058
|
{
|
|
5247
6059
|
outName: `subpax_${designName}_topInt`,
|
|
5248
6060
|
face: `${designName}_faceTopInt`,
|
|
5249
|
-
extrudeMethod:
|
|
6061
|
+
extrudeMethod: EExtrude13.eLinearOrtho,
|
|
5250
6062
|
length: 3 * E1,
|
|
5251
6063
|
rotate: [-pi2, 0, 0],
|
|
5252
6064
|
translate: [0, posYtop - 2 * E1, WW12]
|
|
@@ -5254,7 +6066,7 @@ function pGeom14(t, param, suffix = "") {
|
|
|
5254
6066
|
{
|
|
5255
6067
|
outName: `subpax_${designName}_top1`,
|
|
5256
6068
|
face: `${designName}_faceTop`,
|
|
5257
|
-
extrudeMethod:
|
|
6069
|
+
extrudeMethod: EExtrude13.eLinearOrtho,
|
|
5258
6070
|
length: param.R5,
|
|
5259
6071
|
rotate: [-pi2, 0, 0],
|
|
5260
6072
|
translate: [0, posYtop, WW12]
|
|
@@ -5262,7 +6074,7 @@ function pGeom14(t, param, suffix = "") {
|
|
|
5262
6074
|
{
|
|
5263
6075
|
outName: `subpax_${designName}_top2`,
|
|
5264
6076
|
face: `${designName}_faceTop`,
|
|
5265
|
-
extrudeMethod:
|
|
6077
|
+
extrudeMethod: EExtrude13.eLinearOrtho,
|
|
5266
6078
|
length: param.R5,
|
|
5267
6079
|
rotate: [-pi2, 0, 0],
|
|
5268
6080
|
translate: [0, posYtop2 - param.R5, WW12]
|
|
@@ -5270,7 +6082,7 @@ function pGeom14(t, param, suffix = "") {
|
|
|
5270
6082
|
{
|
|
5271
6083
|
outName: `subpax_${designName}_topTop`,
|
|
5272
6084
|
face: `${designName}_faceTopTop`,
|
|
5273
|
-
extrudeMethod:
|
|
6085
|
+
extrudeMethod: EExtrude13.eLinearOrtho,
|
|
5274
6086
|
length: E1,
|
|
5275
6087
|
rotate: [-pi2, 0, 0],
|
|
5276
6088
|
translate: [0, posYtop2, WW12]
|
|
@@ -5284,7 +6096,7 @@ function pGeom14(t, param, suffix = "") {
|
|
|
5284
6096
|
{
|
|
5285
6097
|
outName: `subpax_${designName}_wall1`,
|
|
5286
6098
|
face: `${designName}_faceWall`,
|
|
5287
|
-
extrudeMethod:
|
|
6099
|
+
extrudeMethod: EExtrude13.eLinearOrtho,
|
|
5288
6100
|
length: E1,
|
|
5289
6101
|
rotate: [0, 0, 0],
|
|
5290
6102
|
translate: [0, 0, 0]
|
|
@@ -5292,7 +6104,7 @@ function pGeom14(t, param, suffix = "") {
|
|
|
5292
6104
|
{
|
|
5293
6105
|
outName: `subpax_${designName}_wall2`,
|
|
5294
6106
|
face: `${designName}_faceWall`,
|
|
5295
|
-
extrudeMethod:
|
|
6107
|
+
extrudeMethod: EExtrude13.eLinearOrtho,
|
|
5296
6108
|
length: E1,
|
|
5297
6109
|
rotate: [0, 0, 0],
|
|
5298
6110
|
translate: [0, 0, param.WW1 - E1]
|
|
@@ -5301,7 +6113,7 @@ function pGeom14(t, param, suffix = "") {
|
|
|
5301
6113
|
volumes: [
|
|
5302
6114
|
{
|
|
5303
6115
|
outName: `ipax_${designName}_plus`,
|
|
5304
|
-
boolMethod:
|
|
6116
|
+
boolMethod: EBVolume13.eUnion,
|
|
5305
6117
|
inList: [
|
|
5306
6118
|
`subpax_${designName}_body`,
|
|
5307
6119
|
`subpax_${designName}_wheel1`,
|
|
@@ -5314,12 +6126,12 @@ function pGeom14(t, param, suffix = "") {
|
|
|
5314
6126
|
},
|
|
5315
6127
|
{
|
|
5316
6128
|
outName: `ipax_${designName}_minus`,
|
|
5317
|
-
boolMethod:
|
|
6129
|
+
boolMethod: EBVolume13.eUnion,
|
|
5318
6130
|
inList: [`subpax_${designName}_frontWin`, ...roofHoleList]
|
|
5319
6131
|
},
|
|
5320
6132
|
{
|
|
5321
6133
|
outName: `pax_${designName}`,
|
|
5322
|
-
boolMethod:
|
|
6134
|
+
boolMethod: EBVolume13.eSubstraction,
|
|
5323
6135
|
inList: [`ipax_${designName}_plus`, `ipax_${designName}_minus`]
|
|
5324
6136
|
}
|
|
5325
6137
|
]
|
|
@@ -5336,16 +6148,19 @@ function pGeom14(t, param, suffix = "") {
|
|
|
5336
6148
|
var capsuleDef = {
|
|
5337
6149
|
pTitle: "capsule",
|
|
5338
6150
|
pDescription: "high-level concept of the train-capsule",
|
|
5339
|
-
pDef:
|
|
5340
|
-
pGeom:
|
|
6151
|
+
pDef: pDef17,
|
|
6152
|
+
pGeom: pGeom17
|
|
5341
6153
|
};
|
|
5342
6154
|
export {
|
|
5343
6155
|
capsuleDef,
|
|
5344
6156
|
door1arcDef,
|
|
6157
|
+
doubleBoneDef,
|
|
5345
6158
|
heliostatDef,
|
|
5346
6159
|
houseDef,
|
|
6160
|
+
pcarDef,
|
|
5347
6161
|
plugTorqueDef,
|
|
5348
6162
|
rccarDef,
|
|
6163
|
+
singleBoneDef,
|
|
5349
6164
|
springIntDef,
|
|
5350
6165
|
springOneDef,
|
|
5351
6166
|
springSideDef,
|