desi76 0.1.12 → 0.1.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1732,40 +1732,399 @@ var abriDef = {
1732
1732
  pGeom: pGeom3
1733
1733
  };
1734
1734
 
1735
- // src/stone/stairs.ts
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
- pDropdown as pDropdown2,
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
- pNumber4("Nn", "stair", 25, 1, 200, 1),
1756
- pNumber4("Nd", "stair", 20, 2, 200, 1),
1757
- pNumber4("D1", "mm", 5e3, 1e3, 5e4, 1),
1758
- pNumber4("Wi1", "mm", 1e3, 1, 1e4, 1),
1759
- pNumber4("We1", "mm", 1e3, 1, 1e4, 1),
1760
- pNumber4("Wi2", "mm", 2e3, 1, 1e4, 1),
1761
- pNumber4("We2", "mm", 2e3, 1, 1e4, 1),
1762
- pSectionSeparator4("Details"),
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
- pNumber4("H1", "mm", 200, 10, 2e3, 1),
1766
- pNumber4("H1b", "mm", 100, 0, 2e3, 1),
1767
- pNumber4("Wc", "mm", 200, 10, 2e3, 1),
1768
- pNumber4("Nc", "column", 6, 0, 100, 1)
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 pGeom4(t, param, suffix = "") {
1793
- const rGeome = initGeom4(pDef4.partName + suffix);
1794
- const figTop = figure4();
1795
- const figTopColumn = figure4();
1796
- const figBorderI = figure4();
1797
- const figBorderE = figure4();
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 = contour4(pp0.cx, pp0.cy);
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 = contour4(pe1.cx, pe1.cy);
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 ${ffix3(radToDeg2(2 * aStair2))} degree
2231
+ rGeome.logstr += `Stair angle ${ffix4(radToDeg3(2 * aStair2))} degree
1873
2232
  `;
1874
- rGeome.logstr += `Stairs angle ${ffix3(param.Nn / param.Nd)} turn with ${columnNb} columns
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(ctrRectangle3(xx, yy, lStair, param.H1));
2291
+ figBorderI.addMainO(ctrRectangle4(xx, yy, lStair, param.H1));
1933
2292
  if ((ii + 1) % Nc === 0 && yy > 0) {
1934
- figBorderI.addMainO(ctrRectangle3(xx, 0, lStair, yy));
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(ctrRectangle3(xx, yy, lStair, param.H1));
2303
+ figBorderE.addMainO(ctrRectangle4(xx, yy, lStair, param.H1));
1945
2304
  if ((ii + 1) % Nc === 0 && yy > 0) {
1946
- figBorderE.addMainO(ctrRectangle3(xx, 0, lStair, yy));
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 = figure4();
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: EExtrude4.eLinearOrtho,
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 = figure4();
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: EExtrude4.eLinearOrtho,
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: EBVolume4.eUnion,
2361
+ boolMethod: EBVolume5.eUnion,
2003
2362
  inList: listVolName
2004
2363
  }
2005
2364
  ]
@@ -2016,12 +2375,457 @@ function pGeom4(t, param, suffix = "") {
2016
2375
  var stairsDef = {
2017
2376
  pTitle: "stairs",
2018
2377
  pDescription: "an helicoidal stairs",
2019
- pDef: pDef4,
2020
- pGeom: pGeom4
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_side.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
2021
2823
  };
2022
2824
  export {
2023
2825
  abriDef,
2024
2826
  catamaranDef,
2827
+ cuisineDef,
2828
+ scaraDef,
2025
2829
  stairsDef,
2026
2830
  voilaDef
2027
2831
  };