desi76 0.1.12 → 0.1.14
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 +9 -1
- package/dist/index.js +1562 -39
- package/dist/pgdsvg/cuisine_door.svg +7 -0
- package/dist/pgdsvg/cuisine_elements.svg +12 -0
- package/dist/pgdsvg/cuisine_roof.svg +7 -0
- package/dist/pgdsvg/cuisine_top.svg +11 -0
- package/dist/pgdsvg/long2d_back.svg +1 -0
- package/dist/pgdsvg/long2d_joint.svg +1 -0
- package/dist/pgdsvg/long2d_side.svg +1 -0
- package/dist/pgdsvg/long2d_top.svg +2 -0
- package/dist/pgdsvg/scara_ends.svg +5 -0
- package/dist/pgdsvg/scara_side.svg +1 -0
- package/dist/pgdsvg/scara_side2.svg +1 -0
- package/dist/pgdsvg/scara_top.svg +1 -0
- package/dist/pgdsvg/scarabase_cut.svg +1 -0
- package/dist/pgdsvg/scarabase_double.svg +1 -0
- package/dist/pgdsvg/scarabase_heights.svg +1 -0
- package/dist/pgdsvg/scarabase_single.svg +1 -0
- package/dist/pgdsvg/src_cuisine.svg +34 -0
- package/dist/pgdsvg/src_long2d.svg +2 -0
- package/dist/pgdsvg/src_scara.svg +5 -0
- package/dist/pgdsvg/src_scarabase.svg +1 -0
- package/package.json +14 -13
package/dist/index.js
CHANGED
|
@@ -1732,40 +1732,399 @@ var abriDef = {
|
|
|
1732
1732
|
pGeom: pGeom3
|
|
1733
1733
|
};
|
|
1734
1734
|
|
|
1735
|
-
// src/
|
|
1735
|
+
// src/charpente/cuisine.ts
|
|
1736
1736
|
import {
|
|
1737
|
-
point as point2,
|
|
1738
1737
|
contour as contour4,
|
|
1739
|
-
contourCircle as contourCircle4,
|
|
1740
1738
|
ctrRectangle as ctrRectangle3,
|
|
1741
1739
|
figure as figure4,
|
|
1740
|
+
degToRad as degToRad2,
|
|
1742
1741
|
radToDeg as radToDeg2,
|
|
1743
1742
|
ffix as ffix3,
|
|
1744
1743
|
pNumber as pNumber4,
|
|
1745
|
-
|
|
1744
|
+
pCheckbox as pCheckbox2,
|
|
1746
1745
|
pSectionSeparator as pSectionSeparator4,
|
|
1746
|
+
initGeom as initGeom4,
|
|
1747
1747
|
EExtrude as EExtrude4,
|
|
1748
|
-
EBVolume as EBVolume4
|
|
1749
|
-
initGeom as initGeom4
|
|
1748
|
+
EBVolume as EBVolume4
|
|
1750
1749
|
} from "geometrix";
|
|
1751
1750
|
var pDef4 = {
|
|
1751
|
+
// partName is used in URL. Choose a name without slash, backslash and space.
|
|
1752
|
+
partName: "cuisine",
|
|
1753
|
+
params: [
|
|
1754
|
+
//pNumber(name, unit, init, min, max, step)
|
|
1755
|
+
pNumber4("FB", "cm", 20, 1, 100, 1),
|
|
1756
|
+
pNumber4("FX", "cm", 65, 1, 200, 1),
|
|
1757
|
+
pNumber4("FY", "cm", 65, 1, 200, 1),
|
|
1758
|
+
pNumber4("FH", "cm", 200, 100, 300, 1),
|
|
1759
|
+
pNumber4("VX", "cm", 180, 50, 300, 1),
|
|
1760
|
+
pNumber4("VY", "cm", 90, 50, 300, 1),
|
|
1761
|
+
pNumber4("CAX", "cm", 80, 1, 200, 1),
|
|
1762
|
+
pNumber4("PTX", "cm", 60, 20, 200, 1),
|
|
1763
|
+
pNumber4("PTH", "cm", 91, 50, 200, 1),
|
|
1764
|
+
pNumber4("S1", "cm", 30, 0, 200, 1),
|
|
1765
|
+
pNumber4("S2", "cm", 10, 0, 200, 1),
|
|
1766
|
+
pNumber4("BarX", "cm", 120, 10, 300, 1),
|
|
1767
|
+
pNumber4("BarY", "cm", 40, 10, 300, 1),
|
|
1768
|
+
pNumber4("BarH", "cm", 120, 10, 300, 1),
|
|
1769
|
+
pCheckbox2("BarEn", true),
|
|
1770
|
+
pSectionSeparator4("Ground"),
|
|
1771
|
+
pNumber4("AX", "cm", 274, 200, 600, 1),
|
|
1772
|
+
pNumber4("AY", "cm", 210, 100, 500, 1),
|
|
1773
|
+
pNumber4("BY", "cm", 130, 50, 500, 1),
|
|
1774
|
+
pNumber4("CX", "cm", 405, 50, 800, 1),
|
|
1775
|
+
pNumber4("DPX", "cm", 108, 50, 500, 1),
|
|
1776
|
+
pSectionSeparator4("Window"),
|
|
1777
|
+
pNumber4("WW", "cm", 94, 40, 200, 1),
|
|
1778
|
+
pNumber4("WH", "cm", 90, 40, 200, 1),
|
|
1779
|
+
pNumber4("WPH", "cm", 120, 40, 200, 1),
|
|
1780
|
+
pNumber4("WPX", "cm", 130, 40, 400, 1),
|
|
1781
|
+
pNumber4("WPY", "cm", 270, 40, 400, 1),
|
|
1782
|
+
pSectionSeparator4("Door"),
|
|
1783
|
+
pNumber4("DW", "cm", 76, 40, 200, 1),
|
|
1784
|
+
pNumber4("DH", "cm", 210, 180, 300, 1),
|
|
1785
|
+
pNumber4("AMH", "cm", 300, 100, 600, 1),
|
|
1786
|
+
pSectionSeparator4("Roof"),
|
|
1787
|
+
pNumber4("MW", "cm", 10, 5, 50, 1),
|
|
1788
|
+
pNumber4("eMH", "cm", 104, 5, 200, 1),
|
|
1789
|
+
pNumber4("eRA", "degree", 40.78, 10, 85, 0.01),
|
|
1790
|
+
pNumber4("eRW", "cm", 250, 100, 500, 1),
|
|
1791
|
+
pNumber4("nMH", "cm", 60, 5, 200, 1),
|
|
1792
|
+
pNumber4("nRA", "degree", 45, 10, 85, 0.01),
|
|
1793
|
+
pNumber4("nRW", "cm", 200, 100, 500, 1)
|
|
1794
|
+
],
|
|
1795
|
+
paramSvg: {
|
|
1796
|
+
FB: "cuisine_elements.svg",
|
|
1797
|
+
FX: "cuisine_elements.svg",
|
|
1798
|
+
FY: "cuisine_elements.svg",
|
|
1799
|
+
FH: "cuisine_elements.svg",
|
|
1800
|
+
VX: "cuisine_elements.svg",
|
|
1801
|
+
VY: "cuisine_elements.svg",
|
|
1802
|
+
CAX: "cuisine_elements.svg",
|
|
1803
|
+
PTX: "cuisine_elements.svg",
|
|
1804
|
+
PTH: "cuisine_elements.svg",
|
|
1805
|
+
S1: "cuisine_elements.svg",
|
|
1806
|
+
S2: "cuisine_elements.svg",
|
|
1807
|
+
BarX: "cuisine_elements.svg",
|
|
1808
|
+
BarY: "cuisine_elements.svg",
|
|
1809
|
+
BarH: "cuisine_elements.svg",
|
|
1810
|
+
BarEn: "cuisine_elements.svg",
|
|
1811
|
+
AX: "cuisine_top.svg",
|
|
1812
|
+
AY: "cuisine_top.svg",
|
|
1813
|
+
BY: "cuisine_top.svg",
|
|
1814
|
+
CX: "cuisine_top.svg",
|
|
1815
|
+
WW: "cuisine_door.svg",
|
|
1816
|
+
MW: "cuisine_roof.svg",
|
|
1817
|
+
eMH: "cuisine_roof.svg",
|
|
1818
|
+
eRA: "cuisine_roof.svg",
|
|
1819
|
+
eRW: "cuisine_roof.svg",
|
|
1820
|
+
nMH: "cuisine_roof.svg",
|
|
1821
|
+
nRA: "cuisine_roof.svg",
|
|
1822
|
+
nRW: "cuisine_roof.svg"
|
|
1823
|
+
},
|
|
1824
|
+
sim: {
|
|
1825
|
+
tMax: 100,
|
|
1826
|
+
tStep: 0.5,
|
|
1827
|
+
tUpdate: 500
|
|
1828
|
+
// every 0.5 second
|
|
1829
|
+
}
|
|
1830
|
+
};
|
|
1831
|
+
function pGeom4(t, param, suffix = "") {
|
|
1832
|
+
const rGeome = initGeom4(pDef4.partName + suffix);
|
|
1833
|
+
const figTop = figure4();
|
|
1834
|
+
const figTopSubDoor = figure4();
|
|
1835
|
+
const figTopSupDoor = figure4();
|
|
1836
|
+
const figRoofEast = figure4();
|
|
1837
|
+
const figRoofNorth = figure4();
|
|
1838
|
+
const figWindow = figure4();
|
|
1839
|
+
const figFrigo = figure4();
|
|
1840
|
+
const figVaissCagi = figure4();
|
|
1841
|
+
const figCuis = figure4();
|
|
1842
|
+
const figBar = figure4();
|
|
1843
|
+
rGeome.logstr += `${rGeome.partName} simTime: ${t}
|
|
1844
|
+
`;
|
|
1845
|
+
try {
|
|
1846
|
+
const aRe = degToRad2(param.eRA);
|
|
1847
|
+
const aRn = degToRad2(param.nRA);
|
|
1848
|
+
const lX = param.AX + param.CX + param.MW;
|
|
1849
|
+
const lY = param.AY + param.BY + param.MW;
|
|
1850
|
+
const lAZx = param.AX + param.MW - param.DPX - param.DW;
|
|
1851
|
+
const lR2e = (200 - param.eMH) / Math.tan(aRe);
|
|
1852
|
+
const lR2n = (200 - param.nMH) / Math.tan(aRn);
|
|
1853
|
+
const cWHtop = 30;
|
|
1854
|
+
const hRe = param.eRW * Math.tan(aRe);
|
|
1855
|
+
const hRn = param.nRW * Math.tan(aRn);
|
|
1856
|
+
const lWindowCut = Math.max(param.eRW, param.nRW) + param.MW;
|
|
1857
|
+
const wPx1 = (param.AX - param.WW) / 2;
|
|
1858
|
+
const wPx2 = lX - param.WW - param.WPX;
|
|
1859
|
+
const wPy3 = param.WPY;
|
|
1860
|
+
const cagiLen = param.WPY - param.S1;
|
|
1861
|
+
const cuisLen = cagiLen - param.S2;
|
|
1862
|
+
const cagiH = param.nMH + (param.CAX + param.MW) * Math.tan(aRn);
|
|
1863
|
+
const vaissH = param.eMH + param.VY * Math.tan(aRe);
|
|
1864
|
+
const distFrigVaiss = param.AY - param.FY - param.VY;
|
|
1865
|
+
const cuisW = param.CAX + param.MW + param.PTX;
|
|
1866
|
+
const distFrigCuis = param.CX - param.FB - param.FX - cuisW;
|
|
1867
|
+
const distVaisCuis = param.CX - param.VX - cuisW;
|
|
1868
|
+
const salonN = 310;
|
|
1869
|
+
const barThickness = 10;
|
|
1870
|
+
const pi2 = Math.PI / 2;
|
|
1871
|
+
if (lAZx < 0) {
|
|
1872
|
+
throw `err099: sign of lAZx ${ffix3(lAZx)} must be positive`;
|
|
1873
|
+
}
|
|
1874
|
+
rGeome.logstr += `lX ${ffix3(lX)} lY ${ffix3(lY)}
|
|
1875
|
+
`;
|
|
1876
|
+
rGeome.logstr += `East side: roof-angle ${ffix3(radToDeg2(aRe))}, lR2e ${ffix3(lR2e)}
|
|
1877
|
+
`;
|
|
1878
|
+
rGeome.logstr += `North side: roof-angle ${ffix3(radToDeg2(aRn))}, lR2n ${ffix3(lR2n)}
|
|
1879
|
+
`;
|
|
1880
|
+
rGeome.logstr += `cagiLen ${ffix3(cagiLen)} cuisLen ${ffix3(cuisLen)}
|
|
1881
|
+
`;
|
|
1882
|
+
rGeome.logstr += `cagiH ${ffix3(cagiH)} vaissH ${ffix3(vaissH)}
|
|
1883
|
+
`;
|
|
1884
|
+
rGeome.logstr += `distFrigVaiss ${ffix3(distFrigVaiss)} distFrigCuis ${ffix3(distFrigCuis)} distVaisCuis ${ffix3(distVaisCuis)}
|
|
1885
|
+
`;
|
|
1886
|
+
const ctrBase = contour4(0, 0).addSegStrokeR(lX, 0).addSegStrokeR(0, lY + param.MW).addSegStrokeR(-salonN, 0).addSegStrokeR(0, -param.MW).addSegStrokeR(salonN - lX, 0).closeSegStroke();
|
|
1887
|
+
const ctrArbeitZimmerS = contour4(0, param.AY - param.MW).addSegStrokeR(lAZx, 0).addSegStrokeR(0, param.MW).addSegStrokeR(-lAZx, 0).closeSegStroke();
|
|
1888
|
+
const ctrArbeitZimmerN = contour4(param.AX, 0).addSegStrokeR(param.MW, 0).addSegStrokeR(0, param.AY).addSegStrokeR(-param.DPX, 0).addSegStrokeR(0, -param.MW).addSegStrokeR(param.DPX - param.MW, 0).closeSegStroke();
|
|
1889
|
+
const ctrArbeitZimmerTop = contour4(param.AX, 0).addSegStrokeR(param.MW, 0).addSegStrokeR(0, param.AY).addSegStrokeR(-param.AX - param.MW, 0).addSegStrokeR(0, -param.MW).addSegStrokeR(param.AX, 0).closeSegStroke();
|
|
1890
|
+
const ctr2M = contour4(0, 0).addSegStrokeR(lX, 0).addSegStrokeR(0, lY).addSegStrokeR(-lR2n, 0).addSegStrokeR(0, -lY + lR2e).addSegStrokeR(-lX + lR2n, 0).closeSegStroke();
|
|
1891
|
+
figTop.addMainO(ctrBase);
|
|
1892
|
+
figTop.addSecond(ctrArbeitZimmerS);
|
|
1893
|
+
figTop.addSecond(ctrArbeitZimmerN);
|
|
1894
|
+
figTop.addSecond(ctrArbeitZimmerTop);
|
|
1895
|
+
figTop.addSecond(ctr2M);
|
|
1896
|
+
figTop.addSecond(ctrRectangle3(wPx1, 0, param.WW, cWHtop));
|
|
1897
|
+
figTop.addSecond(ctrRectangle3(wPx2, 0, param.WW, cWHtop));
|
|
1898
|
+
figTop.addSecond(ctrRectangle3(lX - cWHtop, param.WPY, cWHtop, param.WW));
|
|
1899
|
+
figTopSubDoor.addMainO(ctrArbeitZimmerS);
|
|
1900
|
+
figTopSubDoor.addMainO(ctrArbeitZimmerN);
|
|
1901
|
+
figTopSupDoor.addMainO(ctrArbeitZimmerTop);
|
|
1902
|
+
const ctrRe = contour4(0, 0).addSegStrokeR(param.MW, 0).addSegStrokeR(0, param.eMH).addSegStrokeR(param.eRW, hRe).addSegStrokeR(0, param.MW).addSegStrokeR(-param.eRW, -hRe).addSegStrokeR(-param.MW, 0).closeSegStroke();
|
|
1903
|
+
figRoofEast.addMainO(ctrRe);
|
|
1904
|
+
const ctrRn = contour4(0, 0).addSegStrokeR(param.MW, 0).addSegStrokeR(0, param.nMH).addSegStrokeR(param.nRW, hRn).addSegStrokeR(0, param.MW).addSegStrokeR(-param.nRW, -hRn).addSegStrokeR(-param.MW, 0).closeSegStroke();
|
|
1905
|
+
figRoofNorth.addMainO(ctrRn);
|
|
1906
|
+
figWindow.addMainO(ctrRectangle3(0, param.WPH, param.WW, param.WH));
|
|
1907
|
+
figFrigo.addMainO(
|
|
1908
|
+
ctrRectangle3(param.AX + param.MW + param.FB, param.AY - param.FY, param.FX, param.FY, 5)
|
|
1909
|
+
);
|
|
1910
|
+
figVaissCagi.addMainO(ctrRectangle3(param.AX + param.MW, 0, param.VX, param.VY));
|
|
1911
|
+
figVaissCagi.addMainO(ctrRectangle3(lX - param.CAX - param.MW, 0, param.MW, cagiLen));
|
|
1912
|
+
figCuis.addMainO(
|
|
1913
|
+
ctrRectangle3(lX - param.CAX - param.MW - param.PTX, 0, param.PTX, cuisLen)
|
|
1914
|
+
);
|
|
1915
|
+
figTop.mergeFigure(figFrigo, true);
|
|
1916
|
+
figTop.mergeFigure(figVaissCagi, true);
|
|
1917
|
+
figTop.mergeFigure(figCuis, true);
|
|
1918
|
+
const ctrBar = contour4(lX - param.CAX - param.MW, cuisLen).addSegStrokeR(0, param.BarY).addSegStrokeR(-param.BarX + param.BarY / 2, 0).addPointR(-param.BarY / 2, -param.BarY / 2).addSegArc3(Math.PI, true).addPointR(param.BarY / 2, -param.BarY / 2).addSegArc3(-Math.PI, false).closeSegStroke();
|
|
1919
|
+
figBar.addMainO(ctrBar);
|
|
1920
|
+
if (param.BarEn) {
|
|
1921
|
+
figTop.mergeFigure(figBar, true);
|
|
1922
|
+
}
|
|
1923
|
+
rGeome.fig = {
|
|
1924
|
+
faceTop: figTop,
|
|
1925
|
+
faceTopSub: figTopSubDoor,
|
|
1926
|
+
faceTopSup: figTopSupDoor,
|
|
1927
|
+
faceRoofEast: figRoofEast,
|
|
1928
|
+
faceRoofNorth: figRoofNorth,
|
|
1929
|
+
faceWindow: figWindow,
|
|
1930
|
+
faceFrigo: figFrigo,
|
|
1931
|
+
faceVaissCagi: figVaissCagi,
|
|
1932
|
+
faceCuis: figCuis,
|
|
1933
|
+
faceBar: figBar
|
|
1934
|
+
};
|
|
1935
|
+
const designName = rGeome.partName;
|
|
1936
|
+
const lCuis = [
|
|
1937
|
+
`subpax_${designName}_top`,
|
|
1938
|
+
`subpax_${designName}_azSub`,
|
|
1939
|
+
`subpax_${designName}_azSup`,
|
|
1940
|
+
`subpax_${designName}_frigo`,
|
|
1941
|
+
`subpax_${designName}_vaissCagi`,
|
|
1942
|
+
`subpax_${designName}_cuis`
|
|
1943
|
+
];
|
|
1944
|
+
if (param.BarEn) {
|
|
1945
|
+
lCuis.push(`subpax_${designName}_bar`);
|
|
1946
|
+
}
|
|
1947
|
+
rGeome.vol = {
|
|
1948
|
+
extrudes: [
|
|
1949
|
+
{
|
|
1950
|
+
outName: `subpax_${designName}_top`,
|
|
1951
|
+
face: `${designName}_faceTop`,
|
|
1952
|
+
extrudeMethod: EExtrude4.eLinearOrtho,
|
|
1953
|
+
length: param.MW,
|
|
1954
|
+
rotate: [0, 0, 0],
|
|
1955
|
+
translate: [0, 0, -param.MW]
|
|
1956
|
+
},
|
|
1957
|
+
{
|
|
1958
|
+
outName: `subpax_${designName}_azSub`,
|
|
1959
|
+
face: `${designName}_faceTopSub`,
|
|
1960
|
+
extrudeMethod: EExtrude4.eLinearOrtho,
|
|
1961
|
+
length: param.DH,
|
|
1962
|
+
rotate: [0, 0, 0],
|
|
1963
|
+
translate: [0, 0, 0]
|
|
1964
|
+
},
|
|
1965
|
+
{
|
|
1966
|
+
outName: `subpax_${designName}_azSup`,
|
|
1967
|
+
face: `${designName}_faceTopSup`,
|
|
1968
|
+
extrudeMethod: EExtrude4.eLinearOrtho,
|
|
1969
|
+
length: param.AMH - param.DH,
|
|
1970
|
+
rotate: [0, 0, 0],
|
|
1971
|
+
translate: [0, 0, param.DH]
|
|
1972
|
+
},
|
|
1973
|
+
{
|
|
1974
|
+
outName: `subpax_${designName}_roofE`,
|
|
1975
|
+
face: `${designName}_faceRoofEast`,
|
|
1976
|
+
extrudeMethod: EExtrude4.eLinearOrtho,
|
|
1977
|
+
length: lX,
|
|
1978
|
+
rotate: [pi2, 0, pi2],
|
|
1979
|
+
translate: [0, -param.MW, 0]
|
|
1980
|
+
},
|
|
1981
|
+
{
|
|
1982
|
+
outName: `subpax_${designName}_roofN`,
|
|
1983
|
+
face: `${designName}_faceRoofNorth`,
|
|
1984
|
+
extrudeMethod: EExtrude4.eLinearOrtho,
|
|
1985
|
+
length: lY,
|
|
1986
|
+
rotate: [pi2, 0, 2 * pi2],
|
|
1987
|
+
translate: [lX + param.MW, 0, 0]
|
|
1988
|
+
},
|
|
1989
|
+
{
|
|
1990
|
+
outName: `subpax_${designName}_w1`,
|
|
1991
|
+
face: `${designName}_faceWindow`,
|
|
1992
|
+
extrudeMethod: EExtrude4.eLinearOrtho,
|
|
1993
|
+
length: lWindowCut,
|
|
1994
|
+
rotate: [pi2, 0, 0],
|
|
1995
|
+
translate: [wPx1, lWindowCut - param.MW, 0]
|
|
1996
|
+
},
|
|
1997
|
+
{
|
|
1998
|
+
outName: `subpax_${designName}_w2`,
|
|
1999
|
+
face: `${designName}_faceWindow`,
|
|
2000
|
+
extrudeMethod: EExtrude4.eLinearOrtho,
|
|
2001
|
+
length: lWindowCut,
|
|
2002
|
+
rotate: [pi2, 0, 0],
|
|
2003
|
+
translate: [wPx2, lWindowCut - param.MW, 0]
|
|
2004
|
+
},
|
|
2005
|
+
{
|
|
2006
|
+
outName: `subpax_${designName}_w3`,
|
|
2007
|
+
face: `${designName}_faceWindow`,
|
|
2008
|
+
extrudeMethod: EExtrude4.eLinearOrtho,
|
|
2009
|
+
length: lWindowCut,
|
|
2010
|
+
rotate: [pi2, 0, pi2],
|
|
2011
|
+
translate: [lX + param.MW - lWindowCut, wPy3, 0]
|
|
2012
|
+
},
|
|
2013
|
+
{
|
|
2014
|
+
outName: `subpax_${designName}_frigo`,
|
|
2015
|
+
face: `${designName}_faceFrigo`,
|
|
2016
|
+
extrudeMethod: EExtrude4.eLinearOrtho,
|
|
2017
|
+
length: param.FH,
|
|
2018
|
+
rotate: [0, 0, 0],
|
|
2019
|
+
translate: [0, 0, 0]
|
|
2020
|
+
},
|
|
2021
|
+
{
|
|
2022
|
+
outName: `subpax_${designName}_vaissCagi`,
|
|
2023
|
+
face: `${designName}_faceVaissCagi`,
|
|
2024
|
+
extrudeMethod: EExtrude4.eLinearOrtho,
|
|
2025
|
+
length: param.AMH,
|
|
2026
|
+
rotate: [0, 0, 0],
|
|
2027
|
+
translate: [0, 0, 0]
|
|
2028
|
+
},
|
|
2029
|
+
{
|
|
2030
|
+
outName: `subpax_${designName}_cuis`,
|
|
2031
|
+
face: `${designName}_faceCuis`,
|
|
2032
|
+
extrudeMethod: EExtrude4.eLinearOrtho,
|
|
2033
|
+
length: param.PTH,
|
|
2034
|
+
rotate: [0, 0, 0],
|
|
2035
|
+
translate: [0, 0, 0]
|
|
2036
|
+
},
|
|
2037
|
+
{
|
|
2038
|
+
outName: `subpax_${designName}_bar`,
|
|
2039
|
+
face: `${designName}_faceBar`,
|
|
2040
|
+
extrudeMethod: EExtrude4.eLinearOrtho,
|
|
2041
|
+
length: barThickness,
|
|
2042
|
+
rotate: [0, 0, 0],
|
|
2043
|
+
translate: [0, 0, param.BarH - barThickness]
|
|
2044
|
+
}
|
|
2045
|
+
],
|
|
2046
|
+
volumes: [
|
|
2047
|
+
{
|
|
2048
|
+
outName: `ipax_${designName}_add1`,
|
|
2049
|
+
boolMethod: EBVolume4.eUnion,
|
|
2050
|
+
inList: lCuis
|
|
2051
|
+
},
|
|
2052
|
+
{
|
|
2053
|
+
outName: `ipax_${designName}_add2`,
|
|
2054
|
+
boolMethod: EBVolume4.eUnion,
|
|
2055
|
+
inList: [`subpax_${designName}_roofE`, `subpax_${designName}_roofN`]
|
|
2056
|
+
},
|
|
2057
|
+
{
|
|
2058
|
+
outName: `ipax_${designName}_cut`,
|
|
2059
|
+
boolMethod: EBVolume4.eUnion,
|
|
2060
|
+
inList: [
|
|
2061
|
+
`subpax_${designName}_w1`,
|
|
2062
|
+
`subpax_${designName}_w2`,
|
|
2063
|
+
`subpax_${designName}_w3`
|
|
2064
|
+
]
|
|
2065
|
+
},
|
|
2066
|
+
{
|
|
2067
|
+
outName: `ipax_${designName}_roof`,
|
|
2068
|
+
boolMethod: EBVolume4.eSubstraction,
|
|
2069
|
+
inList: [`ipax_${designName}_add2`, `ipax_${designName}_cut`]
|
|
2070
|
+
},
|
|
2071
|
+
{
|
|
2072
|
+
outName: `pax_${designName}`,
|
|
2073
|
+
boolMethod: EBVolume4.eUnion,
|
|
2074
|
+
inList: [`ipax_${designName}_add1`, `ipax_${designName}_roof`]
|
|
2075
|
+
}
|
|
2076
|
+
]
|
|
2077
|
+
};
|
|
2078
|
+
rGeome.sub = {};
|
|
2079
|
+
rGeome.logstr += "Cuisine drawn successfully!\n";
|
|
2080
|
+
rGeome.calcErr = false;
|
|
2081
|
+
} catch (emsg) {
|
|
2082
|
+
rGeome.logstr += emsg;
|
|
2083
|
+
console.log(emsg);
|
|
2084
|
+
}
|
|
2085
|
+
return rGeome;
|
|
2086
|
+
}
|
|
2087
|
+
var cuisineDef = {
|
|
2088
|
+
pTitle: "cuisine",
|
|
2089
|
+
pDescription: "A cuisine under the roof",
|
|
2090
|
+
pDef: pDef4,
|
|
2091
|
+
pGeom: pGeom4
|
|
2092
|
+
};
|
|
2093
|
+
|
|
2094
|
+
// src/stone/stairs.ts
|
|
2095
|
+
import {
|
|
2096
|
+
point as point2,
|
|
2097
|
+
contour as contour5,
|
|
2098
|
+
contourCircle as contourCircle4,
|
|
2099
|
+
ctrRectangle as ctrRectangle4,
|
|
2100
|
+
figure as figure5,
|
|
2101
|
+
radToDeg as radToDeg3,
|
|
2102
|
+
ffix as ffix4,
|
|
2103
|
+
pNumber as pNumber5,
|
|
2104
|
+
pDropdown as pDropdown2,
|
|
2105
|
+
pSectionSeparator as pSectionSeparator5,
|
|
2106
|
+
EExtrude as EExtrude5,
|
|
2107
|
+
EBVolume as EBVolume5,
|
|
2108
|
+
initGeom as initGeom5
|
|
2109
|
+
} from "geometrix";
|
|
2110
|
+
var pDef5 = {
|
|
1752
2111
|
partName: "stairs",
|
|
1753
2112
|
params: [
|
|
1754
2113
|
//pNumber(name, unit, init, min, max, step)
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
2114
|
+
pNumber5("Nn", "stair", 25, 1, 200, 1),
|
|
2115
|
+
pNumber5("Nd", "stair", 20, 2, 200, 1),
|
|
2116
|
+
pNumber5("D1", "mm", 5e3, 1e3, 5e4, 1),
|
|
2117
|
+
pNumber5("Wi1", "mm", 1e3, 1, 1e4, 1),
|
|
2118
|
+
pNumber5("We1", "mm", 1e3, 1, 1e4, 1),
|
|
2119
|
+
pNumber5("Wi2", "mm", 2e3, 1, 1e4, 1),
|
|
2120
|
+
pNumber5("We2", "mm", 2e3, 1, 1e4, 1),
|
|
2121
|
+
pSectionSeparator5("Details"),
|
|
1763
2122
|
pDropdown2("spiral", ["ExtInt", "Exterior", "Interior"]),
|
|
1764
2123
|
pDropdown2("border", ["arc", "straight"]),
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
2124
|
+
pNumber5("H1", "mm", 200, 10, 2e3, 1),
|
|
2125
|
+
pNumber5("H1b", "mm", 100, 0, 2e3, 1),
|
|
2126
|
+
pNumber5("Wc", "mm", 200, 10, 2e3, 1),
|
|
2127
|
+
pNumber5("Nc", "column", 6, 0, 100, 1)
|
|
1769
2128
|
],
|
|
1770
2129
|
paramSvg: {
|
|
1771
2130
|
Nn: "stairs_top.svg",
|
|
@@ -1789,12 +2148,12 @@ var pDef4 = {
|
|
|
1789
2148
|
// every 0.5 second
|
|
1790
2149
|
}
|
|
1791
2150
|
};
|
|
1792
|
-
function
|
|
1793
|
-
const rGeome =
|
|
1794
|
-
const figTop =
|
|
1795
|
-
const figTopColumn =
|
|
1796
|
-
const figBorderI =
|
|
1797
|
-
const figBorderE =
|
|
2151
|
+
function pGeom5(t, param, suffix = "") {
|
|
2152
|
+
const rGeome = initGeom5(pDef5.partName + suffix);
|
|
2153
|
+
const figTop = figure5();
|
|
2154
|
+
const figTopColumn = figure5();
|
|
2155
|
+
const figBorderI = figure5();
|
|
2156
|
+
const figBorderE = figure5();
|
|
1798
2157
|
rGeome.logstr += `${rGeome.partName} simTime: ${t}
|
|
1799
2158
|
`;
|
|
1800
2159
|
try {
|
|
@@ -1806,7 +2165,7 @@ function pGeom4(t, param, suffix = "") {
|
|
|
1806
2165
|
return [rpt, rab];
|
|
1807
2166
|
}, ctrPolygon2 = function(iN, ird, iSign) {
|
|
1808
2167
|
const [pp0] = ptSpiral2(ird, 0, iSign);
|
|
1809
|
-
const rCtr =
|
|
2168
|
+
const rCtr = contour5(pp0.cx, pp0.cy);
|
|
1810
2169
|
for (let ii = 1; ii < iN; ii++) {
|
|
1811
2170
|
const [ppi] = ptSpiral2(ird, ii, iSign);
|
|
1812
2171
|
rCtr.addSegStrokeA(ppi.cx, ppi.cy);
|
|
@@ -1821,7 +2180,7 @@ function pGeom4(t, param, suffix = "") {
|
|
|
1821
2180
|
const rp3 = pc.translatePolar(ab + 2 * aStair2, rr);
|
|
1822
2181
|
return [rp1, rp2, rp3];
|
|
1823
2182
|
}, ctrStair2 = function(pi1, pi22, pi3, pe1, pe2, pe3) {
|
|
1824
|
-
const rCtr =
|
|
2183
|
+
const rCtr = contour5(pe1.cx, pe1.cy);
|
|
1825
2184
|
if (param.border === 0) {
|
|
1826
2185
|
rCtr.addPointA(pe2.cx, pe2.cy).addPointA(pe3.cx, pe3.cy).addSegArc2();
|
|
1827
2186
|
} else {
|
|
@@ -1869,9 +2228,9 @@ function pGeom4(t, param, suffix = "") {
|
|
|
1869
2228
|
if (param.We1 < param.Wc) {
|
|
1870
2229
|
throw `err113: We1 ${param.We1} is too small compare to Wc ${param.Wc}`;
|
|
1871
2230
|
}
|
|
1872
|
-
rGeome.logstr += `Stair angle ${
|
|
2231
|
+
rGeome.logstr += `Stair angle ${ffix4(radToDeg3(2 * aStair2))} degree
|
|
1873
2232
|
`;
|
|
1874
|
-
rGeome.logstr += `Stairs angle ${
|
|
2233
|
+
rGeome.logstr += `Stairs angle ${ffix4(param.Nn / param.Nd)} turn with ${columnNb} columns
|
|
1875
2234
|
`;
|
|
1876
2235
|
const ctrCircleRef = contourCircle4(0, 0, R1);
|
|
1877
2236
|
const ctrPolygonI = ctrPolygon2(param.Nd, Rid, -1);
|
|
@@ -1929,9 +2288,9 @@ function pGeom4(t, param, suffix = "") {
|
|
|
1929
2288
|
for (let ii = 0; ii < param.Nn; ii++) {
|
|
1930
2289
|
const lStair = (R1 - param.Wi1 - ii * Wid) * 2 * aStair2;
|
|
1931
2290
|
const yy = ii * param.H1;
|
|
1932
|
-
figBorderI.addMainO(
|
|
2291
|
+
figBorderI.addMainO(ctrRectangle4(xx, yy, lStair, param.H1));
|
|
1933
2292
|
if ((ii + 1) % Nc === 0 && yy > 0) {
|
|
1934
|
-
figBorderI.addMainO(
|
|
2293
|
+
figBorderI.addMainO(ctrRectangle4(xx, 0, lStair, yy));
|
|
1935
2294
|
colHeight.push(yy);
|
|
1936
2295
|
}
|
|
1937
2296
|
xx += lStair;
|
|
@@ -1941,9 +2300,9 @@ function pGeom4(t, param, suffix = "") {
|
|
|
1941
2300
|
for (let ii = 0; ii < param.Nn; ii++) {
|
|
1942
2301
|
const lStair = (R1 + param.We1 - ii * Wed) * 2 * aStair2;
|
|
1943
2302
|
const yy = ii * param.H1;
|
|
1944
|
-
figBorderE.addMainO(
|
|
2303
|
+
figBorderE.addMainO(ctrRectangle4(xx, yy, lStair, param.H1));
|
|
1945
2304
|
if ((ii + 1) % Nc === 0 && yy > 0) {
|
|
1946
|
-
figBorderE.addMainO(
|
|
2305
|
+
figBorderE.addMainO(ctrRectangle4(xx, 0, lStair, yy));
|
|
1947
2306
|
}
|
|
1948
2307
|
xx += lStair;
|
|
1949
2308
|
}
|
|
@@ -1953,7 +2312,7 @@ function pGeom4(t, param, suffix = "") {
|
|
|
1953
2312
|
const listVolName = [];
|
|
1954
2313
|
const designName = rGeome.partName;
|
|
1955
2314
|
for (const [idx, elem] of ctrListStair.entries()) {
|
|
1956
|
-
const iFig =
|
|
2315
|
+
const iFig = figure5();
|
|
1957
2316
|
iFig.addMainO(elem);
|
|
1958
2317
|
const iStr = `Stair${idx.toString().padStart(4, "0")}`;
|
|
1959
2318
|
const iFace = `face${iStr}`;
|
|
@@ -1962,7 +2321,7 @@ function pGeom4(t, param, suffix = "") {
|
|
|
1962
2321
|
listVol.push({
|
|
1963
2322
|
outName: `subpax_${designName}_${iStr}`,
|
|
1964
2323
|
face: `${designName}_${iFace}`,
|
|
1965
|
-
extrudeMethod:
|
|
2324
|
+
extrudeMethod: EExtrude5.eLinearOrtho,
|
|
1966
2325
|
length: param.H1 + H1plus,
|
|
1967
2326
|
rotate: [0, 0, 0],
|
|
1968
2327
|
translate: [0, 0, idx * param.H1 - H1plus]
|
|
@@ -1970,7 +2329,7 @@ function pGeom4(t, param, suffix = "") {
|
|
|
1970
2329
|
listVolName.push(`subpax_${designName}_${iStr}`);
|
|
1971
2330
|
}
|
|
1972
2331
|
for (const [idx, elem] of ctrListColumnI.entries()) {
|
|
1973
|
-
const iFig =
|
|
2332
|
+
const iFig = figure5();
|
|
1974
2333
|
iFig.addMainO(elem);
|
|
1975
2334
|
iFig.addMainO(ctrListColumnE[idx]);
|
|
1976
2335
|
const iStr = `Col${idx.toString().padStart(4, "0")}`;
|
|
@@ -1979,7 +2338,7 @@ function pGeom4(t, param, suffix = "") {
|
|
|
1979
2338
|
listVol.push({
|
|
1980
2339
|
outName: `subpax_${designName}_${iStr}`,
|
|
1981
2340
|
face: `${designName}_${iFace}`,
|
|
1982
|
-
extrudeMethod:
|
|
2341
|
+
extrudeMethod: EExtrude5.eLinearOrtho,
|
|
1983
2342
|
length: colHeight[idx],
|
|
1984
2343
|
rotate: [0, 0, 0],
|
|
1985
2344
|
translate: [0, 0, 0]
|
|
@@ -1999,7 +2358,7 @@ function pGeom4(t, param, suffix = "") {
|
|
|
1999
2358
|
volumes: [
|
|
2000
2359
|
{
|
|
2001
2360
|
outName: `pax_${designName}`,
|
|
2002
|
-
boolMethod:
|
|
2361
|
+
boolMethod: EBVolume5.eUnion,
|
|
2003
2362
|
inList: listVolName
|
|
2004
2363
|
}
|
|
2005
2364
|
]
|
|
@@ -2016,12 +2375,1176 @@ function pGeom4(t, param, suffix = "") {
|
|
|
2016
2375
|
var stairsDef = {
|
|
2017
2376
|
pTitle: "stairs",
|
|
2018
2377
|
pDescription: "an helicoidal stairs",
|
|
2019
|
-
pDef:
|
|
2020
|
-
pGeom:
|
|
2378
|
+
pDef: pDef5,
|
|
2379
|
+
pGeom: pGeom5
|
|
2380
|
+
};
|
|
2381
|
+
|
|
2382
|
+
// src/bot/scara.ts
|
|
2383
|
+
import {
|
|
2384
|
+
point as point3,
|
|
2385
|
+
contour as contour6,
|
|
2386
|
+
contourCircle as contourCircle5,
|
|
2387
|
+
ctrRectangle as ctrRectangle5,
|
|
2388
|
+
figure as figure6,
|
|
2389
|
+
degToRad as degToRad3,
|
|
2390
|
+
radToDeg as radToDeg4,
|
|
2391
|
+
ffix as ffix5,
|
|
2392
|
+
pNumber as pNumber6,
|
|
2393
|
+
pCheckbox as pCheckbox3,
|
|
2394
|
+
pDropdown as pDropdown3,
|
|
2395
|
+
pSectionSeparator as pSectionSeparator6,
|
|
2396
|
+
initGeom as initGeom6,
|
|
2397
|
+
EExtrude as EExtrude6,
|
|
2398
|
+
EBVolume as EBVolume6
|
|
2399
|
+
} from "geometrix";
|
|
2400
|
+
var pDef6 = {
|
|
2401
|
+
// partName is used in URL. Choose a name without slash, backslash and space.
|
|
2402
|
+
partName: "scara",
|
|
2403
|
+
params: [
|
|
2404
|
+
//pNumber(name, unit, init, min, max, step)
|
|
2405
|
+
pNumber6("L1", "mm", 200, 1, 2e3, 1),
|
|
2406
|
+
pNumber6("D11", "mm", 20, 1, 1e3, 1),
|
|
2407
|
+
pNumber6("D12", "mm", 60, 1, 1e3, 1),
|
|
2408
|
+
pNumber6("D21", "mm", 10, 1, 1e3, 1),
|
|
2409
|
+
pNumber6("D22", "mm", 40, 1, 1e3, 1),
|
|
2410
|
+
pDropdown3("firstEnd", ["intern", "extern"]),
|
|
2411
|
+
pDropdown3("secondEnd", ["extern", "intern"]),
|
|
2412
|
+
pSectionSeparator6("Internal details"),
|
|
2413
|
+
pNumber6("A1", "degree", 90, 0, 180, 1),
|
|
2414
|
+
pNumber6("T1", "mm", 2, 0.1, 100, 0.1),
|
|
2415
|
+
pNumber6("T2", "mm", 2, 0.1, 100, 0.1),
|
|
2416
|
+
pNumber6("S2", "mm", 30, 1, 1e3, 1),
|
|
2417
|
+
pNumber6("R1i", "mm", 1, 0, 100, 0.1),
|
|
2418
|
+
pNumber6("R1e", "mm", 0.5, 0, 100, 0.1),
|
|
2419
|
+
pCheckbox3("iiEn", true),
|
|
2420
|
+
pSectionSeparator6("External details"),
|
|
2421
|
+
pNumber6("N2", "legs", 2, 0, 2, 1),
|
|
2422
|
+
pNumber6("S1", "mm", 40, 1, 1e3, 1),
|
|
2423
|
+
pNumber6("T3", "mm", 2, 0.1, 100, 0.1),
|
|
2424
|
+
pNumber6("R2i", "mm", 1, 0, 100, 0.1),
|
|
2425
|
+
pNumber6("R2e", "mm", 0.5, 0, 100, 0.1),
|
|
2426
|
+
pSectionSeparator6("Heights"),
|
|
2427
|
+
pNumber6("H1", "mm", 50, 1, 1e3, 1),
|
|
2428
|
+
pNumber6("H2", "mm", 2, 0.1, 200, 0.1),
|
|
2429
|
+
pNumber6("H3", "mm", 5, 0, 200, 1),
|
|
2430
|
+
pNumber6("H41", "mm", 0, 0, 200, 0.1),
|
|
2431
|
+
pNumber6("H42", "mm", 0, 0, 200, 0.1)
|
|
2432
|
+
],
|
|
2433
|
+
paramSvg: {
|
|
2434
|
+
L1: "scara_top.svg",
|
|
2435
|
+
D11: "scara_top.svg",
|
|
2436
|
+
D12: "scara_top.svg",
|
|
2437
|
+
D21: "scara_top.svg",
|
|
2438
|
+
D22: "scara_top.svg",
|
|
2439
|
+
firstEnd: "scara_ends.svg",
|
|
2440
|
+
secondEnd: "scara_ends.svg",
|
|
2441
|
+
A1: "scara_top.svg",
|
|
2442
|
+
T1: "scara_top.svg",
|
|
2443
|
+
T2: "scara_top.svg",
|
|
2444
|
+
S2: "scara_top.svg",
|
|
2445
|
+
R1i: "scara_top.svg",
|
|
2446
|
+
R1e: "scara_top.svg",
|
|
2447
|
+
iiEn: "scara_top.svg",
|
|
2448
|
+
N2: "scara_top.svg",
|
|
2449
|
+
S1: "scara_top.svg",
|
|
2450
|
+
T3: "scara_top.svg",
|
|
2451
|
+
R2i: "scara_top.svg",
|
|
2452
|
+
R2e: "scara_top.svg",
|
|
2453
|
+
H1: "scara_side2.svg",
|
|
2454
|
+
H2: "scara_side.svg",
|
|
2455
|
+
H3: "scara_side.svg",
|
|
2456
|
+
H41: "scara_side.svg",
|
|
2457
|
+
H42: "scara_side.svg"
|
|
2458
|
+
},
|
|
2459
|
+
sim: {
|
|
2460
|
+
tMax: 100,
|
|
2461
|
+
tStep: 0.5,
|
|
2462
|
+
tUpdate: 500
|
|
2463
|
+
// every 0.5 second
|
|
2464
|
+
}
|
|
2465
|
+
};
|
|
2466
|
+
function pGeom6(t, param, suffix = "") {
|
|
2467
|
+
const rGeome = initGeom6(pDef6.partName + suffix);
|
|
2468
|
+
const figPlate = figure6();
|
|
2469
|
+
const figIntern = figure6();
|
|
2470
|
+
const figExtern = figure6();
|
|
2471
|
+
const figH41 = figure6();
|
|
2472
|
+
const figH42 = figure6();
|
|
2473
|
+
const figSide = figure6();
|
|
2474
|
+
rGeome.logstr += `${rGeome.partName} simTime: ${t}
|
|
2475
|
+
`;
|
|
2476
|
+
try {
|
|
2477
|
+
let ctrI2 = function(iyk) {
|
|
2478
|
+
let tp0 = p7i;
|
|
2479
|
+
if (pFirstEnd === 1) {
|
|
2480
|
+
tp0 = p12d;
|
|
2481
|
+
}
|
|
2482
|
+
const rCtr = contour6(tp0.cx, iyk * tp0.cy).addCornerRounded(param.R1e);
|
|
2483
|
+
if (pFirstEnd === 0) {
|
|
2484
|
+
if (param.iiEn) {
|
|
2485
|
+
rCtr.addPointA(p7bi.cx, iyk * p7bi.cy).addSegArc(R7, false, iyk > 0 ? false : true).addCornerRounded(param.R1e).addSegStrokeA(p7be.cx, iyk * p7be.cy).addCornerRounded(param.R1e).addPointA(p7c.cx, iyk * p7c.cy).addSegArc(R12, false, iyk > 0 ? true : false).addCornerRounded(param.R1i);
|
|
2486
|
+
} else {
|
|
2487
|
+
rCtr.addPointA(p12.cx, iyk * p12.cy).addSegArc(
|
|
2488
|
+
R7,
|
|
2489
|
+
false,
|
|
2490
|
+
iyk > 0 ? false : true
|
|
2491
|
+
);
|
|
2492
|
+
}
|
|
2493
|
+
}
|
|
2494
|
+
if (pSecondEnd === 1) {
|
|
2495
|
+
rCtr.addSegStrokeA(p62d.cx, iyk * p62d.cy).addCornerRounded(param.R1e).addSegStrokeA(p6d.cx, iyk * p6d.cy).addCornerRounded(param.R1e);
|
|
2496
|
+
} else {
|
|
2497
|
+
if (param.iiEn) {
|
|
2498
|
+
rCtr.addSegStrokeA(p8c.cx, iyk * p8c.cy).addCornerRounded(param.R1i).addPointA(p8be.cx, iyk * p8be.cy).addSegArc(R12, false, iyk > 0 ? true : false).addCornerRounded(param.R1e).addSegStrokeA(p8bi.cx, iyk * p8bi.cy).addCornerRounded(param.R1e);
|
|
2499
|
+
} else {
|
|
2500
|
+
rCtr.addSegStrokeA(p62.cx, iyk * p62.cy);
|
|
2501
|
+
}
|
|
2502
|
+
rCtr.addPointA(p8i.cx, iyk * p8i.cy).addSegArc(R8, false, iyk > 0 ? false : true).addCornerRounded(param.R1e).addSegStrokeA(p8e.cx, iyk * p8e.cy).addCornerRounded(param.R1e).addPointA(p6.cx, iyk * p6.cy).addSegArc(R22, false, iyk > 0 ? true : false);
|
|
2503
|
+
}
|
|
2504
|
+
if (pFirstEnd === 1) {
|
|
2505
|
+
rCtr.addSegStrokeA(p1d.cx, iyk * p1d.cy).addCornerRounded(param.R1e).closeSegStroke();
|
|
2506
|
+
} else {
|
|
2507
|
+
rCtr.addSegStrokeA(p1.cx, iyk * p1.cy).addPointA(p7e.cx, iyk * p7e.cy).addSegArc(R12, false, iyk > 0 ? true : false).addCornerRounded(param.R1e).closeSegStroke();
|
|
2508
|
+
}
|
|
2509
|
+
return rCtr;
|
|
2510
|
+
};
|
|
2511
|
+
var ctrI = ctrI2;
|
|
2512
|
+
const a1 = degToRad3(param.A1) / 2;
|
|
2513
|
+
const R11 = param.D11 / 2;
|
|
2514
|
+
const R12 = param.D12 / 2;
|
|
2515
|
+
const R21 = param.D21 / 2;
|
|
2516
|
+
const R22 = param.D22 / 2;
|
|
2517
|
+
const X2 = R12 + param.L1;
|
|
2518
|
+
const Ltot = X2 + R22;
|
|
2519
|
+
const aIncli = Math.atan2(R22 - R12, param.L1);
|
|
2520
|
+
const R7 = R12 - param.T2;
|
|
2521
|
+
const R8 = R22 - param.T2;
|
|
2522
|
+
const R91 = R11 + param.T3;
|
|
2523
|
+
const R92 = R21 + param.T3;
|
|
2524
|
+
const a91 = Math.asin(param.T3 / (2 * R91));
|
|
2525
|
+
const a92 = Math.asin(param.T3 / (2 * R92));
|
|
2526
|
+
const pi2 = Math.PI / 2;
|
|
2527
|
+
const aP1 = pi2 + aIncli;
|
|
2528
|
+
const He = Math.max(param.H3, param.H41, param.H42);
|
|
2529
|
+
const Htot = param.H1 + 2 * (param.H2 + He);
|
|
2530
|
+
const Hl5 = He + 2 * param.H2 + param.H1;
|
|
2531
|
+
const a7c = aP1 - Math.acos(R7 / R12);
|
|
2532
|
+
const a8c = aP1 + Math.acos(R8 / R22);
|
|
2533
|
+
const pFirstEnd = param.firstEnd;
|
|
2534
|
+
const pSecondEnd = param.secondEnd === 1 ? 0 : 1;
|
|
2535
|
+
const T32 = param.T3 / 2;
|
|
2536
|
+
const p1 = point3(R12, 0).translatePolar(aP1, R12);
|
|
2537
|
+
const p6 = point3(X2, 0).translatePolar(aP1, R22);
|
|
2538
|
+
const p12 = point3(R12, 0).translatePolar(aP1, R12 - param.T2);
|
|
2539
|
+
const p62 = point3(X2, 0).translatePolar(aP1, R22 - param.T2);
|
|
2540
|
+
const p13 = point3(R12, 0).translatePolar(aP1, R12 - param.T3);
|
|
2541
|
+
const p63 = point3(X2, 0).translatePolar(aP1, R22 - param.T3);
|
|
2542
|
+
const l1d = (R12 + param.S1 - p1.cx) / Math.cos(aIncli);
|
|
2543
|
+
const l12d = (R12 + param.S1 - p12.cx) / Math.cos(aIncli);
|
|
2544
|
+
const l13d = (R12 + param.S1 - p13.cx) / Math.cos(aIncli);
|
|
2545
|
+
const l6d = (p6.cx - (X2 - param.S2)) / Math.cos(aIncli);
|
|
2546
|
+
const l62d = (p62.cx - (X2 - param.S2)) / Math.cos(aIncli);
|
|
2547
|
+
const l63d = (p63.cx - (X2 - param.S2)) / Math.cos(aIncli);
|
|
2548
|
+
if (param.L1 < R12 + R22) {
|
|
2549
|
+
throw `err095: L1 ${ffix5(param.L1)} is too small compare to D12 ${ffix5(2 * R12)} and D22 ${ffix5(2 * R22)}`;
|
|
2550
|
+
}
|
|
2551
|
+
if (R12 < R11 + 2 * param.T3) {
|
|
2552
|
+
throw `err132: D12 ${ffix5(2 * R12)} is too small compare to D11 ${ffix5(2 * R11)} and T3 ${ffix5(param.T3)}`;
|
|
2553
|
+
}
|
|
2554
|
+
if (R22 < R21 + 2 * param.T3) {
|
|
2555
|
+
throw `err135: D22 ${ffix5(2 * R22)} is too small compare to D21 ${ffix5(2 * R21)} and T3 ${ffix5(param.T3)}`;
|
|
2556
|
+
}
|
|
2557
|
+
if (R12 < R11 + param.T1 + param.T2) {
|
|
2558
|
+
throw `err142: D12 ${ffix5(2 * R12)} is too small compare to T1 ${ffix5(param.T1)} and T2 ${ffix5(param.T2)}`;
|
|
2559
|
+
}
|
|
2560
|
+
if (R22 < R21 + param.T1 + param.T2) {
|
|
2561
|
+
throw `err145: D22 ${ffix5(2 * R22)} is too small compare to T1 ${ffix5(param.T1)} and T2 ${ffix5(param.T2)}`;
|
|
2562
|
+
}
|
|
2563
|
+
if (aP1 < a1) {
|
|
2564
|
+
throw `err148: aIncli ${ffix5(radToDeg4(aIncli))} is too small compare to A1 ${ffix5(radToDeg4(2 * a1))}`;
|
|
2565
|
+
}
|
|
2566
|
+
if (param.iiEn && a7c < a1) {
|
|
2567
|
+
throw `err163: aIncli ${ffix5(radToDeg4(aIncli))} is too small compare to A1 ${ffix5(radToDeg4(2 * a1))}`;
|
|
2568
|
+
}
|
|
2569
|
+
if (param.S1 < R12 / 2) {
|
|
2570
|
+
throw `err178: S1 ${ffix5(param.S1)} is too small compare to D12 ${ffix5(2 * R12)}`;
|
|
2571
|
+
}
|
|
2572
|
+
if (param.S2 < R22 / 2) {
|
|
2573
|
+
throw `err181: S2 ${ffix5(param.S2)} is too small compare to D22 ${ffix5(2 * R22)}`;
|
|
2574
|
+
}
|
|
2575
|
+
if (param.L1 < param.S1 + param.S2) {
|
|
2576
|
+
throw `err184: L1 ${ffix5(param.L1)} is too small compare to S1 ${ffix5(param.S1)} and S2 ${ffix5(param.S2)}`;
|
|
2577
|
+
}
|
|
2578
|
+
if (l1d <= 0 || l12d <= 0 || l13d <= 0) {
|
|
2579
|
+
throw `err189: S1 ${ffix5(param.S1)} is too small`;
|
|
2580
|
+
}
|
|
2581
|
+
if (l6d <= 0 || l62d <= 0 || l63d <= 0) {
|
|
2582
|
+
throw `err170: S2 ${ffix5(param.S2)} is too small`;
|
|
2583
|
+
}
|
|
2584
|
+
if (param.H3 === 0) {
|
|
2585
|
+
rGeome.logstr += "warn167: Warning H3 is zero\n";
|
|
2586
|
+
}
|
|
2587
|
+
rGeome.logstr += `length ${ffix5(Ltot)} height ${ffix5(Htot)}
|
|
2588
|
+
`;
|
|
2589
|
+
const p7e = point3(R12, 0).translatePolar(Math.PI - a1, R12);
|
|
2590
|
+
const p7i = point3(R12, 0).translatePolar(Math.PI - a1, R12 - param.T2);
|
|
2591
|
+
const p7be = point3(R12, 0).translatePolar(a1, R12);
|
|
2592
|
+
const p7bi = point3(R12, 0).translatePolar(a1, R12 - param.T2);
|
|
2593
|
+
const p7c = point3(R12, 0).translatePolar(a7c, R12);
|
|
2594
|
+
const p8e = point3(X2, 0).translatePolar(a1, R22);
|
|
2595
|
+
const p8i = point3(X2, 0).translatePolar(a1, R22 - param.T2);
|
|
2596
|
+
const p8be = point3(X2, 0).translatePolar(Math.PI - a1, R22);
|
|
2597
|
+
const p8bi = point3(X2, 0).translatePolar(Math.PI - a1, R22 - param.T2);
|
|
2598
|
+
const p8c = point3(X2, 0).translatePolar(a8c, R22);
|
|
2599
|
+
const p91 = point3(R12, 0).translatePolar(a91, R91);
|
|
2600
|
+
const p92 = point3(X2, 0).translatePolar(Math.PI - a92, R92);
|
|
2601
|
+
const p1d = p1.translatePolar(aP1 - pi2, l1d);
|
|
2602
|
+
const p12d = p12.translatePolar(aP1 - pi2, l12d);
|
|
2603
|
+
const p13d = p13.translatePolar(aP1 - pi2, l13d);
|
|
2604
|
+
const p6d = p6.translatePolar(aP1 + pi2, l6d);
|
|
2605
|
+
const p62d = p62.translatePolar(aP1 + pi2, l62d);
|
|
2606
|
+
const p63d = p63.translatePolar(aP1 + pi2, l63d);
|
|
2607
|
+
const ctrPlate = contour6(p1.cx, p1.cy).addPointA(0, 0).addPointA(p1.cx, -p1.cy).addSegArc2().addSegStrokeA(p6.cx, -p6.cy).addPointA(Ltot, 0).addPointA(p6.cx, p6.cy).addSegArc2().closeSegStroke();
|
|
2608
|
+
figPlate.addMainOI([ctrPlate, contourCircle5(R12, 0, R11), contourCircle5(X2, 0, R21)]);
|
|
2609
|
+
if (param.N2 === 0) {
|
|
2610
|
+
if (pFirstEnd === 0 && pSecondEnd === 1) {
|
|
2611
|
+
const ctrE1 = contour6(p1d.cx, p1d.cy).addCornerRounded(param.R2e).addSegStrokeA(p13d.cx, p13d.cy).addCornerRounded(param.R2e).addSegStrokeA(p63.cx, p63.cy).addPointA(Ltot - param.T3, 0).addPointA(p63.cx, -p63.cy).addSegArc2().addSegStrokeA(p13d.cx, -p13d.cy).addCornerRounded(param.R2e).addSegStrokeA(p1d.cx, -p1d.cy).addCornerRounded(param.R2e).addSegStrokeA(p6.cx, -p6.cy).addPointA(Ltot, 0).addPointA(p6.cx, p6.cy).addSegArc2().closeSegStroke();
|
|
2612
|
+
figExtern.addMainO(ctrE1);
|
|
2613
|
+
const ctrE3 = contour6(R12 + param.S1, T32).addCornerRounded(param.R2e).addSegStrokeA(R12 + param.S1, -T32).addCornerRounded(param.R2e).addSegStrokeA(p92.cx, -p92.cy).addCornerRounded(param.R2i).addPointA(X2 + R92, 0).addPointA(p92.cx, p92.cy).addSegArc2().addCornerRounded(param.R2i).closeSegStroke();
|
|
2614
|
+
figExtern.addMainOI([ctrE3, contourCircle5(X2, 0, R21)]);
|
|
2615
|
+
} else if (pFirstEnd === 1 && pSecondEnd === 0) {
|
|
2616
|
+
const ctrE1 = contour6(p63d.cx, p63d.cy).addCornerRounded(param.R2e).addSegStrokeA(p6d.cx, p6d.cy).addCornerRounded(param.R2e).addSegStrokeA(p1.cx, p1.cy).addPointA(0, 0).addPointA(p1.cx, -p1.cy).addSegArc2().addSegStrokeA(p6d.cx, -p6d.cy).addCornerRounded(param.R2e).addSegStrokeA(p63d.cx, -p63d.cy).addCornerRounded(param.R2e).addSegStrokeA(p13.cx, -p13.cy).addPointA(param.T3, 0).addPointA(p13.cx, p13.cy).addSegArc2().closeSegStroke();
|
|
2617
|
+
figExtern.addMainO(ctrE1);
|
|
2618
|
+
const ctrE3 = contour6(p91.cx, p91.cy).addCornerRounded(param.R2i).addPointA(R12 - R91, 0).addPointA(p91.cx, -p91.cy).addSegArc2().addCornerRounded(param.R2i).addSegStrokeA(X2 - param.S2, -T32).addCornerRounded(param.R2e).addSegStrokeA(X2 - param.S2, T32).addCornerRounded(param.R2e).closeSegStroke();
|
|
2619
|
+
figExtern.addMainOI([ctrE3, contourCircle5(R12, 0, R11)]);
|
|
2620
|
+
} else {
|
|
2621
|
+
const ctrE2 = contour6(p13.cx, p13.cy).addPointA(param.T3, 0).addPointA(p13.cx, -p13.cy).addSegArc2().addSegStrokeA(p63.cx, -p63.cy).addPointA(Ltot - param.T3, 0).addPointA(p63.cx, p63.cy).addSegArc2().closeSegStroke();
|
|
2622
|
+
figExtern.addMainOI([ctrPlate, ctrE2]);
|
|
2623
|
+
const ctrE3 = contour6(p91.cx, p91.cy).addCornerRounded(param.R2i).addPointA(R12 - R91, 0).addPointA(p91.cx, -p91.cy).addSegArc2().addCornerRounded(param.R2i).addSegStrokeA(p92.cx, -p92.cy).addCornerRounded(param.R2i).addPointA(X2 + R92, 0).addPointA(p92.cx, p92.cy).addSegArc2().addCornerRounded(param.R2i).closeSegStroke();
|
|
2624
|
+
figExtern.addMainOI([ctrE3, contourCircle5(R12, 0, R11), contourCircle5(X2, 0, R21)]);
|
|
2625
|
+
}
|
|
2626
|
+
} else {
|
|
2627
|
+
let ctrE52 = function(iX, iRe, iRi, iA, iP) {
|
|
2628
|
+
const tae = Math.asin(param.T3 / (2 * iRe));
|
|
2629
|
+
const tai = Math.asin(param.T3 / (2 * iRi));
|
|
2630
|
+
const tp1 = point3(iX, 0).translatePolar(iP - tae, iRe);
|
|
2631
|
+
const tp2 = point3(iX, 0).translatePolar(iP - tai, iRi);
|
|
2632
|
+
const tp3 = point3(iX, 0).translatePolar(iP - iA + tai, iRi);
|
|
2633
|
+
const tp4 = point3(iX, 0).translatePolar(iP - iA + tae, iRe);
|
|
2634
|
+
const rCtr = contour6(tp2.cx, tp2.cy).addCornerRounded(param.R2i).addPointA(tp3.cx, tp3.cy).addSegArc(iRi, false, false).addCornerRounded(param.R2i).addSegStrokeA(tp4.cx, tp4.cy).addCornerRounded(param.R2i).addPointA(tp1.cx, tp1.cy).addSegArc(iRe, false, true).addCornerRounded(param.R2i).closeSegStroke();
|
|
2635
|
+
return rCtr;
|
|
2636
|
+
};
|
|
2637
|
+
var ctrE5 = ctrE52;
|
|
2638
|
+
const aB = 2 * Math.PI / (param.N2 + 1);
|
|
2639
|
+
const NaB = (param.N2 - 1) / 2;
|
|
2640
|
+
const R93 = R12 - param.T3;
|
|
2641
|
+
const R94 = R22 - param.T3;
|
|
2642
|
+
const a93 = Math.asin(param.T3 / (2 * R93));
|
|
2643
|
+
const a94 = Math.asin(param.T3 / (2 * R94));
|
|
2644
|
+
const p93 = point3(R12, 0).translatePolar(Math.PI - (NaB * aB + a93), R93);
|
|
2645
|
+
const p94 = point3(X2, 0).translatePolar(NaB * aB + a94, R94);
|
|
2646
|
+
const p95 = point3(R12, 0).translatePolar(Math.PI - (NaB * aB + a91), R91);
|
|
2647
|
+
const p96 = point3(X2, 0).translatePolar(NaB * aB + a92, R92);
|
|
2648
|
+
const hollowL = [];
|
|
2649
|
+
const hollowR = [];
|
|
2650
|
+
hollowL.push(contourCircle5(R12, 0, R11));
|
|
2651
|
+
hollowR.push(contourCircle5(X2, 0, R21));
|
|
2652
|
+
for (let ii = 0; ii < param.N2 - 1; ii++) {
|
|
2653
|
+
hollowL.push(ctrE52(R12, R93, R91, aB, Math.PI + (NaB - ii) * aB));
|
|
2654
|
+
hollowR.push(ctrE52(X2, R94, R92, aB, (NaB - ii) * aB));
|
|
2655
|
+
}
|
|
2656
|
+
if (pFirstEnd === 0 && pSecondEnd === 1) {
|
|
2657
|
+
const ctrE6 = contour6(p13d.cx, p13d.cy).addCornerRounded(param.R2e).addSegStrokeA(p63.cx, p63.cy).addPointA(p94.cx, p94.cy).addSegArc(R94, false, false).addCornerRounded(param.R2i).addSegStrokeA(p96.cx, p96.cy).addCornerRounded(param.R2i).addPointA(p92.cx, p92.cy).addSegArc(R92, false, true).addCornerRounded(param.R2i).addSegStrokeA(R12 + param.S1, T32).addCornerRounded(param.R2e).addSegStrokeA(R12 + param.S1, -T32).addCornerRounded(param.R2e).addSegStrokeA(p92.cx, -p92.cy).addCornerRounded(param.R2i).addPointA(p96.cx, -p96.cy).addSegArc(R92, false, true).addCornerRounded(param.R2i).addSegStrokeA(p94.cx, -p94.cy).addCornerRounded(param.R2i).addPointA(p63.cx, -p63.cy).addSegArc(R94, false, false).addSegStrokeA(p13d.cx, -p13d.cy).addCornerRounded(param.R2e).addSegStrokeA(p1d.cx, -p1d.cy).addCornerRounded(param.R2e).addSegStrokeA(p6.cx, -p6.cy).addPointA(Ltot, 0).addPointA(p6.cx, p6.cy).addSegArc2().addSegStrokeA(p1d.cx, p1d.cy).addCornerRounded(param.R2e).closeSegStroke();
|
|
2658
|
+
figExtern.addMainOI([ctrE6, ...hollowR]);
|
|
2659
|
+
} else if (pFirstEnd === 1 && pSecondEnd === 0) {
|
|
2660
|
+
const ctrE6 = contour6(p63d.cx, p63d.cy).addCornerRounded(param.R2e).addSegStrokeA(p13.cx, p13.cy).addPointA(p93.cx, p93.cy).addSegArc(R93, false, true).addCornerRounded(param.R2i).addSegStrokeA(p95.cx, p95.cy).addCornerRounded(param.R2i).addPointA(p91.cx, p91.cy).addSegArc(R91, false, false).addCornerRounded(param.R2i).addSegStrokeA(X2 - param.S2, T32).addCornerRounded(param.R2e).addSegStrokeA(X2 - param.S2, -T32).addCornerRounded(param.R2e).addSegStrokeA(p91.cx, -p91.cy).addCornerRounded(param.R2i).addPointA(p95.cx, -p95.cy).addSegArc(R91, false, false).addCornerRounded(param.R2i).addSegStrokeA(p93.cx, -p93.cy).addCornerRounded(param.R2i).addPointA(p13.cx, -p13.cy).addSegArc(R93, false, true).addSegStrokeA(p63d.cx, -p63d.cy).addCornerRounded(param.R2e).addSegStrokeA(p6d.cx, -p6d.cy).addCornerRounded(param.R2e).addSegStrokeA(p1.cx, -p1.cy).addPointA(0, 0).addPointA(p1.cx, p1.cy).addSegArc2().addSegStrokeA(p6d.cx, p6d.cy).addCornerRounded(param.R2e).closeSegStroke();
|
|
2661
|
+
figExtern.addMainOI([ctrE6, ...hollowL]);
|
|
2662
|
+
} else {
|
|
2663
|
+
let ctrE42 = function(iyk) {
|
|
2664
|
+
const rCtr = contour6(p13.cx, iyk * p13.cy).addPointA(p93.cx, iyk * p93.cy).addSegArc(R93, false, iyk > 0 ? true : false).addCornerRounded(param.R2i).addSegStrokeA(p95.cx, iyk * p95.cy).addCornerRounded(param.R2i).addPointA(p91.cx, iyk * p91.cy).addSegArc(R91, false, iyk > 0 ? false : true).addCornerRounded(param.R2i).addSegStrokeA(p92.cx, iyk * p92.cy).addCornerRounded(param.R2i).addPointA(p96.cx, iyk * p96.cy).addSegArc(R92, false, iyk > 0 ? false : true).addCornerRounded(param.R2i).addSegStrokeA(p94.cx, iyk * p94.cy).addCornerRounded(param.R2i).addPointA(p63.cx, iyk * p63.cy).addSegArc(R94, false, iyk > 0 ? true : false).closeSegStroke();
|
|
2665
|
+
return rCtr;
|
|
2666
|
+
};
|
|
2667
|
+
var ctrE4 = ctrE42;
|
|
2668
|
+
figExtern.addMainOI([ctrPlate, ctrE42(1), ctrE42(-1), ...hollowL, ...hollowR]);
|
|
2669
|
+
}
|
|
2670
|
+
}
|
|
2671
|
+
figExtern.mergeFigure(figPlate, true);
|
|
2672
|
+
if (pFirstEnd === 0) {
|
|
2673
|
+
figIntern.addMainOI([
|
|
2674
|
+
contourCircle5(R12, 0, R11 + param.T1),
|
|
2675
|
+
contourCircle5(R12, 0, R11)
|
|
2676
|
+
]);
|
|
2677
|
+
}
|
|
2678
|
+
if (pSecondEnd === 0) {
|
|
2679
|
+
figIntern.addMainOI([contourCircle5(X2, 0, R21 + param.T1), contourCircle5(X2, 0, R21)]);
|
|
2680
|
+
}
|
|
2681
|
+
figIntern.addMainO(ctrI2(1));
|
|
2682
|
+
figIntern.addMainO(ctrI2(-1));
|
|
2683
|
+
figIntern.mergeFigure(figPlate, true);
|
|
2684
|
+
figH41.addMainOI([contourCircle5(R12, 0, R12), contourCircle5(R12, 0, R11)]);
|
|
2685
|
+
figH41.mergeFigure(figPlate, true);
|
|
2686
|
+
figH42.addMainOI([contourCircle5(X2, 0, R22), contourCircle5(X2, 0, R21)]);
|
|
2687
|
+
figH42.mergeFigure(figH41, true);
|
|
2688
|
+
figSide.addMainO(ctrRectangle5(0, He, Ltot, param.H2));
|
|
2689
|
+
figSide.addMainO(ctrRectangle5(0, He + param.H2 + param.H1, Ltot, param.H2));
|
|
2690
|
+
figSide.addSecond(ctrRectangle5(R12 - R11, 0, 2 * R11, Htot));
|
|
2691
|
+
figSide.addSecond(ctrRectangle5(X2 - R21, 0, 2 * R21, Htot));
|
|
2692
|
+
if (param.H41 > 0) {
|
|
2693
|
+
figSide.addMainO(ctrRectangle5(0, He - param.H41, 2 * R12, param.H41));
|
|
2694
|
+
figSide.addMainO(ctrRectangle5(0, Hl5, 2 * R12, param.H41));
|
|
2695
|
+
}
|
|
2696
|
+
if (param.H42 > 0) {
|
|
2697
|
+
figSide.addMainO(ctrRectangle5(X2 - R22, He - param.H42, 2 * R22, param.H42));
|
|
2698
|
+
figSide.addMainO(ctrRectangle5(X2 - R22, Hl5, 2 * R22, param.H42));
|
|
2699
|
+
}
|
|
2700
|
+
rGeome.fig = {
|
|
2701
|
+
facePlate: figPlate,
|
|
2702
|
+
faceIntern: figIntern,
|
|
2703
|
+
faceExtern: figExtern,
|
|
2704
|
+
faceH41: figH41,
|
|
2705
|
+
faceH42: figH42,
|
|
2706
|
+
faceSide: figSide
|
|
2707
|
+
};
|
|
2708
|
+
const designName = rGeome.partName;
|
|
2709
|
+
const eH4List = [];
|
|
2710
|
+
const vH4List = [];
|
|
2711
|
+
if (param.H3 > 0 && pFirstEnd + pSecondEnd > 0) {
|
|
2712
|
+
eH4List.push({
|
|
2713
|
+
outName: `subpax_${designName}_ext1`,
|
|
2714
|
+
face: `${designName}_faceExtern`,
|
|
2715
|
+
extrudeMethod: EExtrude6.eLinearOrtho,
|
|
2716
|
+
length: param.H3,
|
|
2717
|
+
rotate: [0, 0, 0],
|
|
2718
|
+
translate: [0, 0, He - param.H3]
|
|
2719
|
+
});
|
|
2720
|
+
eH4List.push({
|
|
2721
|
+
outName: `subpax_${designName}_ext5`,
|
|
2722
|
+
face: `${designName}_faceExtern`,
|
|
2723
|
+
extrudeMethod: EExtrude6.eLinearOrtho,
|
|
2724
|
+
length: param.H3,
|
|
2725
|
+
rotate: [0, 0, 0],
|
|
2726
|
+
translate: [0, 0, Hl5]
|
|
2727
|
+
});
|
|
2728
|
+
vH4List.push(`subpax_${designName}_ext1`, `subpax_${designName}_ext5`);
|
|
2729
|
+
}
|
|
2730
|
+
if (param.H41 > 0) {
|
|
2731
|
+
eH4List.push({
|
|
2732
|
+
outName: `subpax_${designName}_h41l`,
|
|
2733
|
+
face: `${designName}_faceH41`,
|
|
2734
|
+
extrudeMethod: EExtrude6.eLinearOrtho,
|
|
2735
|
+
length: param.H41,
|
|
2736
|
+
rotate: [0, 0, 0],
|
|
2737
|
+
translate: [0, 0, He - param.H41]
|
|
2738
|
+
});
|
|
2739
|
+
eH4List.push({
|
|
2740
|
+
outName: `subpax_${designName}_h41h`,
|
|
2741
|
+
face: `${designName}_faceH41`,
|
|
2742
|
+
extrudeMethod: EExtrude6.eLinearOrtho,
|
|
2743
|
+
length: param.H41,
|
|
2744
|
+
rotate: [0, 0, 0],
|
|
2745
|
+
translate: [0, 0, Hl5]
|
|
2746
|
+
});
|
|
2747
|
+
vH4List.push(`subpax_${designName}_h41l`, `subpax_${designName}_h41h`);
|
|
2748
|
+
}
|
|
2749
|
+
if (param.H42 > 0) {
|
|
2750
|
+
eH4List.push({
|
|
2751
|
+
outName: `subpax_${designName}_h42l`,
|
|
2752
|
+
face: `${designName}_faceH42`,
|
|
2753
|
+
extrudeMethod: EExtrude6.eLinearOrtho,
|
|
2754
|
+
length: param.H42,
|
|
2755
|
+
rotate: [0, 0, 0],
|
|
2756
|
+
translate: [0, 0, He - param.H42]
|
|
2757
|
+
});
|
|
2758
|
+
eH4List.push({
|
|
2759
|
+
outName: `subpax_${designName}_h42h`,
|
|
2760
|
+
face: `${designName}_faceH42`,
|
|
2761
|
+
extrudeMethod: EExtrude6.eLinearOrtho,
|
|
2762
|
+
length: param.H42,
|
|
2763
|
+
rotate: [0, 0, 0],
|
|
2764
|
+
translate: [0, 0, Hl5]
|
|
2765
|
+
});
|
|
2766
|
+
vH4List.push(`subpax_${designName}_h42l`, `subpax_${designName}_h42h`);
|
|
2767
|
+
}
|
|
2768
|
+
rGeome.vol = {
|
|
2769
|
+
extrudes: [
|
|
2770
|
+
{
|
|
2771
|
+
outName: `subpax_${designName}_plate2`,
|
|
2772
|
+
face: `${designName}_facePlate`,
|
|
2773
|
+
extrudeMethod: EExtrude6.eLinearOrtho,
|
|
2774
|
+
length: param.H2,
|
|
2775
|
+
rotate: [0, 0, 0],
|
|
2776
|
+
translate: [0, 0, He]
|
|
2777
|
+
},
|
|
2778
|
+
{
|
|
2779
|
+
outName: `subpax_${designName}_int3`,
|
|
2780
|
+
face: `${designName}_faceIntern`,
|
|
2781
|
+
extrudeMethod: EExtrude6.eLinearOrtho,
|
|
2782
|
+
length: param.H1,
|
|
2783
|
+
rotate: [0, 0, 0],
|
|
2784
|
+
translate: [0, 0, He + param.H2]
|
|
2785
|
+
},
|
|
2786
|
+
{
|
|
2787
|
+
outName: `subpax_${designName}_plate4`,
|
|
2788
|
+
face: `${designName}_facePlate`,
|
|
2789
|
+
extrudeMethod: EExtrude6.eLinearOrtho,
|
|
2790
|
+
length: param.H2,
|
|
2791
|
+
rotate: [0, 0, 0],
|
|
2792
|
+
translate: [0, 0, He + param.H2 + param.H1]
|
|
2793
|
+
},
|
|
2794
|
+
...eH4List
|
|
2795
|
+
],
|
|
2796
|
+
volumes: [
|
|
2797
|
+
{
|
|
2798
|
+
outName: `pax_${designName}`,
|
|
2799
|
+
boolMethod: EBVolume6.eUnion,
|
|
2800
|
+
inList: [
|
|
2801
|
+
`subpax_${designName}_plate2`,
|
|
2802
|
+
`subpax_${designName}_int3`,
|
|
2803
|
+
`subpax_${designName}_plate4`,
|
|
2804
|
+
...vH4List
|
|
2805
|
+
]
|
|
2806
|
+
}
|
|
2807
|
+
]
|
|
2808
|
+
};
|
|
2809
|
+
rGeome.sub = {};
|
|
2810
|
+
rGeome.logstr += "Scara drawn successfully!\n";
|
|
2811
|
+
rGeome.calcErr = false;
|
|
2812
|
+
} catch (emsg) {
|
|
2813
|
+
rGeome.logstr += emsg;
|
|
2814
|
+
console.log(emsg);
|
|
2815
|
+
}
|
|
2816
|
+
return rGeome;
|
|
2817
|
+
}
|
|
2818
|
+
var scaraDef = {
|
|
2819
|
+
pTitle: "scara",
|
|
2820
|
+
pDescription: "A scara leg",
|
|
2821
|
+
pDef: pDef6,
|
|
2822
|
+
pGeom: pGeom6
|
|
2823
|
+
};
|
|
2824
|
+
|
|
2825
|
+
// src/bot/scarabase.ts
|
|
2826
|
+
import {
|
|
2827
|
+
point as point4,
|
|
2828
|
+
contour as contour7,
|
|
2829
|
+
contourCircle as contourCircle6,
|
|
2830
|
+
ctrRectangle as ctrRectangle6,
|
|
2831
|
+
figure as figure7,
|
|
2832
|
+
degToRad as degToRad4,
|
|
2833
|
+
radToDeg as radToDeg5,
|
|
2834
|
+
ffix as ffix6,
|
|
2835
|
+
pNumber as pNumber7,
|
|
2836
|
+
pDropdown as pDropdown4,
|
|
2837
|
+
pSectionSeparator as pSectionSeparator7,
|
|
2838
|
+
initGeom as initGeom7,
|
|
2839
|
+
EExtrude as EExtrude7,
|
|
2840
|
+
EBVolume as EBVolume7
|
|
2841
|
+
} from "geometrix";
|
|
2842
|
+
var pDef7 = {
|
|
2843
|
+
// partName is used in URL. Choose a name without slash, backslash and space.
|
|
2844
|
+
partName: "scarabase",
|
|
2845
|
+
params: [
|
|
2846
|
+
//pNumber(name, unit, init, min, max, step)
|
|
2847
|
+
pNumber7("D1", "mm", 20, 1, 1e3, 1),
|
|
2848
|
+
pNumber7("D2", "mm", 60, 1, 1e3, 1),
|
|
2849
|
+
pNumber7("L3", "mm", 30, 0, 1e3, 1),
|
|
2850
|
+
pNumber7("L4", "mm", 20, 1, 100, 1),
|
|
2851
|
+
pNumber7("W5", "mm", 40, 1, 1e3, 1),
|
|
2852
|
+
pDropdown4("Nac", ["single", "double"]),
|
|
2853
|
+
pSectionSeparator7("Plate details"),
|
|
2854
|
+
pNumber7("R34", "mm", 2, 0, 10, 0.1),
|
|
2855
|
+
pNumber7("A5", "degree", 90, 0, 180, 1),
|
|
2856
|
+
pNumber7("W6", "mm", 10, 0, 1e3, 1),
|
|
2857
|
+
pNumber7("T3", "mm", 3, 1, 100, 1),
|
|
2858
|
+
pNumber7("T4", "mm", 10, 1, 100, 1),
|
|
2859
|
+
pSectionSeparator7("Heights and back"),
|
|
2860
|
+
pNumber7("H1", "mm", 50, 1, 1e3, 1),
|
|
2861
|
+
pNumber7("H2", "mm", 10, 1, 1e3, 1),
|
|
2862
|
+
pNumber7("H3", "mm", 10, 0, 1e3, 1),
|
|
2863
|
+
pNumber7("W8", "mm", 20, 1, 1e3, 1),
|
|
2864
|
+
pNumber7("H8", "mm", 30, 1, 1e3, 1),
|
|
2865
|
+
pNumber7("D8", "mm", 5, 1, 1e3, 1)
|
|
2866
|
+
],
|
|
2867
|
+
paramSvg: {
|
|
2868
|
+
D1: "scarabase_single.svg",
|
|
2869
|
+
D2: "scarabase_single.svg",
|
|
2870
|
+
L3: "scarabase_single.svg",
|
|
2871
|
+
L4: "scarabase_single.svg",
|
|
2872
|
+
W5: "scarabase_single.svg",
|
|
2873
|
+
Nac: "scarabase_double.svg",
|
|
2874
|
+
R34: "scarabase_single.svg",
|
|
2875
|
+
A5: "scarabase_double.svg",
|
|
2876
|
+
W6: "scarabase_double.svg",
|
|
2877
|
+
T3: "scarabase_single.svg",
|
|
2878
|
+
T4: "scarabase_single.svg",
|
|
2879
|
+
H1: "scarabase_cut.svg",
|
|
2880
|
+
H2: "scarabase_heights.svg",
|
|
2881
|
+
H3: "scarabase_heights.svg",
|
|
2882
|
+
W8: "scarabase_heights.svg",
|
|
2883
|
+
H8: "scarabase_heights.svg",
|
|
2884
|
+
D8: "scarabase_heights.svg"
|
|
2885
|
+
},
|
|
2886
|
+
sim: {
|
|
2887
|
+
tMax: 100,
|
|
2888
|
+
tStep: 0.5,
|
|
2889
|
+
tUpdate: 500
|
|
2890
|
+
// every 0.5 second
|
|
2891
|
+
}
|
|
2892
|
+
};
|
|
2893
|
+
function pGeom7(t, param, suffix = "") {
|
|
2894
|
+
const rGeome = initGeom7(pDef7.partName + suffix);
|
|
2895
|
+
const figPlate = figure7();
|
|
2896
|
+
const figBack = figure7();
|
|
2897
|
+
const figT3 = figure7();
|
|
2898
|
+
const figSide = figure7();
|
|
2899
|
+
rGeome.logstr += `${rGeome.partName} simTime: ${t}
|
|
2900
|
+
`;
|
|
2901
|
+
try {
|
|
2902
|
+
let ctrSingle2 = function(iT3nPlate) {
|
|
2903
|
+
const rCtr = contour7(0, 0);
|
|
2904
|
+
if (iT3nPlate === 1) {
|
|
2905
|
+
rCtr.addSegStrokeA(param.T3, 0).addSegStrokeA(param.T3, Y4).addCornerRounded(param.R34).addSegStrokeA(p22i.cx, p22i.cy).addPointA(W52, L432 + R2 - param.T3).addPointA(p21i.cx, p21i.cy).addSegArc2().addSegStrokeA(2 * W52 - param.T3, Y4).addCornerRounded(param.R34).addSegStrokeA(2 * W52 - param.T3, 0);
|
|
2906
|
+
}
|
|
2907
|
+
rCtr.addSegStrokeA(2 * W52, 0).addSegStrokeA(2 * W52, param.L4).addCornerRounded(param.R34).addSegStrokeA(p21.cx, p21.cy).addPointA(W52, L432 + R2).addPointA(p22.cx, p22.cy).addSegArc2().addSegStrokeA(0, param.L4).addCornerRounded(param.R34).closeSegStroke();
|
|
2908
|
+
return rCtr;
|
|
2909
|
+
}, ctrDouble2 = function(iT3nPlate) {
|
|
2910
|
+
const rCtr = contour7(0, 0);
|
|
2911
|
+
if (iT3nPlate === 1) {
|
|
2912
|
+
rCtr.addSegStrokeA(param.T3, 0).addSegStrokeA(param.T3, Y41).addCornerRounded(param.R34).addSegStrokeA(p33i.cx, p33i.cy).addPointA(p32i.cx, p32i.cy).addPointA(p31i.cx, p31i.cy).addSegArc2().addSegStrokeA(X42, Y42).addCornerRounded(param.R34).addSegStrokeA(X43, Y43).addCornerRounded(param.R34).addSegStrokeA(p43i.cx, p43i.cy).addPointA(p42i.cx, p42i.cy).addPointA(p41i.cx, p41i.cy).addSegArc2().addSegStrokeA(W7 - param.T3, Y44).addCornerRounded(param.R34).addSegStrokeA(W7 - param.T3, 0);
|
|
2913
|
+
}
|
|
2914
|
+
rCtr.addSegStrokeA(W7, 0).addSegStrokeA(W7, param.L4).addCornerRounded(param.R34).addSegStrokeA(p41.cx, p41.cy).addPointA(p42.cx, p42.cy).addPointA(p43.cx, p43.cy).addSegArc2().addSegStrokeA(W7 - X5, param.L4 + Y5).addCornerRounded(param.R34).addSegStrokeA(X5, param.L4 + Y5).addCornerRounded(param.R34).addSegStrokeA(p31.cx, p31.cy).addPointA(p32.cx, p32.cy).addPointA(p33.cx, p33.cy).addSegArc2().addSegStrokeA(0, param.L4).addCornerRounded(param.R34).closeSegStroke();
|
|
2915
|
+
return rCtr;
|
|
2916
|
+
};
|
|
2917
|
+
var ctrSingle = ctrSingle2, ctrDouble = ctrDouble2;
|
|
2918
|
+
const a5 = degToRad4(param.A5) / 2;
|
|
2919
|
+
const R1 = param.D1 / 2;
|
|
2920
|
+
const R2 = param.D2 / 2;
|
|
2921
|
+
const R8 = param.D8 / 2;
|
|
2922
|
+
const W52 = param.W5 / 2;
|
|
2923
|
+
const L32 = param.L3 + R2;
|
|
2924
|
+
const a21 = Math.atan(W52 / L32);
|
|
2925
|
+
const L21 = Math.sqrt(W52 ** 2 + L32 ** 2);
|
|
2926
|
+
const a22 = Math.acos(R2 / L21);
|
|
2927
|
+
const a2 = a21 + a22;
|
|
2928
|
+
const L432 = param.L4 + param.L3 + R2;
|
|
2929
|
+
const Ltot = 2 * R2 + param.L3 + param.L4;
|
|
2930
|
+
const Htot = param.H1 + 2 * (param.H2 + param.H3);
|
|
2931
|
+
const H23 = param.H2 + param.H3;
|
|
2932
|
+
const H123 = param.H1 + H23;
|
|
2933
|
+
const pi2 = Math.PI / 2;
|
|
2934
|
+
const Y4 = param.L4 + param.T3 * Math.tan((pi2 - a2) / 2);
|
|
2935
|
+
const X5 = param.W5 * Math.cos(a5);
|
|
2936
|
+
const Y5 = param.W5 * Math.sin(a5);
|
|
2937
|
+
const W7 = param.Nac === 0 ? param.W5 : param.W6 + 2 * X5;
|
|
2938
|
+
const X8 = (W7 - param.W8) / 2;
|
|
2939
|
+
const Y8 = (param.H1 - param.H8) / 2;
|
|
2940
|
+
if (R2 < R1 + 2 * param.T3) {
|
|
2941
|
+
throw `err132: D2 ${ffix6(2 * R2)} is too small compare to D1 ${ffix6(2 * R1)} and T3 ${ffix6(param.T3)}`;
|
|
2942
|
+
}
|
|
2943
|
+
if (X8 < R8) {
|
|
2944
|
+
throw `err124: W5 ${ffix6(2 * W52)} is too small compare to D8 ${ffix6(2 * R8)} and W8 ${ffix6(param.W8)}`;
|
|
2945
|
+
}
|
|
2946
|
+
if (Y8 < R8) {
|
|
2947
|
+
throw `err127: H1 ${ffix6(param.H1)} is too small compare to D8 ${ffix6(2 * R8)} and H8 ${ffix6(param.H8)}`;
|
|
2948
|
+
}
|
|
2949
|
+
if (param.H3 === 0) {
|
|
2950
|
+
rGeome.logstr += "warn125: Warning H3 is zero\n";
|
|
2951
|
+
}
|
|
2952
|
+
rGeome.logstr += `length ${ffix6(Ltot)} height ${ffix6(Htot)}
|
|
2953
|
+
`;
|
|
2954
|
+
if (param.Nac === 1) {
|
|
2955
|
+
rGeome.logstr += `angle between holders: ${ffix6(radToDeg5(2 * a5))}
|
|
2956
|
+
`;
|
|
2957
|
+
}
|
|
2958
|
+
rGeome.logstr += `W7 ${ffix6(W7)}
|
|
2959
|
+
`;
|
|
2960
|
+
const p21 = point4(W52, L432).translatePolar(-pi2 + a2, R2);
|
|
2961
|
+
const p22 = point4(W52, L432).translatePolar(-pi2 - a2, R2);
|
|
2962
|
+
const p21i = point4(W52, L432).translatePolar(-pi2 + a2, R2 - param.T3);
|
|
2963
|
+
const p22i = point4(W52, L432).translatePolar(-pi2 - a2, R2 - param.T3);
|
|
2964
|
+
const p30 = point4(X5 / 2, param.L4 + Y5 / 2).translatePolar(a5 + pi2, param.L3 + R2);
|
|
2965
|
+
const p31 = p30.translatePolar(a5 - pi2 + a2, R2);
|
|
2966
|
+
const p32 = p30.translatePolar(a5 + pi2, R2);
|
|
2967
|
+
const p33 = p30.translatePolar(a5 - pi2 - a2, R2);
|
|
2968
|
+
const p31i = p30.translatePolar(a5 - pi2 + a2, R2 - param.T3);
|
|
2969
|
+
const p32i = p30.translatePolar(a5 + pi2, R2 - param.T3);
|
|
2970
|
+
const p33i = p30.translatePolar(a5 - pi2 - a2, R2 - param.T3);
|
|
2971
|
+
const p40 = point4(W7 - X5 / 2, param.L4 + Y5 / 2).translatePolar(pi2 - a5, param.L3 + R2);
|
|
2972
|
+
const p41 = p40.translatePolar(-a5 - pi2 + a2, R2);
|
|
2973
|
+
const p42 = p40.translatePolar(-a5 + pi2, R2);
|
|
2974
|
+
const p43 = p40.translatePolar(-a5 - pi2 - a2, R2);
|
|
2975
|
+
const p41i = p40.translatePolar(-a5 - pi2 + a2, R2 - param.T3);
|
|
2976
|
+
const p42i = p40.translatePolar(-a5 + pi2, R2 - param.T3);
|
|
2977
|
+
const p43i = p40.translatePolar(-a5 - pi2 - a2, R2 - param.T3);
|
|
2978
|
+
const Y41 = param.L4 + param.T3 * Math.tan((a5 + (pi2 - a2)) / 2);
|
|
2979
|
+
const Y42 = param.L4 + Y5 - param.T3;
|
|
2980
|
+
const Y43 = Y42;
|
|
2981
|
+
const Y44 = Y41;
|
|
2982
|
+
const a42 = pi2 - a5 + (pi2 - a2);
|
|
2983
|
+
const X42 = X5 - param.T3 * Math.tan(a42 / 2);
|
|
2984
|
+
const X43 = W7 - X42;
|
|
2985
|
+
if (param.Nac === 0) {
|
|
2986
|
+
figPlate.addMainOI([ctrSingle2(0), contourCircle6(W52, L432, R1)]);
|
|
2987
|
+
} else {
|
|
2988
|
+
figPlate.addMainOI([
|
|
2989
|
+
ctrDouble2(0),
|
|
2990
|
+
contourCircle6(p30.cx, p30.cy, R1),
|
|
2991
|
+
contourCircle6(p40.cx, p40.cy, R1)
|
|
2992
|
+
]);
|
|
2993
|
+
}
|
|
2994
|
+
figPlate.addSecond(ctrRectangle6(0, 0, W7, param.T4));
|
|
2995
|
+
figPlate.addSecond(ctrRectangle6(X8 - R8, 0, 2 * R8, param.T4));
|
|
2996
|
+
figPlate.addSecond(ctrRectangle6(W7 - X8 - R8, 0, 2 * R8, param.T4));
|
|
2997
|
+
figBack.addMainOI([
|
|
2998
|
+
ctrRectangle6(0, H23, W7, param.H1),
|
|
2999
|
+
contourCircle6(X8, H23 + Y8, R8),
|
|
3000
|
+
contourCircle6(W7 - X8, H23 + Y8, R8),
|
|
3001
|
+
contourCircle6(X8, H123 - Y8, R8),
|
|
3002
|
+
contourCircle6(W7 - X8, H123 - Y8, R8)
|
|
3003
|
+
]);
|
|
3004
|
+
if (param.Nac === 0) {
|
|
3005
|
+
figBack.addSecond(ctrRectangle6(W52 - R1, 0, 2 * R1, H23));
|
|
3006
|
+
figBack.addSecond(ctrRectangle6(W52 - R2, 0, 2 * R2, H23));
|
|
3007
|
+
figBack.addSecond(ctrRectangle6(W52 - R1, H123, 2 * R1, H23));
|
|
3008
|
+
figBack.addSecond(ctrRectangle6(W52 - R2, H123, 2 * R2, H23));
|
|
3009
|
+
} else {
|
|
3010
|
+
figBack.addSecond(ctrRectangle6(p30.cx - R1, 0, 2 * R1, H23));
|
|
3011
|
+
figBack.addSecond(ctrRectangle6(p30.cx - R2, 0, 2 * R2, H23));
|
|
3012
|
+
figBack.addSecond(ctrRectangle6(p40.cx - R1, 0, 2 * R1, H23));
|
|
3013
|
+
figBack.addSecond(ctrRectangle6(p40.cx - R2, 0, 2 * R2, H23));
|
|
3014
|
+
figBack.addSecond(ctrRectangle6(p30.cx - R1, H123, 2 * R1, H23));
|
|
3015
|
+
figBack.addSecond(ctrRectangle6(p30.cx - R2, H123, 2 * R2, H23));
|
|
3016
|
+
figBack.addSecond(ctrRectangle6(p40.cx - R1, H123, 2 * R1, H23));
|
|
3017
|
+
figBack.addSecond(ctrRectangle6(p40.cx - R2, H123, 2 * R2, H23));
|
|
3018
|
+
}
|
|
3019
|
+
if (param.Nac === 0) {
|
|
3020
|
+
figT3.addMainO(ctrSingle2(1));
|
|
3021
|
+
figT3.addMainOI([
|
|
3022
|
+
contourCircle6(W52, L432, R1 + param.T3),
|
|
3023
|
+
contourCircle6(W52, L432, R1)
|
|
3024
|
+
]);
|
|
3025
|
+
} else {
|
|
3026
|
+
figT3.addMainO(ctrDouble2(1));
|
|
3027
|
+
figT3.addMainOI([
|
|
3028
|
+
contourCircle6(p30.cx, p30.cy, R1 + param.T3),
|
|
3029
|
+
contourCircle6(p30.cx, p30.cy, R1)
|
|
3030
|
+
]);
|
|
3031
|
+
figT3.addMainOI([
|
|
3032
|
+
contourCircle6(p40.cx, p40.cy, R1 + param.T3),
|
|
3033
|
+
contourCircle6(p40.cx, p40.cy, R1)
|
|
3034
|
+
]);
|
|
3035
|
+
}
|
|
3036
|
+
figT3.mergeFigure(figPlate, true);
|
|
3037
|
+
const ctrSide1 = contour7(0, param.H3).addSegStrokeR(L432 - R1 - param.T3, 0).addSegStrokeR(0, -param.H3).addSegStrokeR(param.T3, 0).addSegStrokeR(0, param.H3 + param.H2).addSegStrokeR(-L432 + R1 + param.T4, 0).addSegStrokeR(0, param.H1).addSegStrokeR(L432 - R1 - param.T4, 0).addSegStrokeR(0, param.H3 + param.H2).addSegStrokeR(-param.T3, 0).addSegStrokeR(0, -param.H3).addSegStrokeR(-L432 + R1 + param.T3, 0).closeSegStroke();
|
|
3038
|
+
const ctrSide2 = contour7(L432 + R1, 0).addSegStrokeR(param.T3, 0).addSegStrokeR(0, param.H3).addSegStrokeR(R2 - R1 - 2 * param.T3, 0).addSegStrokeR(0, -param.H3).addSegStrokeR(param.T3, 0).addSegStrokeR(0, param.H3 + param.H2).addSegStrokeR(-R2 + R1, 0).closeSegStroke();
|
|
3039
|
+
const ctrSide3 = contour7(L432 + R1, H123).addSegStrokeR(R2 - R1, 0).addSegStrokeR(0, param.H3 + param.H2).addSegStrokeR(-param.T3, 0).addSegStrokeR(0, -param.H3).addSegStrokeR(-R2 + R1 + 2 * param.T3, 0).addSegStrokeR(0, param.H3).addSegStrokeR(-param.T3, 0).closeSegStroke();
|
|
3040
|
+
figSide.addMainO(ctrSide1);
|
|
3041
|
+
figSide.addMainO(ctrSide2);
|
|
3042
|
+
figSide.addMainO(ctrSide3);
|
|
3043
|
+
rGeome.fig = {
|
|
3044
|
+
facePlate: figPlate,
|
|
3045
|
+
faceBack: figBack,
|
|
3046
|
+
faceT3: figT3,
|
|
3047
|
+
faceSide: figSide
|
|
3048
|
+
};
|
|
3049
|
+
const designName = rGeome.partName;
|
|
3050
|
+
const lExtrudes = [];
|
|
3051
|
+
const lUnion = [];
|
|
3052
|
+
if (param.H3 > 0) {
|
|
3053
|
+
lExtrudes.push({
|
|
3054
|
+
outName: `subpax_${designName}_t31`,
|
|
3055
|
+
face: `${designName}_faceT3`,
|
|
3056
|
+
extrudeMethod: EExtrude7.eLinearOrtho,
|
|
3057
|
+
length: param.H3,
|
|
3058
|
+
rotate: [0, 0, 0],
|
|
3059
|
+
translate: [0, 0, 0]
|
|
3060
|
+
});
|
|
3061
|
+
lUnion.push(`subpax_${designName}_t31`);
|
|
3062
|
+
lExtrudes.push({
|
|
3063
|
+
outName: `subpax_${designName}_t35`,
|
|
3064
|
+
face: `${designName}_faceT3`,
|
|
3065
|
+
extrudeMethod: EExtrude7.eLinearOrtho,
|
|
3066
|
+
length: param.H3,
|
|
3067
|
+
rotate: [0, 0, 0],
|
|
3068
|
+
translate: [0, 0, H123 + param.H2]
|
|
3069
|
+
});
|
|
3070
|
+
lUnion.push(`subpax_${designName}_t35`);
|
|
3071
|
+
}
|
|
3072
|
+
rGeome.vol = {
|
|
3073
|
+
extrudes: [
|
|
3074
|
+
{
|
|
3075
|
+
outName: `subpax_${designName}_plate2`,
|
|
3076
|
+
face: `${designName}_facePlate`,
|
|
3077
|
+
extrudeMethod: EExtrude7.eLinearOrtho,
|
|
3078
|
+
length: param.H2,
|
|
3079
|
+
rotate: [0, 0, 0],
|
|
3080
|
+
translate: [0, 0, param.H3]
|
|
3081
|
+
},
|
|
3082
|
+
{
|
|
3083
|
+
outName: `subpax_${designName}_plate4`,
|
|
3084
|
+
face: `${designName}_facePlate`,
|
|
3085
|
+
extrudeMethod: EExtrude7.eLinearOrtho,
|
|
3086
|
+
length: param.H2,
|
|
3087
|
+
rotate: [0, 0, 0],
|
|
3088
|
+
translate: [0, 0, H123]
|
|
3089
|
+
},
|
|
3090
|
+
{
|
|
3091
|
+
outName: `subpax_${designName}_back`,
|
|
3092
|
+
face: `${designName}_faceBack`,
|
|
3093
|
+
extrudeMethod: EExtrude7.eLinearOrtho,
|
|
3094
|
+
length: param.T4,
|
|
3095
|
+
rotate: [pi2, 0, 0],
|
|
3096
|
+
translate: [0, param.T4, 0]
|
|
3097
|
+
},
|
|
3098
|
+
...lExtrudes
|
|
3099
|
+
],
|
|
3100
|
+
volumes: [
|
|
3101
|
+
{
|
|
3102
|
+
outName: `pax_${designName}`,
|
|
3103
|
+
boolMethod: EBVolume7.eUnion,
|
|
3104
|
+
inList: [
|
|
3105
|
+
`subpax_${designName}_plate2`,
|
|
3106
|
+
`subpax_${designName}_plate4`,
|
|
3107
|
+
`subpax_${designName}_back`,
|
|
3108
|
+
...lUnion
|
|
3109
|
+
]
|
|
3110
|
+
}
|
|
3111
|
+
]
|
|
3112
|
+
};
|
|
3113
|
+
rGeome.sub = {};
|
|
3114
|
+
rGeome.logstr += "ScaraBase drawn successfully!\n";
|
|
3115
|
+
rGeome.calcErr = false;
|
|
3116
|
+
} catch (emsg) {
|
|
3117
|
+
rGeome.logstr += emsg;
|
|
3118
|
+
console.log(emsg);
|
|
3119
|
+
}
|
|
3120
|
+
return rGeome;
|
|
3121
|
+
}
|
|
3122
|
+
var scarabaseDef = {
|
|
3123
|
+
pTitle: "scarabase",
|
|
3124
|
+
pDescription: "The base of a Scara arm",
|
|
3125
|
+
pDef: pDef7,
|
|
3126
|
+
pGeom: pGeom7
|
|
3127
|
+
};
|
|
3128
|
+
|
|
3129
|
+
// src/bot/long2d.ts
|
|
3130
|
+
import {
|
|
3131
|
+
designParam,
|
|
3132
|
+
checkGeom,
|
|
3133
|
+
prefixLog,
|
|
3134
|
+
contourCircle as contourCircle7,
|
|
3135
|
+
ctrRectangle as ctrRectangle7,
|
|
3136
|
+
figure as figure8,
|
|
3137
|
+
degToRad as degToRad5,
|
|
3138
|
+
radToDeg as radToDeg6,
|
|
3139
|
+
ffix as ffix7,
|
|
3140
|
+
pNumber as pNumber8,
|
|
3141
|
+
pDropdown as pDropdown5,
|
|
3142
|
+
pSectionSeparator as pSectionSeparator8,
|
|
3143
|
+
initGeom as initGeom8,
|
|
3144
|
+
transform2d,
|
|
3145
|
+
transform3d,
|
|
3146
|
+
EExtrude as EExtrude8,
|
|
3147
|
+
EBVolume as EBVolume8
|
|
3148
|
+
} from "geometrix";
|
|
3149
|
+
var pDef8 = {
|
|
3150
|
+
// partName is used in URL. Choose a name without slash, backslash and space.
|
|
3151
|
+
partName: "long2d",
|
|
3152
|
+
params: [
|
|
3153
|
+
//pNumber(name, unit, init, min, max, step)
|
|
3154
|
+
pNumber8("NB", "leg", 3, 1, 10, 1),
|
|
3155
|
+
pNumber8("LA", "L-factor", 1, 0.1, 10, 0.1),
|
|
3156
|
+
pNumber8("LB", "L-add", 0, -10, 100, 0.1),
|
|
3157
|
+
pNumber8("DA", "D-factor", 1, 0.1, 10, 0.1),
|
|
3158
|
+
pNumber8("DB", "D-add", 0, -10, 100, 0.1),
|
|
3159
|
+
pNumber8("HA", "L-factor", 1, 0.1, 10, 0.1),
|
|
3160
|
+
pNumber8("HB", "L-add", 0, -10, 100, 0.1),
|
|
3161
|
+
pSectionSeparator8("Ending parameters"),
|
|
3162
|
+
pNumber8("EL", "mm", 100, 1, 1e3, 1),
|
|
3163
|
+
pNumber8("ED2", "mm", 60, 1, 1e3, 1),
|
|
3164
|
+
pNumber8("EH1", "mm", 50, 1, 1e3, 1),
|
|
3165
|
+
pSectionSeparator8("Constant parameters"),
|
|
3166
|
+
pNumber8("EH2", "mm", 10, 1, 1e3, 1),
|
|
3167
|
+
pNumber8("EH3", "mm", 10, 0, 1e3, 1),
|
|
3168
|
+
pNumber8("ED1", "mm", 20, 1, 1e3, 1),
|
|
3169
|
+
pNumber8("T1", "mm", 5, 1, 100, 1),
|
|
3170
|
+
pNumber8("T3", "mm", 3, 1, 100, 1),
|
|
3171
|
+
pNumber8("E1", "mm", 0.5, -10, 10, 0.1),
|
|
3172
|
+
pNumber8("E2", "mm", 0.5, -10, 10, 0.1),
|
|
3173
|
+
pNumber8("E3", "mm", 0.5, -10, 10, 0.1),
|
|
3174
|
+
pSectionSeparator8("Base"),
|
|
3175
|
+
pNumber8("L3", "mm", 30, 0, 1e3, 1),
|
|
3176
|
+
pNumber8("L4", "mm", 20, 1, 100, 1),
|
|
3177
|
+
pNumber8("W5", "mm", 40, 1, 1e3, 1),
|
|
3178
|
+
pNumber8("R34", "mm", 2, 0, 10, 0.1),
|
|
3179
|
+
pNumber8("T4", "mm", 10, 1, 100, 1),
|
|
3180
|
+
pSectionSeparator8("Base back"),
|
|
3181
|
+
pNumber8("W8", "mm", 20, 1, 1e3, 1),
|
|
3182
|
+
pNumber8("H8", "mm", 30, 1, 1e3, 1),
|
|
3183
|
+
pNumber8("D8", "mm", 5, 1, 1e3, 1),
|
|
3184
|
+
pSectionSeparator8("Leg details"),
|
|
3185
|
+
pNumber8("S12", "mm", 1, 0, 100, 1),
|
|
3186
|
+
pNumber8("Ri", "mm", 1, 0, 10, 0.1),
|
|
3187
|
+
pNumber8("Re", "mm", 0.4, 0, 10, 0.1),
|
|
3188
|
+
pSectionSeparator8("Angles and 3D parts"),
|
|
3189
|
+
pNumber8("PA1", "degree", 0, -120, 120, 1),
|
|
3190
|
+
pNumber8("PA2", "degree", 0, -120, 120, 1),
|
|
3191
|
+
pNumber8("PA3", "degree", 0, -120, 120, 1),
|
|
3192
|
+
pNumber8("PA4", "degree", 0, -120, 120, 1),
|
|
3193
|
+
pNumber8("PA5", "degree", 0, -120, 120, 1),
|
|
3194
|
+
pNumber8("PA6", "degree", 0, -120, 120, 1),
|
|
3195
|
+
pNumber8("PA7", "degree", 0, -120, 120, 1),
|
|
3196
|
+
pNumber8("PA8", "degree", 0, -120, 120, 1),
|
|
3197
|
+
pNumber8("PA9", "degree", 0, -120, 120, 1),
|
|
3198
|
+
pNumber8("PA10", "degree", 0, -120, 120, 1),
|
|
3199
|
+
pDropdown5("D3Enable", [
|
|
3200
|
+
"assembly",
|
|
3201
|
+
"parts",
|
|
3202
|
+
"axisall",
|
|
3203
|
+
"base",
|
|
3204
|
+
"leg1",
|
|
3205
|
+
"leg2",
|
|
3206
|
+
"leg3",
|
|
3207
|
+
"leg4",
|
|
3208
|
+
"leg5",
|
|
3209
|
+
"leg6",
|
|
3210
|
+
"leg7",
|
|
3211
|
+
"leg8",
|
|
3212
|
+
"leg9",
|
|
3213
|
+
"leg10"
|
|
3214
|
+
])
|
|
3215
|
+
],
|
|
3216
|
+
paramSvg: {
|
|
3217
|
+
NB: "long2d_top.svg",
|
|
3218
|
+
LA: "long2d_top.svg",
|
|
3219
|
+
LB: "long2d_top.svg",
|
|
3220
|
+
DA: "long2d_top.svg",
|
|
3221
|
+
DB: "long2d_top.svg",
|
|
3222
|
+
HA: "long2d_side.svg",
|
|
3223
|
+
HB: "long2d_side.svg",
|
|
3224
|
+
EL: "long2d_top.svg",
|
|
3225
|
+
ED2: "long2d_top.svg",
|
|
3226
|
+
EH1: "long2d_side.svg",
|
|
3227
|
+
EH2: "long2d_side.svg",
|
|
3228
|
+
EH3: "long2d_side.svg",
|
|
3229
|
+
ED1: "long2d_top.svg",
|
|
3230
|
+
T1: "long2d_joint.svg",
|
|
3231
|
+
T3: "long2d_top.svg",
|
|
3232
|
+
E1: "long2d_side.svg",
|
|
3233
|
+
E2: "long2d_joint.svg",
|
|
3234
|
+
E3: "long2d_joint.svg",
|
|
3235
|
+
L3: "long2d_top.svg",
|
|
3236
|
+
L4: "long2d_top.svg",
|
|
3237
|
+
W5: "long2d_top.svg",
|
|
3238
|
+
R34: "long2d_top.svg",
|
|
3239
|
+
T4: "long2d_top.svg",
|
|
3240
|
+
W8: "long2d_back.svg",
|
|
3241
|
+
H8: "long2d_back.svg",
|
|
3242
|
+
D8: "long2d_back.svg",
|
|
3243
|
+
S12: "long2d_top.svg",
|
|
3244
|
+
Ri: "long2d_top.svg",
|
|
3245
|
+
Re: "long2d_top.svg",
|
|
3246
|
+
PA1: "long2d_top.svg",
|
|
3247
|
+
PA2: "long2d_top.svg",
|
|
3248
|
+
PA3: "long2d_top.svg",
|
|
3249
|
+
PA4: "long2d_top.svg",
|
|
3250
|
+
PA5: "long2d_top.svg",
|
|
3251
|
+
PA6: "long2d_top.svg",
|
|
3252
|
+
PA7: "long2d_top.svg",
|
|
3253
|
+
PA8: "long2d_top.svg",
|
|
3254
|
+
PA9: "long2d_top.svg",
|
|
3255
|
+
PA10: "long2d_top.svg",
|
|
3256
|
+
D3Enable: "long2d_top.svg"
|
|
3257
|
+
},
|
|
3258
|
+
sim: {
|
|
3259
|
+
tMax: 100,
|
|
3260
|
+
tStep: 0.5,
|
|
3261
|
+
tUpdate: 500
|
|
3262
|
+
// every 0.5 second
|
|
3263
|
+
}
|
|
3264
|
+
};
|
|
3265
|
+
function pGeom8(t, param, suffix = "") {
|
|
3266
|
+
const rGeome = initGeom8(pDef8.partName + suffix);
|
|
3267
|
+
const figTop = figure8();
|
|
3268
|
+
const figSide = figure8();
|
|
3269
|
+
const figBack = figure8();
|
|
3270
|
+
const figAxis = figure8();
|
|
3271
|
+
rGeome.logstr += `${rGeome.partName} simTime: ${t}
|
|
3272
|
+
`;
|
|
3273
|
+
try {
|
|
3274
|
+
let figAxisCut2 = function(ix, iy, ih) {
|
|
3275
|
+
const rFig = figure8();
|
|
3276
|
+
rFig.addMainO(ctrRectangle7(ix, iy, param.T1, ih));
|
|
3277
|
+
rFig.addMainO(ctrRectangle7(ix + 2 * ER1 - param.T1, iy, param.T1, ih));
|
|
3278
|
+
return rFig;
|
|
3279
|
+
};
|
|
3280
|
+
var figAxisCut = figAxisCut2;
|
|
3281
|
+
const ER1 = param.ED1 / 2;
|
|
3282
|
+
const ER2 = param.ED2 / 2;
|
|
3283
|
+
const ER1i = ER1 - param.T1;
|
|
3284
|
+
const R8 = param.D8 / 2;
|
|
3285
|
+
const PAall = [
|
|
3286
|
+
param.PA1,
|
|
3287
|
+
param.PA2,
|
|
3288
|
+
param.PA3,
|
|
3289
|
+
param.PA4,
|
|
3290
|
+
param.PA5,
|
|
3291
|
+
param.PA6,
|
|
3292
|
+
param.PA7,
|
|
3293
|
+
param.PA8,
|
|
3294
|
+
param.PA9,
|
|
3295
|
+
param.PA10
|
|
3296
|
+
];
|
|
3297
|
+
const PA = PAall.slice(0, param.NB).map((iAngle) => degToRad5(iAngle));
|
|
3298
|
+
const BL = Array(param.NB).fill(param.EL);
|
|
3299
|
+
const BD2 = Array(param.NB + 1).fill(param.ED2);
|
|
3300
|
+
const BH1 = Array(param.NB + 1).fill(param.EH1);
|
|
3301
|
+
for (let ii = param.NB - 2; ii >= 0; ii--) {
|
|
3302
|
+
BL[ii] = BL[ii + 1] * param.LA + param.LB;
|
|
3303
|
+
}
|
|
3304
|
+
const EH23 = 2 * (param.EH2 + param.EH3);
|
|
3305
|
+
for (let ii = param.NB - 1; ii >= 0; ii--) {
|
|
3306
|
+
BD2[ii] = BD2[ii + 1] * param.DA + param.DB;
|
|
3307
|
+
BH1[ii] = BH1[ii + 1] * param.HA + param.HB + 2 * (param.EH2 + param.E1);
|
|
3308
|
+
}
|
|
3309
|
+
const BR2 = BD2.map((aD1) => aD1 / 2);
|
|
3310
|
+
const CH1 = BH1[0];
|
|
3311
|
+
const BLtot = BL.reduce((acc, val) => acc + val, 0);
|
|
3312
|
+
const L432 = param.L4 + param.L3 + BR2[0];
|
|
3313
|
+
const Ltot = L432 + BLtot + BR2[param.NB];
|
|
3314
|
+
const Htot = CH1 + param.EH23;
|
|
3315
|
+
const lastOrientation = PA.reduce((acc, val) => acc + val, 0);
|
|
3316
|
+
const W52 = param.W5 / 2;
|
|
3317
|
+
const X8 = (param.W5 - param.W8) / 2;
|
|
3318
|
+
const Y8 = (CH1 - param.H8) / 2;
|
|
3319
|
+
const pi2 = Math.PI / 2;
|
|
3320
|
+
const fabStepX = 1.2 * Math.max(2 * W52, 2 * BR2[0]);
|
|
3321
|
+
if (ER2 < ER1 + 2 * param.T3) {
|
|
3322
|
+
throw `err192: ED2 ${ffix7(2 * ER2)} is too small compare to ED1 ${ffix7(2 * ER1)} and T3 ${ffix7(param.T3)}`;
|
|
3323
|
+
}
|
|
3324
|
+
if (ER1i < 0) {
|
|
3325
|
+
throw `err216: ED1 ${ffix7(2 * ER1)} is too small compare to T1 ${ffix7(param.T1)}`;
|
|
3326
|
+
}
|
|
3327
|
+
if (X8 < R8) {
|
|
3328
|
+
throw `err195: W5 ${ffix7(param.W5)} is too small compare to D8 ${ffix7(2 * R8)} and W8 ${ffix7(param.W8)}`;
|
|
3329
|
+
}
|
|
3330
|
+
if (Y8 < R8) {
|
|
3331
|
+
throw `err198: H1 ${ffix7(CH1)} is too small compare to D8 ${ffix7(2 * R8)} and H8 ${ffix7(param.H8)}`;
|
|
3332
|
+
}
|
|
3333
|
+
if (param.H3 === 0) {
|
|
3334
|
+
rGeome.logstr += "warn125: Warning H3 is zero\n";
|
|
3335
|
+
}
|
|
3336
|
+
if (param.D3Enable > param.NB + 3) {
|
|
3337
|
+
rGeome.logstr += `warn238: Warning D3Enable ${param.D3Enable} select a not existing part for 3D
|
|
3338
|
+
`;
|
|
3339
|
+
}
|
|
3340
|
+
rGeome.logstr += `length ${ffix7(Ltot)} height ${ffix7(Htot)}
|
|
3341
|
+
`;
|
|
3342
|
+
rGeome.logstr += `lastOrientation ${ffix7(radToDeg6(lastOrientation))}
|
|
3343
|
+
`;
|
|
3344
|
+
for (let ii = 0; ii < param.NB; ii++) {
|
|
3345
|
+
rGeome.logstr += `leg-${ii + 1} : BL ${ffix7(BL[ii])}, D12 ${ffix7(BD2[ii])}, D22 ${ffix7(BD2[ii + 1])},`;
|
|
3346
|
+
rGeome.logstr += ` BH1 ${ffix7(BH1[ii + 1])}
|
|
3347
|
+
`;
|
|
3348
|
+
}
|
|
3349
|
+
const scarabaseParam = designParam(scarabaseDef.pDef, "");
|
|
3350
|
+
scarabaseParam.setVal("D1", 2 * ER1 + param.E3);
|
|
3351
|
+
scarabaseParam.setVal("D2", 2 * BR2[0]);
|
|
3352
|
+
scarabaseParam.setVal("L3", param.L3);
|
|
3353
|
+
scarabaseParam.setVal("L4", param.L4);
|
|
3354
|
+
scarabaseParam.setVal("W5", param.W5);
|
|
3355
|
+
scarabaseParam.setVal("Nac", 0);
|
|
3356
|
+
scarabaseParam.setVal("R34", param.R34);
|
|
3357
|
+
scarabaseParam.setVal("A5", 0);
|
|
3358
|
+
scarabaseParam.setVal("W6", 10);
|
|
3359
|
+
scarabaseParam.setVal("T3", param.T3);
|
|
3360
|
+
scarabaseParam.setVal("T4", param.T4);
|
|
3361
|
+
scarabaseParam.setVal("H1", CH1);
|
|
3362
|
+
scarabaseParam.setVal("H2", param.EH2);
|
|
3363
|
+
scarabaseParam.setVal("H3", param.EH3);
|
|
3364
|
+
scarabaseParam.setVal("W8", param.W8);
|
|
3365
|
+
scarabaseParam.setVal("H8", param.H8);
|
|
3366
|
+
scarabaseParam.setVal("D8", param.D8);
|
|
3367
|
+
const scarabaseGeom = scarabaseDef.pGeom(
|
|
3368
|
+
0,
|
|
3369
|
+
scarabaseParam.getParamVal(),
|
|
3370
|
+
scarabaseParam.getSuffix()
|
|
3371
|
+
);
|
|
3372
|
+
checkGeom(scarabaseGeom);
|
|
3373
|
+
rGeome.logstr += prefixLog(scarabaseGeom.logstr, scarabaseParam.getPartNameSuffix());
|
|
3374
|
+
const scaraLegParam = [];
|
|
3375
|
+
const scaraLegGeom = [];
|
|
3376
|
+
for (let ii = 0; ii < param.NB; ii++) {
|
|
3377
|
+
const iiParam = designParam(scaraDef.pDef, (ii + 1).toString());
|
|
3378
|
+
iiParam.setVal("L1", BL[ii]);
|
|
3379
|
+
iiParam.setVal("D11", param.ED1 + param.E2);
|
|
3380
|
+
iiParam.setVal("D12", BD2[ii]);
|
|
3381
|
+
iiParam.setVal("D21", 2 * ER1 + param.E3);
|
|
3382
|
+
iiParam.setVal("D22", BD2[ii + 1]);
|
|
3383
|
+
iiParam.setVal("firstEnd", 0);
|
|
3384
|
+
iiParam.setVal("secondEnd", 0);
|
|
3385
|
+
iiParam.setVal("A1", 90);
|
|
3386
|
+
iiParam.setVal("T1", param.T3);
|
|
3387
|
+
iiParam.setVal("T2", param.T3);
|
|
3388
|
+
iiParam.setVal("S2", BR2[ii + 1] + param.S12);
|
|
3389
|
+
iiParam.setVal("R1i", param.Ri);
|
|
3390
|
+
iiParam.setVal("R1e", param.Re);
|
|
3391
|
+
iiParam.setVal("iiEn", 1);
|
|
3392
|
+
iiParam.setVal("N2", 2);
|
|
3393
|
+
iiParam.setVal("S1", BR2[ii] + param.S12);
|
|
3394
|
+
iiParam.setVal("T3", param.T3);
|
|
3395
|
+
iiParam.setVal("R2i", param.Ri);
|
|
3396
|
+
iiParam.setVal("R2e", param.Re);
|
|
3397
|
+
iiParam.setVal("H1", BH1[ii + 1]);
|
|
3398
|
+
iiParam.setVal("H2", param.EH2);
|
|
3399
|
+
iiParam.setVal("H3", param.EH3);
|
|
3400
|
+
iiParam.setVal("H41", 0);
|
|
3401
|
+
iiParam.setVal("H42", 0);
|
|
3402
|
+
const iiGeom = scaraDef.pGeom(0, iiParam.getParamVal(), iiParam.getSuffix());
|
|
3403
|
+
checkGeom(iiGeom);
|
|
3404
|
+
rGeome.logstr += prefixLog(iiGeom.logstr, iiParam.getPartNameSuffix());
|
|
3405
|
+
scaraLegParam.push(iiParam);
|
|
3406
|
+
scaraLegGeom.push(iiGeom);
|
|
3407
|
+
}
|
|
3408
|
+
figTop.mergeFigure(scarabaseGeom.fig.faceT3);
|
|
3409
|
+
const legT3d = [];
|
|
3410
|
+
const axisT3d = [];
|
|
3411
|
+
for (let ii = 0; ii < param.NB; ii++) {
|
|
3412
|
+
const iiT2d = transform2d().addRotation(pi2 + PA[ii]);
|
|
3413
|
+
for (let jj = ii; jj > 0; jj--) {
|
|
3414
|
+
iiT2d.addTranslation(0, BL[jj - 1]).addRotation(PA[jj - 1]);
|
|
3415
|
+
}
|
|
3416
|
+
iiT2d.addTranslation(W52, L432);
|
|
3417
|
+
const iiTa = iiT2d.getRotation();
|
|
3418
|
+
const [iiTx, iiTy] = iiT2d.getTranslation();
|
|
3419
|
+
legT3d.push(
|
|
3420
|
+
transform3d().addTranslation(-BR2[ii], 0, 0).addRotation(0, 0, iiTa).addTranslation(iiTx, iiTy, 0)
|
|
3421
|
+
);
|
|
3422
|
+
axisT3d.push(transform3d().addRotation(0, 0, iiTa).addTranslation(iiTx, iiTy, 0));
|
|
3423
|
+
figTop.mergeFigure(
|
|
3424
|
+
scaraLegGeom[ii].fig.faceExtern.translate(-BR2[ii], 0).rotate(0, 0, iiTa).translate(iiTx, iiTy)
|
|
3425
|
+
);
|
|
3426
|
+
}
|
|
3427
|
+
figSide.mergeFigure(scarabaseGeom.fig.faceSide);
|
|
3428
|
+
let posX = param.L4 + param.L3;
|
|
3429
|
+
let posY = 0;
|
|
3430
|
+
for (let ii = 0; ii < param.NB; ii++) {
|
|
3431
|
+
if (ii > 0) {
|
|
3432
|
+
posX += BR2[ii - 1] + BL[ii - 1] - BR2[ii];
|
|
3433
|
+
}
|
|
3434
|
+
figSide.mergeFigure(figAxisCut2(posX + BR2[ii] - ER1, posY, BH1[ii] + EH23));
|
|
3435
|
+
axisT3d[ii].addTranslation(0, 0, posY);
|
|
3436
|
+
posY += param.EH2 + param.E1;
|
|
3437
|
+
legT3d[ii].addTranslation(0, 0, posY);
|
|
3438
|
+
figSide.mergeFigure(scaraLegGeom[ii].fig.faceSide.translate(posX, posY));
|
|
3439
|
+
}
|
|
3440
|
+
figBack.mergeFigure(scarabaseGeom.fig.faceBack);
|
|
3441
|
+
figAxis.addMainOI([contourCircle7(0, 0, ER1), contourCircle7(0, 0, ER1i)]);
|
|
3442
|
+
figAxis.addSecond(contourCircle7(0, 0, ER1 + param.T3));
|
|
3443
|
+
rGeome.fig = {
|
|
3444
|
+
faceTop: figTop,
|
|
3445
|
+
faceSide: figSide,
|
|
3446
|
+
faceBack: figBack,
|
|
3447
|
+
faceAxis: figAxis
|
|
3448
|
+
};
|
|
3449
|
+
const designName = rGeome.partName;
|
|
3450
|
+
const partInherit = [];
|
|
3451
|
+
const partExtrude = [];
|
|
3452
|
+
const partList = [];
|
|
3453
|
+
if ([0, 1, 3].includes(param.D3Enable)) {
|
|
3454
|
+
const fabStepY2 = param.D3Enable === 0 ? 0 : 4 * ER1;
|
|
3455
|
+
const partScarabase = {
|
|
3456
|
+
outName: `inpax_${designName}_base`,
|
|
3457
|
+
subdesign: "pax_scarabase",
|
|
3458
|
+
subgeom: scarabaseGeom,
|
|
3459
|
+
rotate: [0, 0, 0],
|
|
3460
|
+
translate: [0, fabStepY2, 0]
|
|
3461
|
+
};
|
|
3462
|
+
partInherit.push(partScarabase);
|
|
3463
|
+
partList.push(`inpax_${designName}_base`);
|
|
3464
|
+
}
|
|
3465
|
+
for (let ii = 0; ii < param.NB; ii++) {
|
|
3466
|
+
if ([0, 1].includes(param.D3Enable) || ii - param.D3Enable === -4) {
|
|
3467
|
+
const iiName = `inpax_${designName}_leg_${ii + 1}`;
|
|
3468
|
+
const iiLegT3d2 = transform3d().addRotation(0, 0, pi2).addTranslation((ii + 1) * fabStepX, 4 * ER1, 0);
|
|
3469
|
+
const iiLegT3d = param.D3Enable === 0 ? legT3d[ii] : iiLegT3d2;
|
|
3470
|
+
const iiPartScaraLeg = {
|
|
3471
|
+
outName: iiName,
|
|
3472
|
+
subdesign: `pax_${scaraLegParam[ii].getPartNameSuffix()}`,
|
|
3473
|
+
subgeom: scaraLegGeom[ii],
|
|
3474
|
+
rotate: iiLegT3d.getRotation(),
|
|
3475
|
+
translate: iiLegT3d.getTranslation()
|
|
3476
|
+
};
|
|
3477
|
+
partInherit.push(iiPartScaraLeg);
|
|
3478
|
+
partList.push(iiName);
|
|
3479
|
+
}
|
|
3480
|
+
}
|
|
3481
|
+
if ([0, 1, 2].includes(param.D3Enable)) {
|
|
3482
|
+
for (let ii = 0; ii < param.NB; ii++) {
|
|
3483
|
+
const iiName = `subpax_${designName}_axis_${ii + 1}`;
|
|
3484
|
+
const iiAxisT3d2 = transform3d().addTranslation((ii + 1) * 3 * ER1, 2 * ER1, 0);
|
|
3485
|
+
const iiAxisT3d = param.D3Enable === 0 ? axisT3d[ii] : iiAxisT3d2;
|
|
3486
|
+
const iiPartAxis = {
|
|
3487
|
+
outName: iiName,
|
|
3488
|
+
face: `${designName}_faceAxis`,
|
|
3489
|
+
extrudeMethod: EExtrude8.eLinearOrtho,
|
|
3490
|
+
length: BH1[ii] + EH23,
|
|
3491
|
+
rotate: iiAxisT3d.getRotation(),
|
|
3492
|
+
translate: iiAxisT3d.getTranslation()
|
|
3493
|
+
};
|
|
3494
|
+
partExtrude.push(iiPartAxis);
|
|
3495
|
+
partList.push(iiName);
|
|
3496
|
+
}
|
|
3497
|
+
}
|
|
3498
|
+
rGeome.vol = {
|
|
3499
|
+
inherits: partInherit,
|
|
3500
|
+
extrudes: partExtrude,
|
|
3501
|
+
volumes: [
|
|
3502
|
+
{
|
|
3503
|
+
outName: `pax_${designName}`,
|
|
3504
|
+
boolMethod: EBVolume8.eUnion,
|
|
3505
|
+
inList: partList
|
|
3506
|
+
}
|
|
3507
|
+
]
|
|
3508
|
+
};
|
|
3509
|
+
const subBase = {
|
|
3510
|
+
partName: scarabaseParam.getPartName(),
|
|
3511
|
+
dparam: scarabaseParam.getDesignParamList(),
|
|
3512
|
+
orientation: [0, 0, 0],
|
|
3513
|
+
position: [0, 0, 0]
|
|
3514
|
+
};
|
|
3515
|
+
rGeome.sub = {
|
|
3516
|
+
scaraBase: subBase
|
|
3517
|
+
};
|
|
3518
|
+
for (let ii = 0; ii < param.NB; ii++) {
|
|
3519
|
+
const subLeg = {
|
|
3520
|
+
partName: scaraLegParam[ii].getPartName(),
|
|
3521
|
+
dparam: scaraLegParam[ii].getDesignParamList(),
|
|
3522
|
+
orientation: legT3d[ii].getRotation(),
|
|
3523
|
+
position: legT3d[ii].getTranslation()
|
|
3524
|
+
};
|
|
3525
|
+
rGeome.sub[`scaraLeg_${ii + 1}`] = subLeg;
|
|
3526
|
+
}
|
|
3527
|
+
rGeome.logstr += "Long2D drawn successfully!\n";
|
|
3528
|
+
rGeome.calcErr = false;
|
|
3529
|
+
} catch (emsg) {
|
|
3530
|
+
rGeome.logstr += emsg;
|
|
3531
|
+
console.log(emsg);
|
|
3532
|
+
}
|
|
3533
|
+
return rGeome;
|
|
3534
|
+
}
|
|
3535
|
+
var long2dDef = {
|
|
3536
|
+
pTitle: "long2d",
|
|
3537
|
+
pDescription: "A long arm with many legs moving in one 2D-plan",
|
|
3538
|
+
pDef: pDef8,
|
|
3539
|
+
pGeom: pGeom8
|
|
2021
3540
|
};
|
|
2022
3541
|
export {
|
|
2023
3542
|
abriDef,
|
|
2024
3543
|
catamaranDef,
|
|
3544
|
+
cuisineDef,
|
|
3545
|
+
long2dDef,
|
|
3546
|
+
scaraDef,
|
|
3547
|
+
scarabaseDef,
|
|
2025
3548
|
stairsDef,
|
|
2026
3549
|
voilaDef
|
|
2027
3550
|
};
|