mxcad 1.0.157 → 1.0.158
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 +5 -1
- package/dist/mxcad.es.js +94 -9
- package/dist/mxcad.umd.js +2 -2
- package/dist/wasm/2d/mxdrawassembly_min.js +1117 -1114
- package/dist/wasm/2d/mxdrawassembly_min.wasm +0 -0
- package/dist/wasm/2d-st/mxdrawassembly_min.js +1105 -1102
- package/dist/wasm/2d-st/mxdrawassembly_minst.wasm +0 -0
- package/package.json +1 -1
package/dist/mxcad.d.ts
CHANGED
|
@@ -25,6 +25,8 @@ export declare const getJsonFromUrl: (url: string) => Promise<any>;
|
|
|
25
25
|
export declare const getFileFromUrl: (url: string) => Promise<Response | undefined>;
|
|
26
26
|
export declare function _ML_String(strId: string, str: string): string;
|
|
27
27
|
export declare function IsZero(val: number): boolean;
|
|
28
|
+
export declare function postMemoryFile(memoryData: any, url: string, filename: string, retCall: (code: number, message: string) => void, param?: any): void;
|
|
29
|
+
export declare function postEmscriptenIndexedDBFile(filekey: string, url: string, retCall: (code: number, message: string) => void, param?: any): void;
|
|
28
30
|
export declare const MxTools: {
|
|
29
31
|
b64Encode: typeof b64Encode;
|
|
30
32
|
b64Decode: typeof b64Decode;
|
|
@@ -35,6 +37,8 @@ export declare const MxTools: {
|
|
|
35
37
|
getFileFromUrl: (url: string) => Promise<Response | undefined>;
|
|
36
38
|
_ML_String: typeof _ML_String;
|
|
37
39
|
IsZero: typeof IsZero;
|
|
40
|
+
postEmscriptenIndexedDBFile: typeof postEmscriptenIndexedDBFile;
|
|
41
|
+
postMemoryFile: typeof postMemoryFile;
|
|
38
42
|
};
|
|
39
43
|
/**
|
|
40
44
|
* 表示一个 Rx 对象的基类。
|
|
@@ -2970,7 +2974,7 @@ export declare class McObject {
|
|
|
2970
2974
|
* })
|
|
2971
2975
|
* ```
|
|
2972
2976
|
*/
|
|
2973
|
-
saveFileToUrl(sSaveProgramUrl: string, call: (iResult: number, sServerResult: string) => void): boolean;
|
|
2977
|
+
saveFileToUrl(sSaveProgramUrl: string, call: (iResult: number, sServerResult: string) => void, filename?: string, param?: any): boolean;
|
|
2974
2978
|
/**
|
|
2975
2979
|
* 保存文件
|
|
2976
2980
|
* @param filename 另存为的新文件名称
|
package/dist/mxcad.es.js
CHANGED
|
@@ -582,6 +582,77 @@ function _ML_String(strId, str) {
|
|
|
582
582
|
function IsZero(val) {
|
|
583
583
|
return Math.abs(val) < 1e-7;
|
|
584
584
|
}
|
|
585
|
+
function postMemoryFile(memoryData, url, filename, retCall, param) {
|
|
586
|
+
try {
|
|
587
|
+
var formData = new FormData();
|
|
588
|
+
var blob = new Blob([memoryData], {
|
|
589
|
+
type: "application/octet-stream"
|
|
590
|
+
});
|
|
591
|
+
formData.append("file", new File([blob], filename));
|
|
592
|
+
if (param) formData.append("param", param);
|
|
593
|
+
var xhr = new XMLHttpRequest();
|
|
594
|
+
xhr.open("POST", url);
|
|
595
|
+
xhr.send(formData);
|
|
596
|
+
xhr.onreadystatechange = function () {
|
|
597
|
+
if (xhr.readyState === XMLHttpRequest.DONE) {
|
|
598
|
+
if (xhr.status === 200) {
|
|
599
|
+
retCall(0, xhr.responseText);
|
|
600
|
+
} else {
|
|
601
|
+
console.log(xhr.responseText);
|
|
602
|
+
retCall(4, "server error");
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
};
|
|
606
|
+
} catch (error) {
|
|
607
|
+
retCall(-1, "catch error");
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
function postEmscriptenIndexedDBFile(filekey, url, retCall, param) {
|
|
611
|
+
var request = window.indexedDB.open("emscripten_filesystem", 1);
|
|
612
|
+
request.onerror = function () {
|
|
613
|
+
retCall(1, "open emscripten_filesystem failed");
|
|
614
|
+
};
|
|
615
|
+
request.onsuccess = function (event) {
|
|
616
|
+
try {
|
|
617
|
+
if (event.target != null) {
|
|
618
|
+
var db = event.target.result;
|
|
619
|
+
var transaction = db.transaction("FILES", "readonly");
|
|
620
|
+
var objectStore = transaction.objectStore("FILES");
|
|
621
|
+
var request2 = objectStore.get(filekey);
|
|
622
|
+
request2.onerror = function () {
|
|
623
|
+
retCall(3, "get file error");
|
|
624
|
+
};
|
|
625
|
+
request2.onsuccess = function () {
|
|
626
|
+
var file = request2.result;
|
|
627
|
+
if (file) {
|
|
628
|
+
var formData = new FormData();
|
|
629
|
+
formData.append("file", file);
|
|
630
|
+
if (param) formData.append("param", param);
|
|
631
|
+
var xhr = new XMLHttpRequest();
|
|
632
|
+
xhr.open("POST", url);
|
|
633
|
+
xhr.send(formData);
|
|
634
|
+
xhr.onreadystatechange = function () {
|
|
635
|
+
if (xhr.readyState === XMLHttpRequest.DONE) {
|
|
636
|
+
if (xhr.status === 200) {
|
|
637
|
+
retCall(0, xhr.responseText);
|
|
638
|
+
} else {
|
|
639
|
+
console.log(xhr.responseText);
|
|
640
|
+
retCall(4, "server error");
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
};
|
|
644
|
+
} else {
|
|
645
|
+
retCall(5, "get file data error");
|
|
646
|
+
}
|
|
647
|
+
};
|
|
648
|
+
} else {
|
|
649
|
+
retCall(2, "event.target == null");
|
|
650
|
+
}
|
|
651
|
+
} catch (error) {
|
|
652
|
+
retCall(-1, "catch error");
|
|
653
|
+
}
|
|
654
|
+
};
|
|
655
|
+
}
|
|
585
656
|
var MxTools = {
|
|
586
657
|
b64Encode: b64Encode,
|
|
587
658
|
b64Decode: b64Decode,
|
|
@@ -591,7 +662,9 @@ var MxTools = {
|
|
|
591
662
|
getJsonFromUrl: getJsonFromUrl,
|
|
592
663
|
getFileFromUrl: getFileFromUrl,
|
|
593
664
|
_ML_String: _ML_String,
|
|
594
|
-
IsZero: IsZero
|
|
665
|
+
IsZero: IsZero,
|
|
666
|
+
postEmscriptenIndexedDBFile: postEmscriptenIndexedDBFile,
|
|
667
|
+
postMemoryFile: postMemoryFile
|
|
595
668
|
};
|
|
596
669
|
|
|
597
670
|
function _classCallCheck(instance, Constructor) {
|
|
@@ -14065,7 +14138,7 @@ var MxG2312 = /*#__PURE__*/function () {
|
|
|
14065
14138
|
}();
|
|
14066
14139
|
var MxG2312Obj = new MxG2312();
|
|
14067
14140
|
|
|
14068
|
-
const version$1 = "1.0.
|
|
14141
|
+
const version$1 = "1.0.158";
|
|
14069
14142
|
|
|
14070
14143
|
var isSharedArrayBuffer = ("SharedArrayBuffer" in window);
|
|
14071
14144
|
var isCdn = document.currentScript && /unpkg\.com\/mxcad/.test(document.currentScript.src);
|
|
@@ -18640,12 +18713,22 @@ var McObject = /*#__PURE__*/function () {
|
|
|
18640
18713
|
}
|
|
18641
18714
|
}, {
|
|
18642
18715
|
key: "saveFileToUrl",
|
|
18643
|
-
value: function saveFileToUrl(sSaveProgramUrl, call) {
|
|
18644
|
-
var
|
|
18645
|
-
|
|
18646
|
-
call(
|
|
18647
|
-
|
|
18648
|
-
|
|
18716
|
+
value: function saveFileToUrl(sSaveProgramUrl, call, filename, param) {
|
|
18717
|
+
var mxmemory = this.imp.saveFileToMemory();
|
|
18718
|
+
if (mxmemory.getSize() == 0) {
|
|
18719
|
+
call(-1, "save failed");
|
|
18720
|
+
return false;
|
|
18721
|
+
}
|
|
18722
|
+
var dataptr = mxmemory.getData();
|
|
18723
|
+
var size = mxmemory.getSize();
|
|
18724
|
+
var wasmMemoryHEAPU8 = MxCpp.mxcadassemblyimp.HEAPU8;
|
|
18725
|
+
var binaryData = wasmMemoryHEAPU8.subarray(dataptr, dataptr + size);
|
|
18726
|
+
var arrayBuffer = new ArrayBuffer(mxmemory.getSize());
|
|
18727
|
+
var arrayBufferView = new Uint8Array(arrayBuffer);
|
|
18728
|
+
arrayBufferView.set(binaryData);
|
|
18729
|
+
mxmemory.clear();
|
|
18730
|
+
MxTools.postMemoryFile(arrayBufferView, sSaveProgramUrl, filename || "temp.mxweb", call, param);
|
|
18731
|
+
return true;
|
|
18649
18732
|
}
|
|
18650
18733
|
}, {
|
|
18651
18734
|
key: "saveFile",
|
|
@@ -38899,6 +38982,8 @@ const mxcad = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
|
38899
38982
|
getFileFromUrl,
|
|
38900
38983
|
_ML_String,
|
|
38901
38984
|
IsZero,
|
|
38985
|
+
postMemoryFile,
|
|
38986
|
+
postEmscriptenIndexedDBFile,
|
|
38902
38987
|
MxTools,
|
|
38903
38988
|
McGePoint3d,
|
|
38904
38989
|
McGeVector3d,
|
|
@@ -39080,4 +39165,4 @@ const mxcad = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
|
39080
39165
|
loadMxCADassembly3d
|
|
39081
39166
|
}, Symbol.toStringTag, { value: 'Module' }));
|
|
39082
39167
|
|
|
39083
|
-
export { Color, ColorIndexType, ColorMethod, FetchAttributes, IsZero, McAppType, McCmColor, McDb, McDbAlignedDimension, McDbArc, McDbAttribute, McDbAttributeDefinition, McDbBlockReference, McDbBlockTable, McDbBlockTableRecord, McDbCircle, McDbCurve, McDbDatabase, McDbDimension, McDbEllipse, McDbEntity, McDbHatch, McDbLayerTable, McDbLayerTableRecord, McDbLine, McDbLinetypeTable, McDbLinetypeTableRecord, McDbMText, McDbObject, McDbObjectArray, McDbPoint, McDbPolyline, McDbProxyEntity, McDbRasterImage, McDbRasterImageDef, McDbRotatedDimension, McDbText, McDbTextStyleTable, McDbTextStyleTableRecord, McGeLongArray, McGeMatrix3d, McGePoint3d, McGePoint3dArray, McGeStringArray, McGeVector3d, McObject, McObjectId, McObjectIdType, McRxObject, MdGe, MdGeAngleDim, MdGeApplication, MdGeArray1OfInteger, MdGeArray1OfPnt, MdGeArray1OfReal, MdGeArray2OfPnt, MdGeArray2OfReal, MdGeArrowAspect, MdGeAxis, MdGeBRep, MdGeBSplineCurve, MdGeBSplineSurface, MdGeBezierCurve, MdGeBezierSurface, MdGeBox, MdGeCSYS, MdGeCSYSR, MdGeChamfer, MdGeCircle, MdGeColor, MdGeCompSolid, MdGeCompound, MdGeCone, MdGeCylinder, MdGeDiameterDim, MdGeDimAspect, MdGeDir, MdGeDocColorTool, MdGeDocReader, MdGeDocShapeTool, MdGeDocWriter, MdGeDocument, MdGeDoubleArray, MdGeEdge, MdGeEllipse, MdGeExplorer, MdGeFace, MdGeFillet, MdGeHGeomPlane, MdGeHGeomSurface, MdGeHypr, MdGeInterpolateBSpl, MdGeLabel, MdGeLabelSequence, MdGeLabelTree, MdGeLengthDim, MdGeLight, MdGeLine, MdGeLineAspect, MdGeListIteratorOfListOfShape, MdGeListOfShape, MdGeLocation, MdGeLoft, MdGeMakeArcOfCircle, MdGeMakeFace, MdGeMakeThickSolid, MdGeMakeWires, MdGeMat, MdGeMaterialAspect, MdGeObject, MdGeParab, MdGePipe, MdGePlane, MdGePoint, MdGePointsToBSpl, MdGePointsToBSplSurface, MdGePrism, MdGeRadiusDim, MdGeRect, MdGeRevol, MdGeSequenceIteratorOfSequenceOfShape, MdGeSequenceOfShape, MdGeShape, MdGeShell, MdGeSolid, MdGeSphere, MdGeText, MdGeTextAspect, MdGeTextLabel, MdGeTopo, MdGeTorus, MdGeTransform, MdGeTrsf, MdGeVec, MdGeVertex, MdGeWedge, MdGeWire, MdGeXYZ, MxCADResbuf, MxCADResbufDataType, MxCADSelectionSet, MxCADSelectionSetStatus, MxCADUiPrAngle, MxCADUiPrBase, MxCADUiPrDist, MxCADUiPrEntity, MxCADUiPrInt, MxCADUiPrKeyWord, MxCADUiPrPoint, MxCADUiPrString, MxCADUtility, MxCADUtilityClass, MxCheckTheBrowser, MxCpp, MxCppType, MxDraw3d, MxPropertiesWindowCustom, MxPropertiesWindowCustomValue, MxPropertiesWindowCustomValueType, MxTools, Mx_Erase, ObjectInheritance, _ML_String, b64Decode, b64Encode, createMcCmColor, createMxCad, mxcad as default, downloadFile, downloadFileFromUrl, drawArc, drawCircle, drawEllipticalArc, drawLine, drawMText, drawPolyLine, drawPolygon, drawRectang, drawText, getColorUtils, getFileFromUrl, getFilterImp, getIndexColors, getJsonFromUrl, getStyle, loadMxCADassembly, loadMxCADassembly3d, saveAsFileDialog, setMcCmColor };
|
|
39168
|
+
export { Color, ColorIndexType, ColorMethod, FetchAttributes, IsZero, McAppType, McCmColor, McDb, McDbAlignedDimension, McDbArc, McDbAttribute, McDbAttributeDefinition, McDbBlockReference, McDbBlockTable, McDbBlockTableRecord, McDbCircle, McDbCurve, McDbDatabase, McDbDimension, McDbEllipse, McDbEntity, McDbHatch, McDbLayerTable, McDbLayerTableRecord, McDbLine, McDbLinetypeTable, McDbLinetypeTableRecord, McDbMText, McDbObject, McDbObjectArray, McDbPoint, McDbPolyline, McDbProxyEntity, McDbRasterImage, McDbRasterImageDef, McDbRotatedDimension, McDbText, McDbTextStyleTable, McDbTextStyleTableRecord, McGeLongArray, McGeMatrix3d, McGePoint3d, McGePoint3dArray, McGeStringArray, McGeVector3d, McObject, McObjectId, McObjectIdType, McRxObject, MdGe, MdGeAngleDim, MdGeApplication, MdGeArray1OfInteger, MdGeArray1OfPnt, MdGeArray1OfReal, MdGeArray2OfPnt, MdGeArray2OfReal, MdGeArrowAspect, MdGeAxis, MdGeBRep, MdGeBSplineCurve, MdGeBSplineSurface, MdGeBezierCurve, MdGeBezierSurface, MdGeBox, MdGeCSYS, MdGeCSYSR, MdGeChamfer, MdGeCircle, MdGeColor, MdGeCompSolid, MdGeCompound, MdGeCone, MdGeCylinder, MdGeDiameterDim, MdGeDimAspect, MdGeDir, MdGeDocColorTool, MdGeDocReader, MdGeDocShapeTool, MdGeDocWriter, MdGeDocument, MdGeDoubleArray, MdGeEdge, MdGeEllipse, MdGeExplorer, MdGeFace, MdGeFillet, MdGeHGeomPlane, MdGeHGeomSurface, MdGeHypr, MdGeInterpolateBSpl, MdGeLabel, MdGeLabelSequence, MdGeLabelTree, MdGeLengthDim, MdGeLight, MdGeLine, MdGeLineAspect, MdGeListIteratorOfListOfShape, MdGeListOfShape, MdGeLocation, MdGeLoft, MdGeMakeArcOfCircle, MdGeMakeFace, MdGeMakeThickSolid, MdGeMakeWires, MdGeMat, MdGeMaterialAspect, MdGeObject, MdGeParab, MdGePipe, MdGePlane, MdGePoint, MdGePointsToBSpl, MdGePointsToBSplSurface, MdGePrism, MdGeRadiusDim, MdGeRect, MdGeRevol, MdGeSequenceIteratorOfSequenceOfShape, MdGeSequenceOfShape, MdGeShape, MdGeShell, MdGeSolid, MdGeSphere, MdGeText, MdGeTextAspect, MdGeTextLabel, MdGeTopo, MdGeTorus, MdGeTransform, MdGeTrsf, MdGeVec, MdGeVertex, MdGeWedge, MdGeWire, MdGeXYZ, MxCADResbuf, MxCADResbufDataType, MxCADSelectionSet, MxCADSelectionSetStatus, MxCADUiPrAngle, MxCADUiPrBase, MxCADUiPrDist, MxCADUiPrEntity, MxCADUiPrInt, MxCADUiPrKeyWord, MxCADUiPrPoint, MxCADUiPrString, MxCADUtility, MxCADUtilityClass, MxCheckTheBrowser, MxCpp, MxCppType, MxDraw3d, MxPropertiesWindowCustom, MxPropertiesWindowCustomValue, MxPropertiesWindowCustomValueType, MxTools, Mx_Erase, ObjectInheritance, _ML_String, b64Decode, b64Encode, createMcCmColor, createMxCad, mxcad as default, downloadFile, downloadFileFromUrl, drawArc, drawCircle, drawEllipticalArc, drawLine, drawMText, drawPolyLine, drawPolygon, drawRectang, drawText, getColorUtils, getFileFromUrl, getFilterImp, getIndexColors, getJsonFromUrl, getStyle, loadMxCADassembly, loadMxCADassembly3d, postEmscriptenIndexedDBFile, postMemoryFile, saveAsFileDialog, setMcCmColor };
|