build-dxf 0.0.19-1 → 0.0.19-11
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/package.json +1 -3
- package/src/build.d.ts +21 -1
- package/src/build.js +26 -4
- package/src/index.css +526 -1
- package/src/index.js +4 -2
- package/src/index2.js +2363 -3516
- package/src/index3.js +62 -65
- package/src/selectLocalFile.js +511 -2571
- package/src/utils/ComponentManager/ComponentManager.d.ts +1 -1
- package/src/utils/DxfSystem/plugin/Editor/pages/EditorTool.vue.d.ts +3 -1
- package/src/utils/DxfSystem/plugin/RenderPlugin/components/DomEventRegister.d.ts +28 -6
- package/src/utils/DxfSystem/plugin/RenderPlugin/components/Renderer.d.ts +1 -1
- package/src/utils/DxfSystem/plugin/RenderPlugin/index.d.ts +2 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "build-dxf",
|
|
3
|
-
"version": "0.0.19-
|
|
3
|
+
"version": "0.0.19-11",
|
|
4
4
|
"description": "线段构建双线墙壁的dxf版本",
|
|
5
5
|
"main": "./src/index.js",
|
|
6
6
|
"types": "./src/index.d.ts",
|
|
@@ -35,8 +35,6 @@
|
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"clipper-lib": ">=6.4.2",
|
|
37
37
|
"dxf-writer": ">=1.18.4",
|
|
38
|
-
"three-bvh-csg": ">=0.0.17",
|
|
39
|
-
"three-csg-ts": ">=3.2.0",
|
|
40
38
|
"@tweenjs/tween.js": ">=25.0.0",
|
|
41
39
|
"vue": ">=3.0.0",
|
|
42
40
|
"obj2gltf": ">=3.1.6"
|
package/src/build.d.ts
CHANGED
|
@@ -7,6 +7,26 @@ export * from './utils/DxfSystem/plugin/ModelDataPlugin';
|
|
|
7
7
|
* @param camera
|
|
8
8
|
* @returns
|
|
9
9
|
*/
|
|
10
|
-
export declare function createEditor(dom: HTMLDivElement, camera?: THREE.
|
|
10
|
+
export declare function createEditor(dom: HTMLDivElement, camera?: THREE.Camera, orbitControls?: boolean): Promise<{
|
|
11
11
|
dxfSystem: DxfSystem;
|
|
12
|
+
getFileAll: () => {
|
|
13
|
+
dxf: File;
|
|
14
|
+
obj: File;
|
|
15
|
+
glb: File;
|
|
16
|
+
gltf: File;
|
|
17
|
+
};
|
|
12
18
|
}>;
|
|
19
|
+
/**
|
|
20
|
+
* 获取所有文件数据
|
|
21
|
+
* @param dxfSystem
|
|
22
|
+
*/
|
|
23
|
+
export declare function getFileAll(dxfSystem?: DxfSystem): {
|
|
24
|
+
dxf: File;
|
|
25
|
+
obj: File;
|
|
26
|
+
glb: File;
|
|
27
|
+
gltf: File;
|
|
28
|
+
};
|
|
29
|
+
/** 获取全局DxfSystem
|
|
30
|
+
* @returns
|
|
31
|
+
*/
|
|
32
|
+
export declare function getGlobalDxfSystem(): DxfSystem | null;
|
package/src/build.js
CHANGED
|
@@ -120,7 +120,7 @@ class ComponentManager extends EventDispatcher {
|
|
|
120
120
|
* @param callBack
|
|
121
121
|
*/
|
|
122
122
|
findComponents(predicate) {
|
|
123
|
-
return this.components.
|
|
123
|
+
return this.components.filter(predicate);
|
|
124
124
|
}
|
|
125
125
|
/**
|
|
126
126
|
*
|
|
@@ -3076,25 +3076,45 @@ function loadRenderPlugin() {
|
|
|
3076
3076
|
function loadEditorPlugin() {
|
|
3077
3077
|
return import("./index3.js");
|
|
3078
3078
|
}
|
|
3079
|
-
|
|
3079
|
+
let gloabalDxfSystem = null;
|
|
3080
|
+
async function createEditor(dom, camera, orbitControls = false) {
|
|
3080
3081
|
const mp = await Promise.resolve().then(() => index);
|
|
3081
3082
|
const rp = await loadRenderPlugin();
|
|
3082
3083
|
const editor = await loadEditorPlugin();
|
|
3083
3084
|
const dxfSystem = new DxfSystem().usePlugin(mp.ModelDataPlugin.create({
|
|
3084
3085
|
detailsPoint: false,
|
|
3085
|
-
whiteModel:
|
|
3086
|
+
whiteModel: true
|
|
3086
3087
|
})).usePlugin(rp.RenderPlugin.create({
|
|
3087
3088
|
originalLine: false,
|
|
3088
3089
|
modelData: false,
|
|
3089
3090
|
detailsPoint: false,
|
|
3091
|
+
orbitControls,
|
|
3090
3092
|
camera
|
|
3091
3093
|
})).usePlugin(editor.Editor);
|
|
3092
3094
|
const domContainer = dxfSystem.findComponentByType(rp.components.DomContainer);
|
|
3093
3095
|
domContainer && dom.appendChild(domContainer.domElement);
|
|
3096
|
+
gloabalDxfSystem = dxfSystem;
|
|
3094
3097
|
return {
|
|
3095
|
-
dxfSystem
|
|
3098
|
+
dxfSystem,
|
|
3099
|
+
getFileAll: () => getFileAll(dxfSystem)
|
|
3096
3100
|
};
|
|
3097
3101
|
}
|
|
3102
|
+
function getFileAll(dxfSystem = gloabalDxfSystem) {
|
|
3103
|
+
const whiteModel = dxfSystem.findComponentByName("WhiteModel");
|
|
3104
|
+
const dxf = new File([dxfSystem.Dxf.toDxfBlob()], "dxf.dxf", { type: "application/dxf" });
|
|
3105
|
+
const obj = new File([whiteModel.toOBJBlob()], "model.obj", { type: "application/octet-stream" });
|
|
3106
|
+
const glb = new File([whiteModel.toGltfBlob(true)], "model.glb", { type: "application/octet-stream" });
|
|
3107
|
+
const gltf = new File([whiteModel.toGltfBlob(false)], "model.gltf", { type: "application/json" });
|
|
3108
|
+
return {
|
|
3109
|
+
dxf,
|
|
3110
|
+
obj,
|
|
3111
|
+
glb,
|
|
3112
|
+
gltf
|
|
3113
|
+
};
|
|
3114
|
+
}
|
|
3115
|
+
function getGlobalDxfSystem() {
|
|
3116
|
+
return gloabalDxfSystem;
|
|
3117
|
+
}
|
|
3098
3118
|
export {
|
|
3099
3119
|
Box2 as B,
|
|
3100
3120
|
Component as C,
|
|
@@ -3109,5 +3129,7 @@ export {
|
|
|
3109
3129
|
DetailsPoint as a,
|
|
3110
3130
|
PointVirtualGrid as b,
|
|
3111
3131
|
createEditor as c,
|
|
3132
|
+
getGlobalDxfSystem as d,
|
|
3133
|
+
getFileAll as g,
|
|
3112
3134
|
index$1 as i
|
|
3113
3135
|
};
|