build-dxf 0.0.52 → 0.0.53

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/README.md CHANGED
@@ -1,157 +1,168 @@
1
- # build-dxf
2
-
3
- # 安装
4
- ```
5
- npm i build-dxf
6
- ```
7
-
8
- # node 使用示例
9
- ```typescript
10
- import { DxfSystem, ModelDataPlugin, components, utils } from "build-dxf"
11
- /**
12
- * json 文件格式为{ start: {x: number, y: number}, end: {x: number, y: number } , insetionArr: {index: number}[] }[]
13
- */
14
- const path = process.argv[2] ?? "./json/d10.json"
15
- const dxfSystem = new DxfSystem()
16
-
17
- // 使用模型数据生成插件
18
- dxfSystem.usePlugin(ModelDataPlugin)
19
-
20
- // 获取白模数据生成组件
21
- const whiteModel = dxfSystem.findComponentByType(components.WhiteModel)
22
- // 获取详情点数据生成组件
23
- const detailsPoint = dxfSystem.findComponentByType(components.DetailsPoint)
24
- const threeVJia = dxfSystem.findComponentByName("ThreeVJia")
25
-
26
- dxfSystem.Dxf.set(path).then(()=> {
27
- // 监听详情点数据处理完成
28
- detailsPoint.addEventListener("handleSuccess", () => {
29
- // 下载dxf文件
30
- dxfSystem.Dxf.download("01.dxf")
31
- // 下载白模,obj格式
32
- whiteModel.downloadOBJ("001.obj")
33
- // 下载白模,gltf或glb格式, 第二个参数为true时是glb,默认为true
34
- whiteModel.downloadGltf("001.glb", true)
35
-
36
- // 下载三维家 json
37
- threeVJia.download("json.json")
38
-
39
- // 下载为图片
40
- dxfSystem.AngleCorrectionDxf.downloadImage("001.jpg")
41
-
42
- // 下载新json
43
- dxfSystem.Dxf.downloadOriginalData("data.json")
44
-
45
- // desPoints 为射线点集合,根据需要使用
46
- console.log("handleSuccess", detailsPoint.desPoints)
47
- })
48
-
49
- // trajectory222为轨迹文件数据
50
- dxfSystem.Dxf.addEventListener("preprocessing", ({ setData, data }) => {
51
- setData( utils.BoundExt.boundExtbyTraj(data, trajectory222 ) )
52
- }, { once: true })
53
-
54
- dxfSystem.Dxf.axisAlignCorr({ groupMethod: "cross", fittingMethod: "max", crossAxistThreshold: 0.08 })
55
- dxfSystem.Dxf.lineOffset()
56
-
57
- detailsPoint.set("./json/dp8.json")
58
- })
59
- ```
60
-
61
- # 浏览器编辑功能使用示例
62
- ```html
63
-
64
- <template>
65
- <div class="w-[100vw] h-[100vh]" ref="dom"> </div>
66
- </template>
67
-
68
- <style scoped></style>
69
-
70
- <script setup lang="ts">
71
- import data from "../data/d9.json"
72
- import { createEditor } from "build-dxf"
73
- import { onMounted, ref } from "vue"
74
- import * as THREE from "three"
75
- import "build-dxf/index.css"
76
-
77
- const dom = ref<HTMLDivElement>()
78
-
79
- onMounted(async ()=>{
80
- if(dom.value) {
81
- const camera = new THREE.OrthographicCamera( -100, 100, 100, -100, 0.1, 1000 )
82
- const { dxfSystem } = await createEditor( dom.value, camera )
83
- dxfSystem.Dxf.set( (data as any) )
84
- dxfSystem.Dxf.lineOffset()
85
- }
86
- })
87
- </script>
88
- ```
89
-
90
-
91
-
92
- # 浏览器 使用示例
93
- ```html
94
- <template>
95
- <div class="w-[100vw] h-[100vh]">
96
- <Dxf3DView :lines="(data as any)" :details-point="dp8" />
97
- </div>
98
- </template>
99
-
100
- <style scoped></style>
101
-
102
- <script setup lang="ts">
103
- import { Dxf3DView } from "build-dxf/RenderPlugin"
104
- import "build-dxf/index.css"
105
- import data from "../data/d4.json"
106
- import dp8 from "../data/dp8.json"
107
- </script>
108
- ```
109
-
110
- # 内置类
111
- ### 1. 核心类
112
- 1. DxfSystem
113
-
114
- ### 核心组件类
115
- 1. Dxf
116
- 2. AngleCorrectionDxf
117
- 3. DoorsAnalysis
118
- 4. ThreeVJia
119
- 5. Variable
120
-
121
- ### 2. 渲染插件组件类
122
- 1. Renderer
123
- 2. DomContainer
124
- 3. DomEventRegister
125
- 4. EventInput
126
- 5. DetailsPointRender
127
- 6. ModelDataRender
128
- 7. OriginalLineRender
129
-
130
- ### 3. 模型数据提供插件组件类
131
- 1. DetailsPoint
132
- 2. DxfLineModel
133
- 3. WhiteModel
134
-
135
- ### 4. 编辑器插件组件类
136
-
137
- ##### 编辑器管理组件类
138
- 1. RenderManager
139
- 2. Editor
140
-
141
- ##### 命令流组件类
142
- 1. CommandFlowComponent
143
- 2. Default
144
- 3. ClippingLine
145
- 4. ConnectionLine
146
- 5. DeleteSelectLine
147
- 6. DeleteSelectWindow
148
- 7. DrawDoorLine
149
- 8. DrawLine
150
- 9. DrawWindow
151
- 10. IntersectionConnectionLine
152
- 11. MergeLine
153
- 12. PointDrag
154
- 13. SelectAll
155
- 14. VerticalCorrection
156
- 15. VerticalReferenceLine
1
+ # build-dxf
2
+
3
+ # 安装
4
+ ```
5
+ npm i build-dxf
6
+ ```
7
+
8
+ # node 使用示例
9
+ ```typescript
10
+ import { DxfSystem, ModelDataPlugin, components, utils } from "build-dxf"
11
+ /**
12
+ * json 文件格式为{ start: {x: number, y: number}, end: {x: number, y: number } , insetionArr: {index: number}[] }[]
13
+ */
14
+ const path = process.argv[2] ?? "./json/d10.json"
15
+ const dxfSystem = new DxfSystem()
16
+
17
+ // 使用模型数据生成插件
18
+ dxfSystem.usePlugin(ModelDataPlugin)
19
+
20
+ // 获取白模数据生成组件
21
+ const whiteModel = dxfSystem.findComponentByType(components.WhiteModel)
22
+ // 获取详情点数据生成组件
23
+ const detailsPoint = dxfSystem.findComponentByType(components.DetailsPoint)
24
+ const threeVJia = dxfSystem.findComponentByName("ThreeVJia")
25
+
26
+ dxfSystem.Dxf.set(path).then(()=> {
27
+ // 监听详情点数据处理完成
28
+ detailsPoint.addEventListener("handleSuccess", () => {
29
+ // 下载dxf文件
30
+ dxfSystem.Dxf.download("01.dxf")
31
+ // 下载白模,obj格式
32
+ whiteModel.downloadOBJ("001.obj")
33
+ // 下载白模,gltf或glb格式, 第二个参数为true时是glb,默认为true
34
+ whiteModel.downloadGltf("001.glb", true)
35
+
36
+ // 下载三维家 json
37
+ threeVJia.download("json.json")
38
+
39
+ // 下载为图片
40
+ dxfSystem.AngleCorrectionDxf.downloadImage("001.jpg")
41
+
42
+ // 下载新json
43
+ dxfSystem.Dxf.downloadOriginalData("data.json")
44
+
45
+ // desPoints 为射线点集合,根据需要使用
46
+ console.log("handleSuccess", detailsPoint.desPoints)
47
+ })
48
+
49
+ // trajectory222为轨迹文件数据
50
+ dxfSystem.Dxf.addEventListener("preprocessing", ({ setData, data }) => {
51
+ setData( utils.BoundExt.boundExtbyTraj(data, trajectory222 ) )
52
+ }, { once: true })
53
+
54
+ dxfSystem.Dxf.axisAlignCorr({ groupMethod: "cross", fittingMethod: "max", crossAxistThreshold: 0.08 })
55
+ dxfSystem.Dxf.lineOffset()
56
+
57
+ detailsPoint.set("./json/dp8.json")
58
+
59
+ // 获取外扩后的三维家json
60
+ const lines = utils.BoundExt.boundExtbyTraj({
61
+ lines: dxfSystem.Dxf.getLineSegments(),
62
+ trajectory: trajectoryJson // 轨迹json对象,
63
+ wallWidth: 0.12,
64
+ updateDoubleWallGroup: true
65
+ }).lines
66
+
67
+ // 三维家json
68
+ const json = utils.lineDataToThreeVJiaJson(lines, dxfSystem.AngleCorrectionDxf.angle).toJson("测试")
69
+ })
70
+ ```
71
+
72
+ # 浏览器编辑功能使用示例
73
+ ```html
74
+
75
+ <template>
76
+ <div class="w-[100vw] h-[100vh]" ref="dom"> </div>
77
+ </template>
78
+
79
+ <style scoped></style>
80
+
81
+ <script setup lang="ts">
82
+ import data from "../data/d9.json"
83
+ import { createEditor } from "build-dxf"
84
+ import { onMounted, ref } from "vue"
85
+ import * as THREE from "three"
86
+ import "build-dxf/index.css"
87
+
88
+ const dom = ref<HTMLDivElement>()
89
+
90
+ onMounted(async ()=>{
91
+ if(dom.value) {
92
+ const camera = new THREE.OrthographicCamera( -100, 100, 100, -100, 0.1, 1000 )
93
+ const { dxfSystem } = await createEditor( dom.value, camera )
94
+ dxfSystem.Dxf.set( (data as any) )
95
+ dxfSystem.Dxf.lineOffset()
96
+ }
97
+ })
98
+ </script>
99
+ ```
100
+
101
+
102
+
103
+ # 浏览器 使用示例
104
+ ```html
105
+ <template>
106
+ <div class="w-[100vw] h-[100vh]">
107
+ <Dxf3DView :lines="(data as any)" :details-point="dp8" />
108
+ </div>
109
+ </template>
110
+
111
+ <style scoped></style>
112
+
113
+ <script setup lang="ts">
114
+ import { Dxf3DView } from "build-dxf/RenderPlugin"
115
+ import "build-dxf/index.css"
116
+ import data from "../data/d4.json"
117
+ import dp8 from "../data/dp8.json"
118
+ </script>
119
+ ```
120
+
121
+ # 内置类
122
+ ### 1. 核心类
123
+ 1. DxfSystem
124
+
125
+ ### 核心组件类
126
+ 1. Dxf
127
+ 2. AngleCorrectionDxf
128
+ 3. DoorsAnalysis
129
+ 4. ThreeVJia
130
+ 5. Variable
131
+
132
+ ### 2. 渲染插件组件类
133
+ 1. Renderer
134
+ 2. DomContainer
135
+ 3. DomEventRegister
136
+ 4. EventInput
137
+ 5. DetailsPointRender
138
+ 6. ModelDataRender
139
+ 7. OriginalLineRender
140
+
141
+ ### 3. 模型数据提供插件组件类
142
+ 1. DetailsPoint
143
+ 2. DxfLineModel
144
+ 3. WhiteModel
145
+
146
+ ### 4. 编辑器插件组件类
147
+
148
+ ##### 编辑器管理组件类
149
+ 1. RenderManager
150
+ 2. Editor
151
+
152
+ ##### 命令流组件类
153
+ 1. CommandFlowComponent
154
+ 2. Default
155
+ 3. ClippingLine
156
+ 4. ConnectionLine
157
+ 5. DeleteSelectLine
158
+ 6. DeleteSelectWindow
159
+ 7. DrawDoorLine
160
+ 8. DrawLine
161
+ 9. DrawWindow
162
+ 10. IntersectionConnectionLine
163
+ 11. MergeLine
164
+ 12. PointDrag
165
+ 13. SelectAll
166
+ 14. VerticalCorrection
167
+ 15. VerticalReferenceLine
157
168
  16. ViewAngle
package/package.json CHANGED
@@ -1,45 +1,45 @@
1
- {
2
- "name": "build-dxf",
3
- "version": "0.0.52",
4
- "description": "线段构建双线墙壁的dxf版本",
5
- "main": "./src/index.js",
6
- "types": "./src/index.d.ts",
7
- "scripts": {
8
- "test": "echo \"Error: no test specified\" && exit 1"
9
- },
10
- "exports": {
11
- ".": {
12
- "import": {
13
- "types": "./src/build.d.ts",
14
- "default": "./src/index.js",
15
- "style": "./src/index.css"
16
- },
17
- "require": {
18
- "types": "./src/build.d.ts",
19
- "default": "./src/index.js"
20
- }
21
- },
22
- "./RenderPlugin": {
23
- "import": {
24
- "types": "./src/utils/DxfSystem/plugin/RenderPlugin/index.d.ts",
25
- "default": "./src/index2.js"
26
- },
27
- "require": {
28
- "types": "./src/index.d.ts",
29
- "default": "./src/index2.js"
30
- }
31
- },
32
- "./index.css": "./src/index.css"
33
- },
34
- "style": "src/index.css",
35
- "dependencies": {
36
- "@tweenjs/tween.js": ">=25.0.0",
37
- "build-dxf": "^0.0.20-21",
38
- "clipper-lib": ">=6.4.2",
39
- "dxf-writer": ">=1.18.4",
40
- "vue": ">=3.0.0",
41
- "canvas": "^3.2.0"
42
- },
43
- "author": "夏过初秋",
44
- "license": "ISC"
45
- }
1
+ {
2
+ "name": "build-dxf",
3
+ "version": "0.0.53",
4
+ "description": "线段构建双线墙壁的dxf版本",
5
+ "main": "./src/index.js",
6
+ "types": "./src/index.d.ts",
7
+ "scripts": {
8
+ "test": "echo \"Error: no test specified\" && exit 1"
9
+ },
10
+ "exports": {
11
+ ".": {
12
+ "import": {
13
+ "types": "./src/build.d.ts",
14
+ "default": "./src/index.js",
15
+ "style": "./src/index.css"
16
+ },
17
+ "require": {
18
+ "types": "./src/build.d.ts",
19
+ "default": "./src/index.js"
20
+ }
21
+ },
22
+ "./RenderPlugin": {
23
+ "import": {
24
+ "types": "./src/utils/DxfSystem/plugin/RenderPlugin/index.d.ts",
25
+ "default": "./src/index2.js"
26
+ },
27
+ "require": {
28
+ "types": "./src/index.d.ts",
29
+ "default": "./src/index2.js"
30
+ }
31
+ },
32
+ "./index.css": "./src/index.css"
33
+ },
34
+ "style": "src/index.css",
35
+ "dependencies": {
36
+ "@tweenjs/tween.js": ">=25.0.0",
37
+ "build-dxf": "^0.0.20-21",
38
+ "clipper-lib": ">=6.4.2",
39
+ "dxf-writer": ">=1.18.4",
40
+ "vue": ">=3.0.0",
41
+ "canvas": "^3.2.0"
42
+ },
43
+ "author": "夏过初秋",
44
+ "license": "UNLICENSED"
45
+ }