mxcad 1.0.76 → 1.0.77
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/mxcad.d.ts +12 -0
- package/dist/mxcad.es.js +196 -183
- package/dist/mxcad.umd.js +17 -17
- package/dist/wasm/2d/mxdrawassembly_min.js +551 -549
- package/dist/wasm/2d/mxdrawassembly_min.wasm +0 -0
- package/dist/wasm/2d-st/mxdrawassembly_min.js +547 -545
- package/dist/wasm/2d-st/mxdrawassembly_minst.wasm +0 -0
- package/package.json +2 -2
package/dist/mxcad.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MxFun as h, MrxDbgUiPrPoint as O, MxCursorType as bD, MrxDbgUtils as fD, DynamicInputType as xD, DetailedResult as iD, MrxDbgUiPrDist as BC, store as MD, loadCoreCode as EC, MxPaintBrush as v, MrxDbgUiPrBaseReturn as T, MxDbCircleShape as PD, MxDbLine as Q, MxDbPolyline as FC, MxDbCircleArc as Y, Mx3PointArc as AC, MxDbEllipseShape as
|
|
1
|
+
import { MxFun as h, MrxDbgUiPrPoint as O, MxCursorType as bD, MrxDbgUtils as fD, DynamicInputType as xD, DetailedResult as iD, MrxDbgUiPrDist as BC, store as MD, loadCoreCode as EC, MxPaintBrush as v, MrxDbgUiPrBaseReturn as T, MxDbCircleShape as PD, MxDbLine as Q, MxDbPolyline as FC, MxDbCircleArc as Y, Mx3PointArc as AC, MxDbEllipseShape as eC, McEdGetPointWorldDrawObject as tC, MxDbEllipse as iC } from "mxdraw";
|
|
2
2
|
function TD(E) {
|
|
3
3
|
return btoa(unescape(encodeURIComponent(E)));
|
|
4
4
|
}
|
|
@@ -71,8 +71,8 @@ class rC {
|
|
|
71
71
|
if (F == " ")
|
|
72
72
|
C += "+";
|
|
73
73
|
else if (A >= 19968 && A <= 40869) {
|
|
74
|
-
let
|
|
75
|
-
C += "%" + this.z.substr(
|
|
74
|
+
let e = A - 19968;
|
|
75
|
+
C += "%" + this.z.substr(e * 4, 2) + "%" + this.z.substr(e * 4 + 2, 2);
|
|
76
76
|
} else
|
|
77
77
|
C += "%" + D.charCodeAt(B).toString(16);
|
|
78
78
|
}
|
|
@@ -90,11 +90,11 @@ class rC {
|
|
|
90
90
|
var A = D.charAt(B);
|
|
91
91
|
if (isNaN(parseInt(A)))
|
|
92
92
|
try {
|
|
93
|
-
var
|
|
93
|
+
var e = D.substr(B, 2) + D.substr(B + 3, 2);
|
|
94
94
|
B = B + 4;
|
|
95
|
-
for (var
|
|
96
|
-
if (
|
|
97
|
-
C += String.fromCharCode(
|
|
95
|
+
for (var t = -1; (t = this.z.indexOf(e, t + 1)) != -1; )
|
|
96
|
+
if (t % 4 == 0) {
|
|
97
|
+
C += String.fromCharCode(t / 4 + 19968);
|
|
98
98
|
break;
|
|
99
99
|
}
|
|
100
100
|
} catch {
|
|
@@ -684,6 +684,16 @@ class mD extends K {
|
|
|
684
684
|
let C = P.encodeToGb2312(D);
|
|
685
685
|
this.imp.SetCurrentlyTextStyle(C);
|
|
686
686
|
}
|
|
687
|
+
HandleToIdIndex(D) {
|
|
688
|
+
let C = this.imp.HandleToIdIndex(D);
|
|
689
|
+
return new R(C, k.kMxCAD);
|
|
690
|
+
}
|
|
691
|
+
IsModifyed() {
|
|
692
|
+
return this.imp.IsModifyed();
|
|
693
|
+
}
|
|
694
|
+
ResetModificationStatus() {
|
|
695
|
+
return this.imp.SetModifyed(!1);
|
|
696
|
+
}
|
|
687
697
|
}
|
|
688
698
|
class GD extends K {
|
|
689
699
|
constructor(D) {
|
|
@@ -939,8 +949,8 @@ class V extends G {
|
|
|
939
949
|
}
|
|
940
950
|
}
|
|
941
951
|
class X extends V {
|
|
942
|
-
constructor(D, C, B, F, A,
|
|
943
|
-
D instanceof Object ? D instanceof a ? (super(), this.initTempObject(new i.mxcadassemblyimp.MdDbLine()), C instanceof a && (this.startPoint = D, this.endPoint = C)) : super(D) : (super(), this.initTempObject(new i.mxcadassemblyimp.MdDbLine()), this.startPoint = new a(D, C, B), this.endPoint = new a(F, A,
|
|
952
|
+
constructor(D, C, B, F, A, e) {
|
|
953
|
+
D instanceof Object ? D instanceof a ? (super(), this.initTempObject(new i.mxcadassemblyimp.MdDbLine()), C instanceof a && (this.startPoint = D, this.endPoint = C)) : super(D) : (super(), this.initTempObject(new i.mxcadassemblyimp.MdDbLine()), this.startPoint = new a(D, C, B), this.endPoint = new a(F, A, e));
|
|
944
954
|
}
|
|
945
955
|
get startPoint() {
|
|
946
956
|
return new a(this.imp.startPoint());
|
|
@@ -1093,8 +1103,8 @@ class CD extends V {
|
|
|
1093
1103
|
}
|
|
1094
1104
|
addVertexAt(D, C = 0, B = 0, F = 0, A = 0) {
|
|
1095
1105
|
if (D instanceof THREE.Vector3) {
|
|
1096
|
-
let
|
|
1097
|
-
return
|
|
1106
|
+
let e = new i.mxcadassemblyimp.MdGePoint3d();
|
|
1107
|
+
return e.x = D.x, e.y = D.y, e.z = D.z, this.imp.addVertexAt(A, e, C, B, F);
|
|
1098
1108
|
} else
|
|
1099
1109
|
return this.imp.addVertexAt(A, D.imp, C, B, F);
|
|
1100
1110
|
}
|
|
@@ -1340,20 +1350,20 @@ class BD extends V {
|
|
|
1340
1350
|
set endAngle(D) {
|
|
1341
1351
|
this.imp.setEndAngle(D);
|
|
1342
1352
|
}
|
|
1343
|
-
computeArc(D, C, B, F, A,
|
|
1353
|
+
computeArc(D, C, B, F, A, e) {
|
|
1344
1354
|
return this.imp.computeArc(
|
|
1345
1355
|
D,
|
|
1346
1356
|
C,
|
|
1347
1357
|
B,
|
|
1348
1358
|
F,
|
|
1349
1359
|
A,
|
|
1350
|
-
|
|
1360
|
+
e
|
|
1351
1361
|
);
|
|
1352
1362
|
}
|
|
1353
1363
|
}
|
|
1354
1364
|
class FD extends V {
|
|
1355
|
-
constructor(D, C, B, F, A,
|
|
1356
|
-
D instanceof Object ? super(D) : (super(), this.initTempObject(new i.mxcadassemblyimp.MdDbEllipse()), typeof D == "number" && (
|
|
1365
|
+
constructor(D, C, B, F, A, e, t, r, s) {
|
|
1366
|
+
D instanceof Object ? super(D) : (super(), this.initTempObject(new i.mxcadassemblyimp.MdDbEllipse()), typeof D == "number" && (t || (t = 1), typeof r != "number" && (r = 0), typeof s != "number" && (s = 6.283185307179586), this.imp.InitData(new a(D, C, B).imp, new y(F, A, e).imp, t, r, s)));
|
|
1357
1367
|
}
|
|
1358
1368
|
setCenter(D, C, B) {
|
|
1359
1369
|
this.imp.setCenter(new a(D, C, B).imp);
|
|
@@ -1495,30 +1505,30 @@ class UD {
|
|
|
1495
1505
|
}
|
|
1496
1506
|
findEntAtPoint(D, C, B, F = -1, A = null) {
|
|
1497
1507
|
this.init();
|
|
1498
|
-
let
|
|
1499
|
-
return new R(
|
|
1508
|
+
let e = this.imp.findEntAtPoint(D, C, B, F, N(A));
|
|
1509
|
+
return new R(e, k.kMxCAD);
|
|
1500
1510
|
}
|
|
1501
1511
|
selectEnt(D, C = null, B = !0) {
|
|
1502
1512
|
return this.init(), new Promise(async (F) => {
|
|
1503
1513
|
const A = new O();
|
|
1504
1514
|
D && A.setMessage(D), A.setCursorType(bD.kRect), A.setDisableOsnap(!0);
|
|
1505
|
-
let
|
|
1506
|
-
if (!
|
|
1515
|
+
let e = await A.go();
|
|
1516
|
+
if (!e) {
|
|
1507
1517
|
F([]);
|
|
1508
1518
|
return;
|
|
1509
1519
|
}
|
|
1510
1520
|
if (B)
|
|
1511
|
-
fD.findEntAtPoint(
|
|
1521
|
+
fD.findEntAtPoint(e).then((t) => {
|
|
1512
1522
|
let r = [];
|
|
1513
|
-
|
|
1523
|
+
t.forEach((o) => {
|
|
1514
1524
|
r.push(new R(o, k.kMxDraw));
|
|
1515
1525
|
});
|
|
1516
|
-
let s = this.findEntAtPoint(
|
|
1526
|
+
let s = this.findEntAtPoint(e.x, e.y, e.z, -1, C);
|
|
1517
1527
|
s.isValid() && r.push(s), F(r);
|
|
1518
1528
|
});
|
|
1519
1529
|
else {
|
|
1520
|
-
let
|
|
1521
|
-
r.isValid() &&
|
|
1530
|
+
let t = [], r = this.findEntAtPoint(e.x, e.y, e.z, -1, C);
|
|
1531
|
+
r.isValid() && t.push(r), F(t);
|
|
1522
1532
|
}
|
|
1523
1533
|
});
|
|
1524
1534
|
}
|
|
@@ -1573,12 +1583,12 @@ class Z extends K {
|
|
|
1573
1583
|
let A = await B.go();
|
|
1574
1584
|
if (F = B.getDetailedResult(), !A)
|
|
1575
1585
|
break;
|
|
1576
|
-
let
|
|
1577
|
-
F =
|
|
1586
|
+
let e = await fD.getCorner(A, D, !0, (t) => {
|
|
1587
|
+
F = t.detailedResult;
|
|
1578
1588
|
});
|
|
1579
|
-
if (!
|
|
1589
|
+
if (!e)
|
|
1580
1590
|
break;
|
|
1581
|
-
this.imp.userSelect(A.x, A.y,
|
|
1591
|
+
this.imp.userSelect(A.x, A.y, e.x, e.y, N(C));
|
|
1582
1592
|
}
|
|
1583
1593
|
return this.imp.highlightEntity(!1), F == iD.kEcsIn || F == iD.kNewCommadIn || F == iD.kUnknown ? new Promise((A) => {
|
|
1584
1594
|
A(!1);
|
|
@@ -1782,10 +1792,10 @@ class _ {
|
|
|
1782
1792
|
openWebFile(D, C, B = !0) {
|
|
1783
1793
|
let F = this.imp.mxdrawObject, A = Math.round(Math.random() * 1e7);
|
|
1784
1794
|
if (C) {
|
|
1785
|
-
let
|
|
1786
|
-
F.removeEventFuction("openFileComplete",
|
|
1795
|
+
let e = (t, r) => {
|
|
1796
|
+
F.removeEventFuction("openFileComplete", e), A == r && C(t);
|
|
1787
1797
|
};
|
|
1788
|
-
F.addEvent("openFileComplete",
|
|
1798
|
+
F.addEvent("openFileComplete", e);
|
|
1789
1799
|
}
|
|
1790
1800
|
return _.currentFileName = D.split("/").pop(), this.imp.openWebFile(D, B, A);
|
|
1791
1801
|
}
|
|
@@ -1801,12 +1811,12 @@ class _ {
|
|
|
1801
1811
|
saveFile(D, C, B = !0, F = !0) {
|
|
1802
1812
|
D || (D = this.getCurrentFileName()), D.indexOf(".") == -1 && (D += ".mxweb");
|
|
1803
1813
|
const A = window;
|
|
1804
|
-
return A.mx_saveFile_call = (
|
|
1805
|
-
if (C && C(
|
|
1814
|
+
return A.mx_saveFile_call = (e) => {
|
|
1815
|
+
if (C && C(e), !!e) {
|
|
1806
1816
|
if (B) {
|
|
1807
|
-
let
|
|
1808
|
-
/^((?!chrome|android).)*safari/i.test(navigator.userAgent) ?
|
|
1809
|
-
blob:
|
|
1817
|
+
let t;
|
|
1818
|
+
/^((?!chrome|android).)*safari/i.test(navigator.userAgent) ? t = new Blob([e.buffer], { type: "application/octet-stream" }) : t = new Blob([e.buffer], { type: "application/octet-binary" }), F ? J.saveAsFileDialog({
|
|
1819
|
+
blob: t,
|
|
1810
1820
|
filename: D,
|
|
1811
1821
|
types: [{
|
|
1812
1822
|
description: "mxweb File",
|
|
@@ -1814,7 +1824,7 @@ class _ {
|
|
|
1814
1824
|
"application/octet-stream": [".mxweb"]
|
|
1815
1825
|
}
|
|
1816
1826
|
}]
|
|
1817
|
-
}) : J.downloadFile(
|
|
1827
|
+
}) : J.downloadFile(t, D);
|
|
1818
1828
|
}
|
|
1819
1829
|
A.mx_saveFile_call = null;
|
|
1820
1830
|
}
|
|
@@ -1889,8 +1899,8 @@ class _ {
|
|
|
1889
1899
|
AddLinetypeEx(D, C, B) {
|
|
1890
1900
|
this.imp.AddLinetypeEx(D, C, B);
|
|
1891
1901
|
}
|
|
1892
|
-
DrawLine(D, C, B, F, A,
|
|
1893
|
-
return this.imp.DrawLine(D, C, B, F, A,
|
|
1902
|
+
DrawLine(D, C, B, F, A, e) {
|
|
1903
|
+
return this.imp.DrawLine(D, C, B, F, A, e);
|
|
1894
1904
|
}
|
|
1895
1905
|
AddDimStyle(D, C, B, F, A) {
|
|
1896
1906
|
return this.imp.AddDimStyle(D, C, B, F, A);
|
|
@@ -1916,8 +1926,8 @@ class _ {
|
|
|
1916
1926
|
DrawArc(D, C, B, F, A) {
|
|
1917
1927
|
return this.imp.DrawArc(D, C, B, F, A);
|
|
1918
1928
|
}
|
|
1919
|
-
DrawArc2(D, C, B, F, A,
|
|
1920
|
-
return this.imp.DrawArc2(D, C, B, F, A,
|
|
1929
|
+
DrawArc2(D, C, B, F, A, e) {
|
|
1930
|
+
return this.imp.DrawArc2(D, C, B, F, A, e);
|
|
1921
1931
|
}
|
|
1922
1932
|
DrawCircle(D, C, B) {
|
|
1923
1933
|
return this.imp.DrawCircle(D, C, B);
|
|
@@ -1925,35 +1935,35 @@ class _ {
|
|
|
1925
1935
|
DrawEllipse(D, C, B, F, A) {
|
|
1926
1936
|
return this.imp.DrawEllipse(D, C, B, F, A);
|
|
1927
1937
|
}
|
|
1928
|
-
DrawEllipseArc(D, C, B, F, A,
|
|
1929
|
-
return this.imp.DrawEllipseArc(D, C, B, F, A,
|
|
1938
|
+
DrawEllipseArc(D, C, B, F, A, e, t) {
|
|
1939
|
+
return this.imp.DrawEllipseArc(D, C, B, F, A, e, t);
|
|
1930
1940
|
}
|
|
1931
1941
|
DrawPoint(D, C) {
|
|
1932
1942
|
return this.imp.DrawPoint(D, C);
|
|
1933
1943
|
}
|
|
1934
|
-
DrawSolid(D, C, B, F, A,
|
|
1935
|
-
return this.imp.DrawSolid(D, C, B, F, A,
|
|
1944
|
+
DrawSolid(D, C, B, F, A, e, t, r) {
|
|
1945
|
+
return this.imp.DrawSolid(D, C, B, F, A, e, t, r);
|
|
1936
1946
|
}
|
|
1937
|
-
DrawMText(D, C, B, F, A,
|
|
1938
|
-
return this.imp.DrawMText(D, C, B, F, A,
|
|
1947
|
+
DrawMText(D, C, B, F, A, e, t) {
|
|
1948
|
+
return this.imp.DrawMText(D, C, B, F, A, e, t);
|
|
1939
1949
|
}
|
|
1940
|
-
DrawText(D, C, B, F, A,
|
|
1941
|
-
return this.imp.DrawTextDrawText(D, C, B, F, A,
|
|
1950
|
+
DrawText(D, C, B, F, A, e, t) {
|
|
1951
|
+
return this.imp.DrawTextDrawText(D, C, B, F, A, e, t);
|
|
1942
1952
|
}
|
|
1943
1953
|
DrawBlockReference(D, C, B, F, A) {
|
|
1944
1954
|
return this.imp.DrawBlockReference(D, C, B, F, A);
|
|
1945
1955
|
}
|
|
1946
|
-
DrawDimAligned(D, C, B, F, A,
|
|
1947
|
-
return this.imp.DrawDimAligned(D, C, B, F, A,
|
|
1956
|
+
DrawDimAligned(D, C, B, F, A, e) {
|
|
1957
|
+
return this.imp.DrawDimAligned(D, C, B, F, A, e);
|
|
1948
1958
|
}
|
|
1949
|
-
DrawDimAngular(D, C, B, F, A,
|
|
1950
|
-
return this.imp.DrawDimAngular(D, C, B, F, A,
|
|
1959
|
+
DrawDimAngular(D, C, B, F, A, e, t, r) {
|
|
1960
|
+
return this.imp.DrawDimAngular(D, C, B, F, A, e, t, r);
|
|
1951
1961
|
}
|
|
1952
1962
|
DrawDimDiametric(D, C, B, F, A) {
|
|
1953
1963
|
return this.imp.DrawDimDiametric(D, C, B, F, A);
|
|
1954
1964
|
}
|
|
1955
|
-
DrawDimRotated(D, C, B, F, A,
|
|
1956
|
-
return this.imp.DrawDimRotated(D, C, B, F, A,
|
|
1965
|
+
DrawDimRotated(D, C, B, F, A, e, t) {
|
|
1966
|
+
return this.imp.DrawDimRotated(D, C, B, F, A, e, t);
|
|
1957
1967
|
}
|
|
1958
1968
|
DrawDimOrdinate(D, C, B, F, A) {
|
|
1959
1969
|
return this.imp.DrawDimOrdinate(D, C, B, F, A);
|
|
@@ -2019,8 +2029,8 @@ class KD {
|
|
|
2019
2029
|
return this.imp.getLastCallResult();
|
|
2020
2030
|
}
|
|
2021
2031
|
CreateMxCAD(D, C, B, F, A) {
|
|
2022
|
-
let
|
|
2023
|
-
return new _(
|
|
2032
|
+
let e = this.imp.CreateMxDraw(D, C, B, F, A);
|
|
2033
|
+
return new _(e);
|
|
2024
2034
|
}
|
|
2025
2035
|
DestroyObject(D) {
|
|
2026
2036
|
this.imp.DestroyObject(D);
|
|
@@ -2119,7 +2129,7 @@ class HD {
|
|
|
2119
2129
|
return this.App.GetCurrentMxCAD().GetDatabase();
|
|
2120
2130
|
}
|
|
2121
2131
|
}
|
|
2122
|
-
const hD = "1.0.
|
|
2132
|
+
const hD = "1.0.77", lC = "SharedArrayBuffer" in window, eD = document.currentScript && /unpkg\.com\/mxcad/.test(document.currentScript.src), cC = (E, D = self.location.href) => eD ? `https://unpkg.com/mxcad@${hD}/dist/wasm/2d-st/${E}` : D + E, mC = (E, D = self.location.href) => eD ? `https://unpkg.com/mxcad@${hD}/dist/wasm/2d/${E}` : D + E, pC = (E, D = self.location.href) => eD ? `https://unpkg.com/mxcad@${hD}/dist/wasm/3d/${E}` : D + E, ND = (E) => new Promise((D, C) => {
|
|
2123
2133
|
const B = document.createElement("script");
|
|
2124
2134
|
B.src = E, B.type = "text/javascript", B.crossOrigin = "anonymous", document.body.appendChild(B), B.onload = () => {
|
|
2125
2135
|
D();
|
|
@@ -2131,8 +2141,8 @@ const hD = "1.0.76", lC = "SharedArrayBuffer" in window, tD = document.currentSc
|
|
|
2131
2141
|
return await ND(F), await globalThis[D](C);
|
|
2132
2142
|
};
|
|
2133
2143
|
let i;
|
|
2134
|
-
async function _D(E, D = lC || !
|
|
2135
|
-
return new Promise(async (A,
|
|
2144
|
+
async function _D(E, D = lC || !eD ? cC : mC, C, B, F) {
|
|
2145
|
+
return new Promise(async (A, e) => {
|
|
2136
2146
|
try {
|
|
2137
2147
|
if (i || (i = new HD()), i.mxcadassemblyimp)
|
|
2138
2148
|
return E && E(i), A(i);
|
|
@@ -2143,8 +2153,8 @@ async function _D(E, D = lC || !tD ? cC : mC, C, B, F) {
|
|
|
2143
2153
|
i.mxcadassemblyimp = r;
|
|
2144
2154
|
let s = new r.McApp();
|
|
2145
2155
|
B && s.setFontFilePath(B), s.Init(), i.App.init(s), F && i.App.addNetworkLoadingFont(F), E && E(i), A(i);
|
|
2146
|
-
} catch (
|
|
2147
|
-
t
|
|
2156
|
+
} catch (t) {
|
|
2157
|
+
e(t);
|
|
2148
2158
|
}
|
|
2149
2159
|
});
|
|
2150
2160
|
}
|
|
@@ -2169,7 +2179,7 @@ const hC = (E) => {
|
|
|
2169
2179
|
}
|
|
2170
2180
|
}), wC = async (E) => {
|
|
2171
2181
|
MD.state.MxFun || await EC();
|
|
2172
|
-
const { multipleSelect: D, networkFonts: C, fontspath: B, locateFile: F, wasmBinary: A, canvas:
|
|
2182
|
+
const { multipleSelect: D, networkFonts: C, fontspath: B, locateFile: F, wasmBinary: A, canvas: e, userIdentitySign: t, onOpenFileComplete: r, fileUrl: s, onInit: o = () => {
|
|
2173
2183
|
h.setIniset({
|
|
2174
2184
|
EnableIntelliSelect: !0,
|
|
2175
2185
|
IntelliSelectType: 1,
|
|
@@ -2178,7 +2188,7 @@ const hC = (E) => {
|
|
|
2178
2188
|
} } = E || {};
|
|
2179
2189
|
await _D(() => {
|
|
2180
2190
|
}, F, A, B, C), o();
|
|
2181
|
-
let u = await yC(
|
|
2191
|
+
let u = await yC(e, t);
|
|
2182
2192
|
const l = h.getMxFunTHREE();
|
|
2183
2193
|
let c = new l.Vector2();
|
|
2184
2194
|
u.getRenderer().getSize(c);
|
|
@@ -2210,16 +2220,16 @@ async function gC() {
|
|
|
2210
2220
|
class bC extends PD {
|
|
2211
2221
|
getGripPoints() {
|
|
2212
2222
|
const { x: D, y: C, z: B } = this.center;
|
|
2213
|
-
let F = new THREE.Vector3(D, C + this.radius, B), A = new THREE.Vector3(D, C - this.radius, B),
|
|
2214
|
-
return [this.center, F, A,
|
|
2223
|
+
let F = new THREE.Vector3(D, C + this.radius, B), A = new THREE.Vector3(D, C - this.radius, B), e = new THREE.Vector3(D - this.radius, C, B), t = new THREE.Vector3(D + this.radius, C, B);
|
|
2224
|
+
return [this.center, F, A, e, t];
|
|
2215
2225
|
}
|
|
2216
2226
|
moveGripPointsAt(D, C) {
|
|
2217
|
-
const [B, F, A,
|
|
2218
|
-
return D === 0 && (this.center = B.add(C)), D === 1 && (this.radius = F.add(C).distanceTo(this.center)), D === 2 && (this.radius = A.add(C).distanceTo(this.center)), D === 3 && (this.radius =
|
|
2227
|
+
const [B, F, A, e, t] = this.getGripPoints();
|
|
2228
|
+
return D === 0 && (this.center = B.add(C)), D === 1 && (this.radius = F.add(C).distanceTo(this.center)), D === 2 && (this.radius = A.add(C).distanceTo(this.center)), D === 3 && (this.radius = e.add(C).distanceTo(this.center)), D === 4 && (this.radius = t.add(C).distanceTo(this.center)), !0;
|
|
2219
2229
|
}
|
|
2220
2230
|
}
|
|
2221
2231
|
const wD = (E) => {
|
|
2222
|
-
const [D, C, B] = E, { x: F, y: A, z:
|
|
2232
|
+
const [D, C, B] = E, { x: F, y: A, z: e } = D, { x: t, y: r, z: s } = C, { x: o, y: u, z: l } = B, c = A * s - r * e - A * l + u * e + r * l - u * s, n = -(F * s - t * e - F * l + o * e + t * l - o * s), m = F * r - t * A - F * u + o * A + t * u - o * r, w = -(F * r * l - F * u * s - t * A * l + t * u * e + o * A * s - o * r * e), b = 2 * (t - F), p = 2 * (r - A), d = 2 * (s - e), x = F * F + A * A + e * e - t * t - r * r - s * s, f = 2 * (o - F), g = 2 * (u - A), M = 2 * (l - e), L = F * F + A * A + e * e - o * o - u * u - l * l, $ = -(n * d * L - n * M * x - p * m * L + p * M * w + g * m * x - g * d * w) / (c * p * M - c * g * d - b * n * M + b * g * m + f * n * d - f * p * m), DC = (c * d * L - c * M * x - b * m * L + b * M * w + f * m * x - f * d * w) / (c * p * M - c * g * d - b * n * M + b * g * m + f * n * d - f * p * m), CC = -(c * p * L - c * g * x - b * n * L + b * g * w + f * n * x - f * p * w) / (c * p * M - c * g * d - b * n * M + b * g * m + f * n * d - f * p * m);
|
|
2223
2233
|
return new THREE.Vector3($, DC, CC);
|
|
2224
2234
|
};
|
|
2225
2235
|
function qD() {
|
|
@@ -2227,23 +2237,23 @@ function qD() {
|
|
|
2227
2237
|
let D = new bC(), C = i.GetCurrentDatabase().GetCurrentlyDrawColor();
|
|
2228
2238
|
v.use(D), D.closed = !1, D.setColor(C);
|
|
2229
2239
|
let B = 0, F = "default", A = !0;
|
|
2230
|
-
const
|
|
2240
|
+
const e = () => {
|
|
2231
2241
|
E.setUserDraw(
|
|
2232
2242
|
(n, m) => {
|
|
2233
2243
|
D.radius = A ? D.center.distanceTo(n) : D.center.distanceTo(n) / 2, m.drawCustomEntity(D), m.drawLine(D.center, n);
|
|
2234
2244
|
}
|
|
2235
2245
|
);
|
|
2236
|
-
},
|
|
2246
|
+
}, t = (n) => {
|
|
2237
2247
|
if (F === "default") {
|
|
2238
2248
|
if (n === T.kOk) {
|
|
2239
2249
|
if (B === 0)
|
|
2240
2250
|
E.setMessage(`
|
|
2241
|
-
\u6307\u5B9A\u5706\u7684\u534A\u5F84:`), E.setKeyWords("[\u76F4\u5F84(D)]"), D.center = E.value(),
|
|
2251
|
+
\u6307\u5B9A\u5706\u7684\u534A\u5F84:`), E.setKeyWords("[\u76F4\u5F84(D)]"), D.center = E.value(), e();
|
|
2242
2252
|
else if (B === 1)
|
|
2243
2253
|
return i.GetCurrentMxCAD().DrawEntity(new W(D.center.x, D.center.y, 0, D.radius)), !0;
|
|
2244
2254
|
B++;
|
|
2245
2255
|
}
|
|
2246
|
-
n === T.kKeyWord && E.isKeyWordPicked("D") && (A = !1,
|
|
2256
|
+
n === T.kKeyWord && E.isKeyWordPicked("D") && (A = !1, e(), E.setMessage(`
|
|
2247
2257
|
\u6307\u5B9A\u5706\u7684\u76F4\u5F84:`), E.setKeyWords(""));
|
|
2248
2258
|
}
|
|
2249
2259
|
};
|
|
@@ -2298,7 +2308,7 @@ function qD() {
|
|
|
2298
2308
|
\u6307\u5B9A\u5706\u7684\u5706\u5FC3\u6216[\u4E09\u70B9(3P)/\u4E24\u70B9(2P)/\u5207\u70B9\u3001\u5207\u70B9\u3001\u534A\u5F84(T)]:`
|
|
2299
2309
|
), E.setKeyWords("3P 2P T"), E.goWhile(
|
|
2300
2310
|
(n) => {
|
|
2301
|
-
if (n === T.kKeyWord && (E.isKeyWordPicked("3P") ? F = "3P" : E.isKeyWordPicked("2P") ? F = "2P" : E.isKeyWordPicked("T") && (F = "T")),
|
|
2311
|
+
if (n === T.kKeyWord && (E.isKeyWordPicked("3P") ? F = "3P" : E.isKeyWordPicked("2P") ? F = "2P" : E.isKeyWordPicked("T") && (F = "T")), t(n))
|
|
2302
2312
|
return { exit: !0 };
|
|
2303
2313
|
if (s(n))
|
|
2304
2314
|
return { exit: !0 };
|
|
@@ -2318,8 +2328,8 @@ h.on("init", () => {
|
|
|
2318
2328
|
const gD = () => MD.state.MxFun.stopRunCommand();
|
|
2319
2329
|
function rD(E, D, C, B) {
|
|
2320
2330
|
const F = E - C, A = D - B;
|
|
2321
|
-
let
|
|
2322
|
-
return F == 0 ?
|
|
2331
|
+
let e = 0;
|
|
2332
|
+
return F == 0 ? e = Math.PI / 2 : e = Math.atan(Math.abs(A / F)), F < 0 && A >= 0 ? e = Math.PI - e : F < 0 && A < 0 ? e = Math.PI + e : F >= 0 && A < 0 && (e = Math.PI * 2 - e), e;
|
|
2323
2333
|
}
|
|
2324
2334
|
const S = (E, D, C) => {
|
|
2325
2335
|
const B = () => {
|
|
@@ -2338,31 +2348,31 @@ async function ZD() {
|
|
|
2338
2348
|
let F = await E.go();
|
|
2339
2349
|
if (!F)
|
|
2340
2350
|
return;
|
|
2341
|
-
E.setUserDraw((
|
|
2342
|
-
|
|
2343
|
-
r.color = C,
|
|
2344
|
-
}),
|
|
2351
|
+
E.setUserDraw((e, t) => {
|
|
2352
|
+
t.setColor(C), B.forEach((r) => {
|
|
2353
|
+
r.color = C, t.drawCustomEntity(r);
|
|
2354
|
+
}), t.drawLine(F, e);
|
|
2345
2355
|
});
|
|
2346
2356
|
const A = () => {
|
|
2347
2357
|
E.setMessage(`
|
|
2348
2358
|
\u6307\u5B9A\u4E0B\u4E00\u4E2A\u70B9:`), B.length > 1 ? E.setKeyWords("[\u9000\u51FA(E)/\u95ED\u5408(C)/\u653E\u5F03(U)]") : E.setKeyWords("[\u9000\u51FA(E)/\u653E\u5F03(U)]");
|
|
2349
2359
|
};
|
|
2350
2360
|
A(), E.goWhile(
|
|
2351
|
-
(
|
|
2352
|
-
if (
|
|
2361
|
+
(e) => {
|
|
2362
|
+
if (e === T.kOk && (D = new Q(), v.use(D), D.pt1 = F, D.pt2 = E.value(), F = D.pt2.clone(), B.push(D), A()), e === T.kKeyWord) {
|
|
2353
2363
|
if (E.isKeyWordPicked("E"))
|
|
2354
2364
|
gD();
|
|
2355
2365
|
else if (E.isKeyWordPicked("C")) {
|
|
2356
|
-
const
|
|
2357
|
-
return
|
|
2366
|
+
const t = new Q();
|
|
2367
|
+
return t.pt1 = F.clone(), t.pt2 = B[0].pt1.clone(), v.use(t), B.push(t), F = t.pt2.clone(), gD(), { exit: !0 };
|
|
2358
2368
|
} else if (E.isKeyWordPicked("U")) {
|
|
2359
|
-
const
|
|
2360
|
-
|
|
2369
|
+
const t = B.pop();
|
|
2370
|
+
t && (F = t.pt1);
|
|
2361
2371
|
}
|
|
2362
2372
|
}
|
|
2363
2373
|
},
|
|
2364
|
-
(
|
|
2365
|
-
i.GetCurrentMxCAD().DrawEntity(new X(
|
|
2374
|
+
(e) => (e != T.kCancel && B.forEach((t) => {
|
|
2375
|
+
i.GetCurrentMxCAD().DrawEntity(new X(t.pt1.x, t.pt1.y, 0, t.pt2.x, t.pt2.y, 0));
|
|
2366
2376
|
}), { exit: !0 })
|
|
2367
2377
|
);
|
|
2368
2378
|
}
|
|
@@ -2419,10 +2429,10 @@ async function $D() {
|
|
|
2419
2429
|
},
|
|
2420
2430
|
(F) => {
|
|
2421
2431
|
if (F != T.kCancel) {
|
|
2422
|
-
let A = i.GetCurrentMxCAD(),
|
|
2423
|
-
for (let
|
|
2424
|
-
|
|
2425
|
-
A.DrawEntity(
|
|
2432
|
+
let A = i.GetCurrentMxCAD(), e = new CD();
|
|
2433
|
+
for (let t = 0; t < C.points.length; t++)
|
|
2434
|
+
e.addVertexAt(C.points[t]);
|
|
2435
|
+
A.DrawEntity(e);
|
|
2426
2436
|
}
|
|
2427
2437
|
}
|
|
2428
2438
|
);
|
|
@@ -2437,19 +2447,19 @@ async function JD() {
|
|
|
2437
2447
|
let D = await E.go(), C = new W();
|
|
2438
2448
|
C.setCenter(D.x, D.y, D.z);
|
|
2439
2449
|
let B = 5, F = i.GetCurrentDatabase().GetCurrentlyDrawColor();
|
|
2440
|
-
E.setUserDraw((A,
|
|
2441
|
-
|
|
2442
|
-
let
|
|
2450
|
+
E.setUserDraw((A, e) => {
|
|
2451
|
+
e.setColor(F), C.radius = D.distanceTo(A);
|
|
2452
|
+
let t = C.getEndParam().val, s = C.getDistAtParam(t).val / B, o = 0, u = new THREE.Vector3(), l = new THREE.Vector3();
|
|
2443
2453
|
for (let c = 0; c < B; c++) {
|
|
2444
2454
|
let n = C.getPointAtDist(o).val;
|
|
2445
|
-
o += s, c > 0 ?
|
|
2455
|
+
o += s, c > 0 ? e.drawMcDbLine(n.x, n.y, n.z, u.x, u.y, u.z) : l = new THREE.Vector3(n.x, n.y, n.z), c == B - 1 && e.drawMcDbLine(n.x, n.y, n.z, l.x, l.y, l.z), u = new THREE.Vector3(n.x, n.y, n.z);
|
|
2446
2456
|
}
|
|
2447
2457
|
}), E.setMessage(`
|
|
2448
2458
|
\u6307\u5B9A\u4E8C\u70B9:`), await E.go(), E.drawReserve();
|
|
2449
2459
|
}
|
|
2450
2460
|
h.addCommand("Mx_Polygon", JD);
|
|
2451
2461
|
function MC(E, D, C) {
|
|
2452
|
-
const B = E.x, F = D.x, A = C.x,
|
|
2462
|
+
const B = E.x, F = D.x, A = C.x, e = E.y, t = D.y, r = C.y, s = B - F, o = e - t, u = B - A, l = e - r, c = (B * B - F * F + (e * e - t * t)) / 2, n = (B * B - A * A + (e * e - r * r)) / 2, m = o * u - s * l, w = -(l * c - o * n) / m, b = -(s * n - u * c) / m;
|
|
2453
2463
|
return new THREE.Vector3(w, b, 0);
|
|
2454
2464
|
}
|
|
2455
2465
|
function PC(E, D) {
|
|
@@ -2463,10 +2473,10 @@ function TC(E, D, C) {
|
|
|
2463
2473
|
return E < D ? F = D - E : F = D - E + 360, F > B;
|
|
2464
2474
|
}
|
|
2465
2475
|
function sD(E, D, C) {
|
|
2466
|
-
const B = E.x, F = D.x, A = E.y,
|
|
2467
|
-
let
|
|
2468
|
-
return
|
|
2469
|
-
sin:
|
|
2476
|
+
const B = E.x, F = D.x, A = E.y, e = D.y;
|
|
2477
|
+
let t, r, s;
|
|
2478
|
+
return t = (A - e) / C, r = (B - F) / C, r >= 0.99999 && (r = 0.99999), r <= -0.99999 && (r = -0.99999), s = Math.acos(r), s = s / Math.PI * 180, t < -0.05 && (s = 360 - s), {
|
|
2479
|
+
sin: t,
|
|
2470
2480
|
cos: r,
|
|
2471
2481
|
angle: s
|
|
2472
2482
|
};
|
|
@@ -2483,20 +2493,20 @@ class yD extends PD {
|
|
|
2483
2493
|
}
|
|
2484
2494
|
getArcBulge(D, C, B) {
|
|
2485
2495
|
const F = D.distanceTo(C);
|
|
2486
|
-
let
|
|
2496
|
+
let t = 2 * new THREE.Line3(D, C).getCenter(
|
|
2487
2497
|
new THREE.Vector3()
|
|
2488
2498
|
).distanceTo(B) / F;
|
|
2489
|
-
return
|
|
2499
|
+
return t > 0.9999 && t < 1.0001 ? t = 1 : t < -0.9999 && t > -1.0001 ? t = -1 : Math.abs(t) < 1e-10 && (t = 0), t;
|
|
2490
2500
|
}
|
|
2491
2501
|
getArcMidPoint(D, C, B, F, A) {
|
|
2492
|
-
const
|
|
2502
|
+
const e = D, t = B * Math.PI / 180;
|
|
2493
2503
|
let r = F * Math.PI / 180;
|
|
2494
2504
|
const s = new THREE.Vector3(), o = new THREE.Vector3();
|
|
2495
|
-
s.x =
|
|
2505
|
+
s.x = e.x + C * Math.cos(t), s.y = e.y + C * Math.sin(t), o.x = e.x + C * Math.cos(r), o.y = e.y + C * Math.sin(r);
|
|
2496
2506
|
const u = C;
|
|
2497
2507
|
(A ? B < F : B > F) && (r += Math.PI * 2);
|
|
2498
2508
|
const l = new THREE.Vector3();
|
|
2499
|
-
return l.x =
|
|
2509
|
+
return l.x = e.x + u * Math.cos((t + r) / 2), l.y = e.y + u * Math.sin((t + r) / 2), [s, l, o, this.center];
|
|
2500
2510
|
}
|
|
2501
2511
|
getGripPoints() {
|
|
2502
2512
|
return this.getArcMidPoint(
|
|
@@ -2515,14 +2525,14 @@ class yD extends PD {
|
|
|
2515
2525
|
}
|
|
2516
2526
|
upDatePoints(D, C, B) {
|
|
2517
2527
|
D[C].add(B);
|
|
2518
|
-
const [F, A,
|
|
2519
|
-
this.center = MC(F,
|
|
2520
|
-
const
|
|
2528
|
+
const [F, A, e] = D;
|
|
2529
|
+
this.center = MC(F, e, A), this.radius = PC(A, this.center);
|
|
2530
|
+
const t = sD(F, this.center, this.radius), r = sD(e, this.center, this.radius), s = sD(A, this.center, this.radius);
|
|
2521
2531
|
this.clockwise = TC(
|
|
2522
2532
|
r.angle,
|
|
2523
|
-
|
|
2533
|
+
t.angle,
|
|
2524
2534
|
s.angle
|
|
2525
|
-
), this.startAngle = THREE.MathUtils.degToRad(
|
|
2535
|
+
), this.startAngle = THREE.MathUtils.degToRad(t.angle), this.endAngle = THREE.MathUtils.degToRad(r.angle);
|
|
2526
2536
|
}
|
|
2527
2537
|
}
|
|
2528
2538
|
async function YD() {
|
|
@@ -2533,7 +2543,7 @@ async function YD() {
|
|
|
2533
2543
|
let C = new yD();
|
|
2534
2544
|
C.closed = !1, v.use(C);
|
|
2535
2545
|
let B, F, A;
|
|
2536
|
-
const
|
|
2546
|
+
const e = S(
|
|
2537
2547
|
D,
|
|
2538
2548
|
() => {
|
|
2539
2549
|
B = D.value(), D.setMessage(`
|
|
@@ -2550,13 +2560,13 @@ async function YD() {
|
|
|
2550
2560
|
return !0;
|
|
2551
2561
|
}
|
|
2552
2562
|
);
|
|
2553
|
-
let
|
|
2563
|
+
let t;
|
|
2554
2564
|
const r = S(
|
|
2555
2565
|
D,
|
|
2556
2566
|
() => {
|
|
2557
|
-
|
|
2567
|
+
t = D.value(), A = new Y(), A.closed = !1, v.use(A), A.color = E, A.center = t, C.center = t, D.setMessage(`
|
|
2558
2568
|
\u6307\u5B9A\u5706\u5F27\u7684\u8D77\u70B9:`), D.setUserDraw((p, d) => {
|
|
2559
|
-
d.drawCustomEntity(A), d.setColor(E), d.drawLine(
|
|
2569
|
+
d.drawCustomEntity(A), d.setColor(E), d.drawLine(t, p);
|
|
2560
2570
|
}), u();
|
|
2561
2571
|
},
|
|
2562
2572
|
() => {
|
|
@@ -2649,13 +2659,13 @@ async function YD() {
|
|
|
2649
2659
|
return !0;
|
|
2650
2660
|
}
|
|
2651
2661
|
);
|
|
2652
|
-
|
|
2662
|
+
e();
|
|
2653
2663
|
}
|
|
2654
2664
|
h.on("init", () => {
|
|
2655
2665
|
h.addCommand("Mx_Arc", YD);
|
|
2656
2666
|
});
|
|
2657
2667
|
function QD() {
|
|
2658
|
-
const E = new O(), D = new
|
|
2668
|
+
const E = new O(), D = new eC();
|
|
2659
2669
|
D.closed = !1, v.use(D), E.setMessage(`
|
|
2660
2670
|
\u6307\u5B9A\u692D\u5706\u7684\u8F74\u7AEF\u70B9`), E.setKeyWords("[\u4E2D\u5FC3\u70B9(C)]");
|
|
2661
2671
|
let C, B = new THREE.Vector3();
|
|
@@ -2677,21 +2687,21 @@ function QD() {
|
|
|
2677
2687
|
E.setUserDraw((s, o) => {
|
|
2678
2688
|
D.yRadius = B.distanceTo(s), o.drawLine(B, s), o.drawCustomEntity(D);
|
|
2679
2689
|
}), E.setMessage(`
|
|
2680
|
-
\u6307\u5B9A\u53E6\u4E00\u6761\u534A\u8F74\u957F\u5EA6`), E.setKeyWords(""),
|
|
2690
|
+
\u6307\u5B9A\u53E6\u4E00\u6761\u534A\u8F74\u957F\u5EA6`), E.setKeyWords(""), e();
|
|
2681
2691
|
},
|
|
2682
2692
|
() => {
|
|
2683
2693
|
}
|
|
2684
|
-
),
|
|
2694
|
+
), e = S(
|
|
2685
2695
|
E,
|
|
2686
2696
|
() => {
|
|
2687
2697
|
E.setMessage(`
|
|
2688
2698
|
\u6307\u5B9A\u8D77\u59CB\u89D2\u5EA6`), E.setKeyWords(""), E.setUserDraw((s, o) => {
|
|
2689
2699
|
D.startAngle = rD(s.x, s.y, B.x, B.y) - D.rotation, o.drawLine(B, s), o.drawCustomEntity(D);
|
|
2690
|
-
}),
|
|
2700
|
+
}), t();
|
|
2691
2701
|
},
|
|
2692
2702
|
() => {
|
|
2693
2703
|
}
|
|
2694
|
-
),
|
|
2704
|
+
), t = S(
|
|
2695
2705
|
E,
|
|
2696
2706
|
() => {
|
|
2697
2707
|
E.setUserDraw((s, o) => {
|
|
@@ -2712,7 +2722,7 @@ function QD() {
|
|
|
2712
2722
|
);
|
|
2713
2723
|
}
|
|
2714
2724
|
function kC() {
|
|
2715
|
-
const E = new O(), D = new
|
|
2725
|
+
const E = new O(), D = new tC(), C = new iC();
|
|
2716
2726
|
let B = i.GetCurrentDatabase().GetCurrentlyDrawColor();
|
|
2717
2727
|
C.setColor(B), E.setMessage(`
|
|
2718
2728
|
\u70B9\u51FB\u5F00\u59CB\u7ED8\u5236\u692D\u5706:`), E.go(() => {
|
|
@@ -2741,7 +2751,7 @@ async function XD() {
|
|
|
2741
2751
|
C.erase();
|
|
2742
2752
|
});
|
|
2743
2753
|
}
|
|
2744
|
-
function
|
|
2754
|
+
function tD(E) {
|
|
2745
2755
|
let D, C;
|
|
2746
2756
|
if (E.forEach((B) => {
|
|
2747
2757
|
let F = B.getMcDbEntity();
|
|
@@ -2755,73 +2765,73 @@ function eD(E) {
|
|
|
2755
2765
|
async function RC() {
|
|
2756
2766
|
let E;
|
|
2757
2767
|
for (; E = U.getCurrentSelect(), !(E.length > 0); ) {
|
|
2758
|
-
let
|
|
2759
|
-
if (!await
|
|
2760
|
-
\u9009\u62E9\u590D\u5236\u5BF9\u8C61`) || (E =
|
|
2768
|
+
let e = new Z();
|
|
2769
|
+
if (!await e.userSelect(`
|
|
2770
|
+
\u9009\u62E9\u590D\u5236\u5BF9\u8C61`) || (E = e.getIds(), E.length == 0))
|
|
2761
2771
|
return;
|
|
2762
2772
|
break;
|
|
2763
2773
|
}
|
|
2764
2774
|
let D, C;
|
|
2765
2775
|
if (E.length >= 10) {
|
|
2766
|
-
let
|
|
2767
|
-
|
|
2776
|
+
let e = tD(E);
|
|
2777
|
+
e && (D = e.minPt, C = e.maxPt);
|
|
2768
2778
|
}
|
|
2769
2779
|
let B = new z();
|
|
2770
2780
|
B.setMessage("\u6307\u5B9A\u57FA\u70B9");
|
|
2771
2781
|
let F = await B.go();
|
|
2772
2782
|
if (!F)
|
|
2773
2783
|
return;
|
|
2774
|
-
B.setMessage("\u6307\u5B9A\u79FB\u52A8\u5230\u70B9"), B.setBasePt(F), B.setUseBasePt(!0), B.setUserDraw((
|
|
2784
|
+
B.setMessage("\u6307\u5B9A\u79FB\u52A8\u5230\u70B9"), B.setBasePt(F), B.setUseBasePt(!0), B.setUserDraw((e, t) => {
|
|
2775
2785
|
if (D && C) {
|
|
2776
|
-
let r =
|
|
2777
|
-
|
|
2786
|
+
let r = e.x - F.x, s = e.y - F.y, o = new THREE.Vector3(D.x + r, C.y + s, 0), u = new THREE.Vector3(C.x + r, D.y + s, 0), l = new THREE.Vector3(o.x, u.y, 0), c = new THREE.Vector3(u.x, o.y, 0);
|
|
2787
|
+
t.drawLine(c, o), t.drawLine(o, l), t.drawLine(l, u), t.drawLine(u, c);
|
|
2778
2788
|
}
|
|
2779
2789
|
for (let r = 0; r < E.length && r < 10; r++) {
|
|
2780
2790
|
let s = E[r].clone();
|
|
2781
|
-
!s || (s.Move(F,
|
|
2791
|
+
!s || (s.Move(F, e), t.drawMcDbEntity(s));
|
|
2782
2792
|
}
|
|
2783
2793
|
});
|
|
2784
2794
|
let A = await B.go();
|
|
2785
2795
|
if (!!A)
|
|
2786
|
-
for (let
|
|
2787
|
-
let
|
|
2788
|
-
!
|
|
2796
|
+
for (let e = 0; e < E.length; e++) {
|
|
2797
|
+
let t = E[e].clone();
|
|
2798
|
+
!t || (t.Move(F, A), i.GetCurrentMxCAD().DrawEntity(t));
|
|
2789
2799
|
}
|
|
2790
2800
|
}
|
|
2791
2801
|
async function OC() {
|
|
2792
2802
|
let E;
|
|
2793
2803
|
for (; E = U.getCurrentSelect(), !(E.length > 0); ) {
|
|
2794
|
-
let
|
|
2795
|
-
if (!await
|
|
2796
|
-
\u9009\u62E9\u79FB\u52A8\u5BF9\u8C61`) || (E =
|
|
2804
|
+
let e = new Z();
|
|
2805
|
+
if (!await e.userSelect(`
|
|
2806
|
+
\u9009\u62E9\u79FB\u52A8\u5BF9\u8C61`) || (E = e.getIds(), E.length == 0))
|
|
2797
2807
|
return;
|
|
2798
2808
|
break;
|
|
2799
2809
|
}
|
|
2800
2810
|
let D, C;
|
|
2801
2811
|
if (E.length >= 10) {
|
|
2802
|
-
let
|
|
2803
|
-
|
|
2812
|
+
let e = tD(E);
|
|
2813
|
+
e && (D = e.minPt, C = e.maxPt);
|
|
2804
2814
|
}
|
|
2805
2815
|
let B = new z();
|
|
2806
2816
|
B.setMessage("\u6307\u5B9A\u57FA\u70B9");
|
|
2807
2817
|
let F = await B.go();
|
|
2808
2818
|
if (!F)
|
|
2809
2819
|
return;
|
|
2810
|
-
B.setMessage("\u6307\u5B9A\u79FB\u52A8\u5230\u70B9"), B.setBasePt(F), B.setUseBasePt(!0), B.setUserDraw((
|
|
2820
|
+
B.setMessage("\u6307\u5B9A\u79FB\u52A8\u5230\u70B9"), B.setBasePt(F), B.setUseBasePt(!0), B.setUserDraw((e, t) => {
|
|
2811
2821
|
if (D && C) {
|
|
2812
|
-
let r =
|
|
2813
|
-
|
|
2822
|
+
let r = e.x - F.x, s = e.y - F.y, o = new THREE.Vector3(D.x + r, C.y + s, 0), u = new THREE.Vector3(C.x + r, D.y + s, 0), l = new THREE.Vector3(o.x, u.y, 0), c = new THREE.Vector3(u.x, o.y, 0);
|
|
2823
|
+
t.drawLine(c, o), t.drawLine(o, l), t.drawLine(l, u), t.drawLine(u, c);
|
|
2814
2824
|
}
|
|
2815
2825
|
for (let r = 0; r < E.length && r < 10; r++) {
|
|
2816
2826
|
let s = E[r].clone();
|
|
2817
|
-
!s || (s.Move(F,
|
|
2827
|
+
!s || (s.Move(F, e), t.drawMcDbEntity(s));
|
|
2818
2828
|
}
|
|
2819
2829
|
});
|
|
2820
2830
|
let A = await B.go();
|
|
2821
2831
|
if (!!A)
|
|
2822
|
-
for (let
|
|
2823
|
-
let
|
|
2824
|
-
!
|
|
2832
|
+
for (let e = 0; e < E.length; e++) {
|
|
2833
|
+
let t = E[e].getMcDbObject();
|
|
2834
|
+
!t || t.Move(F, A);
|
|
2825
2835
|
}
|
|
2826
2836
|
}
|
|
2827
2837
|
async function SC() {
|
|
@@ -2833,7 +2843,7 @@ async function SC() {
|
|
|
2833
2843
|
return;
|
|
2834
2844
|
break;
|
|
2835
2845
|
}
|
|
2836
|
-
let D, C, B =
|
|
2846
|
+
let D, C, B = tD(E);
|
|
2837
2847
|
B && (D = B.minPt, C = B.maxPt);
|
|
2838
2848
|
let F = new z();
|
|
2839
2849
|
F.setMessage("\u6307\u5B9A\u57FA\u70B9");
|
|
@@ -2852,10 +2862,10 @@ async function SC() {
|
|
|
2852
2862
|
!x || (x.TransformBy(p), c.drawMcDbEntity(x));
|
|
2853
2863
|
}
|
|
2854
2864
|
});
|
|
2855
|
-
let
|
|
2856
|
-
if (!
|
|
2865
|
+
let e = await F.go();
|
|
2866
|
+
if (!e)
|
|
2857
2867
|
return;
|
|
2858
|
-
let
|
|
2868
|
+
let t = e, r = A, o = t.sub(r).angleTo2(y.kXAxis, y.kNegateZAxis), u = new I();
|
|
2859
2869
|
r = i.GetCurrentMxCAD().docCoord2Cad(r), u.setToRotation(o, y.kZAxis, r);
|
|
2860
2870
|
for (let l = 0; l < E.length; l++) {
|
|
2861
2871
|
let c = E[l].getMcDbObject();
|
|
@@ -2871,22 +2881,22 @@ async function LC() {
|
|
|
2871
2881
|
return;
|
|
2872
2882
|
break;
|
|
2873
2883
|
}
|
|
2874
|
-
let D, C, B =
|
|
2884
|
+
let D, C, B = tD(E);
|
|
2875
2885
|
if (!B)
|
|
2876
2886
|
return;
|
|
2877
2887
|
D = B.minPt, C = B.maxPt;
|
|
2878
|
-
let F = C.x - D.x, A = C.y - D.y,
|
|
2879
|
-
|
|
2880
|
-
let
|
|
2881
|
-
|
|
2882
|
-
let r = await
|
|
2888
|
+
let F = C.x - D.x, A = C.y - D.y, e = (F + A) / 3;
|
|
2889
|
+
e < 1e-5 && (e = 1);
|
|
2890
|
+
let t = new z();
|
|
2891
|
+
t.setMessage("\u6307\u5B9A\u57FA\u70B9");
|
|
2892
|
+
let r = await t.go();
|
|
2883
2893
|
if (r == null)
|
|
2884
2894
|
return;
|
|
2885
|
-
|
|
2895
|
+
t.setMessage("\u6307\u5B9A\u6BD4\u4F8B\u56E0\u5B50"), t.setBasePt(r), t.setUseBasePt(!0), t.setUserDraw((m, w) => {
|
|
2886
2896
|
let b = new a(m), p = new a(r), d = b.distanceTo(p);
|
|
2887
2897
|
if (d < 1e-5)
|
|
2888
2898
|
return;
|
|
2889
|
-
let x = d /
|
|
2899
|
+
let x = d / e;
|
|
2890
2900
|
x > 1e5 && (x = 1e5);
|
|
2891
2901
|
let f = new I();
|
|
2892
2902
|
if (f.setToScaling(x, p), D && C) {
|
|
@@ -2899,13 +2909,13 @@ async function LC() {
|
|
|
2899
2909
|
!M || (M.TransformBy(f), w.drawMcDbEntity(M));
|
|
2900
2910
|
}
|
|
2901
2911
|
});
|
|
2902
|
-
let s = await
|
|
2912
|
+
let s = await t.go();
|
|
2903
2913
|
if (!s)
|
|
2904
2914
|
return;
|
|
2905
2915
|
let o = s, u = r, l = o.distanceTo(u);
|
|
2906
2916
|
if (l < 1e-5)
|
|
2907
2917
|
return;
|
|
2908
|
-
let c = l /
|
|
2918
|
+
let c = l / e;
|
|
2909
2919
|
c > 1e5 && (c = 1e5);
|
|
2910
2920
|
let n = new I();
|
|
2911
2921
|
u = i.GetCurrentMxCAD().docCoord2Cad(u), n.setToScaling(c, u);
|
|
@@ -2949,27 +2959,30 @@ async function jC() {
|
|
|
2949
2959
|
let A = await F.go();
|
|
2950
2960
|
if (A == null)
|
|
2951
2961
|
return;
|
|
2952
|
-
let
|
|
2953
|
-
if (!
|
|
2962
|
+
let e = B[0].getMcDbCurve();
|
|
2963
|
+
if (!e)
|
|
2954
2964
|
return;
|
|
2955
|
-
let
|
|
2956
|
-
|
|
2965
|
+
let t = e.offsetCurves(D, A);
|
|
2966
|
+
t.empty() || t.forEach((r) => {
|
|
2957
2967
|
i.GetCurrentMxCAD().DrawEntity(r);
|
|
2958
2968
|
});
|
|
2959
2969
|
}
|
|
2970
|
+
function GC() {
|
|
2971
|
+
i.GetCurrentMxCAD().getImp().regen();
|
|
2972
|
+
}
|
|
2960
2973
|
h.on("init", () => {
|
|
2961
|
-
h.addCommand("Mx_Erase", XD), h.addCommand("Mx_Copy", RC), h.addCommand("Mx_Move", OC), h.addCommand("Mx_Rotate", SC), h.addCommand("Mx_Scale", LC), h.addCommand("Mx_WindowZoom", vC), h.addCommand("Mx_ZoomE", IC), h.addCommand("Mx_Offset", jC);
|
|
2974
|
+
h.addCommand("Mx_Erase", XD), h.addCommand("Mx_Copy", RC), h.addCommand("Mx_Move", OC), h.addCommand("Mx_Rotate", SC), h.addCommand("Mx_Scale", LC), h.addCommand("Mx_WindowZoom", vC), h.addCommand("Mx_ZoomE", IC), h.addCommand("Mx_Offset", jC), h.addCommand("Mx_Regen", GC);
|
|
2962
2975
|
});
|
|
2963
|
-
const
|
|
2976
|
+
const WC = async (E, D, C) => {
|
|
2964
2977
|
const { locateFile: B } = C, F = B(E + ".js");
|
|
2965
2978
|
return await ND(F), await globalThis[D](C);
|
|
2966
2979
|
};
|
|
2967
|
-
function
|
|
2980
|
+
function VC(E) {
|
|
2968
2981
|
return typeof ResizeObserver == "function" ? new ResizeObserver(E) : null;
|
|
2969
2982
|
}
|
|
2970
|
-
function
|
|
2983
|
+
function UC(E, D) {
|
|
2971
2984
|
const C = () => requestAnimationFrame(D);
|
|
2972
|
-
let B =
|
|
2985
|
+
let B = VC(C);
|
|
2973
2986
|
if (B) {
|
|
2974
2987
|
B.observe(E);
|
|
2975
2988
|
return;
|
|
@@ -2979,7 +2992,7 @@ function VC(E, D) {
|
|
|
2979
2992
|
return;
|
|
2980
2993
|
}
|
|
2981
2994
|
}
|
|
2982
|
-
function
|
|
2995
|
+
function zC(E, D) {
|
|
2983
2996
|
let C = null;
|
|
2984
2997
|
return function(...B) {
|
|
2985
2998
|
C || (C = setTimeout(() => {
|
|
@@ -2994,14 +3007,14 @@ class q {
|
|
|
2994
3007
|
const C = () => {
|
|
2995
3008
|
const u = this.canvas.parentElement?.clientWidth || window.innerWidth, l = this.canvas.parentElement?.clientHeight || window.innerHeight;
|
|
2996
3009
|
let c = Math.min(u, window.screen.availWidth), n = Math.min(l, window.screen.availHeight);
|
|
2997
|
-
c = Math.max(A, c), n = Math.max(
|
|
3010
|
+
c = Math.max(A, c), n = Math.max(e, n), this.canvas.style.width = c + 1 + "px", this.canvas.style.height = n + "px";
|
|
2998
3011
|
const m = window.devicePixelRatio || 1;
|
|
2999
3012
|
this.canvas.width = c * m, this.canvas.height = n * m;
|
|
3000
|
-
}, B =
|
|
3013
|
+
}, B = zC(C, 50), {
|
|
3001
3014
|
canvas: F,
|
|
3002
3015
|
minWidth: A = 300,
|
|
3003
|
-
minHeight:
|
|
3004
|
-
updateCanvasSize:
|
|
3016
|
+
minHeight: e = 300,
|
|
3017
|
+
updateCanvasSize: t = B,
|
|
3005
3018
|
...r
|
|
3006
3019
|
} = D;
|
|
3007
3020
|
let s = typeof F == "string" ? document.querySelectorAll(F)[0] : F, o = s.getContext("webgl2", { alpha: !1, depth: !0, antialias: !1, preserveDrawingBuffer: !0 });
|
|
@@ -3010,11 +3023,11 @@ class q {
|
|
|
3010
3023
|
this[u] = r[u];
|
|
3011
3024
|
if (this.canvas instanceof HTMLCanvasElement) {
|
|
3012
3025
|
const u = this.canvas.parentElement || document.body;
|
|
3013
|
-
|
|
3026
|
+
UC(u, t);
|
|
3014
3027
|
} else
|
|
3015
3028
|
console.error("createMxDraw3d canvas \u53C2\u6570\u4E0D\u6B63\u786E \u65E0\u6CD5\u83B7\u53D6\u5230canvas\u5143\u7D20");
|
|
3016
|
-
window.onresize = C, C(),
|
|
3017
|
-
q.onloadWasmMxDraw3dModel && q.onloadWasmMxDraw3dModel(this), this.updateCanvasSize =
|
|
3029
|
+
window.onresize = C, C(), WC("mxdraw3d_min", "mxdraw3d", this).then(() => {
|
|
3030
|
+
q.onloadWasmMxDraw3dModel && q.onloadWasmMxDraw3dModel(this), this.updateCanvasSize = t, this.open3DFile = (u) => {
|
|
3018
3031
|
const l = new FileReader();
|
|
3019
3032
|
l.onload = () => {
|
|
3020
3033
|
if (!!l.result && l.result instanceof ArrayBuffer) {
|
|
@@ -3027,7 +3040,7 @@ class q {
|
|
|
3027
3040
|
});
|
|
3028
3041
|
}
|
|
3029
3042
|
}
|
|
3030
|
-
function
|
|
3043
|
+
function KC(E, D) {
|
|
3031
3044
|
return new Promise(async (C, B) => {
|
|
3032
3045
|
try {
|
|
3033
3046
|
E.locateFile || (E.locateFile = pC);
|
|
@@ -3040,7 +3053,7 @@ function zC(E, D) {
|
|
|
3040
3053
|
}
|
|
3041
3054
|
});
|
|
3042
3055
|
}
|
|
3043
|
-
const
|
|
3056
|
+
const NC = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3044
3057
|
__proto__: null,
|
|
3045
3058
|
b64Encode: TD,
|
|
3046
3059
|
b64Decode: kD,
|
|
@@ -3111,7 +3124,7 @@ const HC = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
3111
3124
|
drawEllipticalArc: QD,
|
|
3112
3125
|
Mx_Erase: XD,
|
|
3113
3126
|
MxDraw3d: q,
|
|
3114
|
-
loadMxCADassembly3d:
|
|
3127
|
+
loadMxCADassembly3d: KC
|
|
3115
3128
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3116
3129
|
export {
|
|
3117
3130
|
KD as McAppType,
|
|
@@ -3166,7 +3179,7 @@ export {
|
|
|
3166
3179
|
kD as b64Decode,
|
|
3167
3180
|
TD as b64Encode,
|
|
3168
3181
|
wC as createMxCad,
|
|
3169
|
-
|
|
3182
|
+
NC as default,
|
|
3170
3183
|
OD as downloadFile,
|
|
3171
3184
|
SD as downloadFileFromUrl,
|
|
3172
3185
|
YD as drawArc,
|
|
@@ -3179,6 +3192,6 @@ export {
|
|
|
3179
3192
|
gC as drawText,
|
|
3180
3193
|
N as getFilterImp,
|
|
3181
3194
|
_D as loadMxCADassembly,
|
|
3182
|
-
|
|
3195
|
+
KC as loadMxCADassembly3d,
|
|
3183
3196
|
RD as saveAsFileDialog
|
|
3184
3197
|
};
|