build-dxf 0.1.151 → 0.1.152
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 +49 -49
- package/src/build.js +24 -29
package/package.json
CHANGED
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "build-dxf",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "",
|
|
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
|
-
"clipper-lib": ">=6.4.2",
|
|
38
|
-
"dxf-writer": ">=1.18.4",
|
|
39
|
-
"vue": ">=3.0.0",
|
|
40
|
-
"canvas": "3.2.0",
|
|
41
|
-
"three-mesh-bvh": "^0.6.6",
|
|
42
|
-
"three-bvh-csg": ">=0.0.17",
|
|
43
|
-
"three-csg-ts": ">=3.2.0",
|
|
44
|
-
"three": ">=0.181.0",
|
|
45
|
-
"node-three-gltf": "2.1.0"
|
|
46
|
-
},
|
|
47
|
-
"author": "夏过初秋",
|
|
48
|
-
"license": "UNLICENSED"
|
|
49
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "build-dxf",
|
|
3
|
+
"version": "0.1.152",
|
|
4
|
+
"description": "",
|
|
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
|
+
"clipper-lib": ">=6.4.2",
|
|
38
|
+
"dxf-writer": ">=1.18.4",
|
|
39
|
+
"vue": ">=3.0.0",
|
|
40
|
+
"canvas": "3.2.0",
|
|
41
|
+
"three-mesh-bvh": "^0.6.6",
|
|
42
|
+
"three-bvh-csg": ">=0.0.17",
|
|
43
|
+
"three-csg-ts": ">=3.2.0",
|
|
44
|
+
"three": ">=0.181.0",
|
|
45
|
+
"node-three-gltf": "2.1.0"
|
|
46
|
+
},
|
|
47
|
+
"author": "夏过初秋",
|
|
48
|
+
"license": "UNLICENSED"
|
|
49
|
+
}
|
package/src/build.js
CHANGED
|
@@ -22885,40 +22885,35 @@ function doorToHole(lines, option) {
|
|
|
22885
22885
|
});
|
|
22886
22886
|
return lines;
|
|
22887
22887
|
}
|
|
22888
|
+
function getBeamNearWallVec(line) {
|
|
22889
|
+
const iterator = WallHole.getIterator(line);
|
|
22890
|
+
for (const hole of iterator) {
|
|
22891
|
+
if ("beamNearWallVec" in hole) return Point.from(hole.beamNearWallVec);
|
|
22892
|
+
}
|
|
22893
|
+
}
|
|
22888
22894
|
function beamSupportLine(lines, {}) {
|
|
22889
22895
|
const lsh = Quadtree.from(lines);
|
|
22890
|
-
const filter = (line, targetLine) => {
|
|
22891
|
-
if (targetLine === line) return false;
|
|
22892
|
-
if (!targetLine.isParallelTo(targetLine, 10)) return false;
|
|
22893
|
-
const len = line.projectLineSegment(targetLine).length;
|
|
22894
|
-
if (len < 1e-3) return false;
|
|
22895
|
-
return true;
|
|
22896
|
-
};
|
|
22897
|
-
const get2 = (line, direct) => {
|
|
22898
|
-
const startRes = lsh.raycast(line.start, direct, 1e-5, 1).filter(({ targetLine }) => filter(line, targetLine));
|
|
22899
|
-
if (!startRes.length) return;
|
|
22900
|
-
const endRes = lsh.raycast(line.end, direct, 1e-5, 1).filter(({ targetLine }) => filter(line, targetLine));
|
|
22901
|
-
if (!endRes.length) return;
|
|
22902
|
-
const start = startRes[0], end = endRes[0], [p1, p2] = start.distance < end.distance ? [line.start, start.intersectPoint] : [line.end, end.intersectPoint], dir = p2.directionFrom(p1), width = p1.distance(p2);
|
|
22903
|
-
return { dir, width };
|
|
22904
|
-
};
|
|
22905
22896
|
lines.forEach((line) => {
|
|
22906
22897
|
if (WallHole.isBeam(line)) {
|
|
22907
22898
|
const findLine = line.clone();
|
|
22908
|
-
findLine.setLength(findLine.length -
|
|
22909
|
-
|
|
22910
|
-
|
|
22911
|
-
|
|
22912
|
-
|
|
22913
|
-
|
|
22914
|
-
if (
|
|
22915
|
-
if (
|
|
22916
|
-
|
|
22917
|
-
|
|
22918
|
-
|
|
22919
|
-
|
|
22920
|
-
|
|
22921
|
-
|
|
22899
|
+
findLine.setLength(findLine.length - 4e-3);
|
|
22900
|
+
let rectangle = line.toRectangle(2, "butt");
|
|
22901
|
+
const center = findLine.center;
|
|
22902
|
+
const beamNearWallVec = getBeamNearWallVec(line);
|
|
22903
|
+
const list = lsh.queryRect(rectangle).filter((target) => {
|
|
22904
|
+
if (target.line === line) return false;
|
|
22905
|
+
if (!target.line.isParallelTo(findLine, 10)) return false;
|
|
22906
|
+
if (beamNearWallVec) {
|
|
22907
|
+
const dir = target.line.center.directionFrom(center);
|
|
22908
|
+
if (dir.dot(beamNearWallVec) < 0) return false;
|
|
22909
|
+
}
|
|
22910
|
+
return true;
|
|
22911
|
+
}).map((item) => item.line).sort((a2, b4) => a2.distanceToPoint(center) - b4.distanceToPoint(center));
|
|
22912
|
+
if (list.length) {
|
|
22913
|
+
const line2 = list[0];
|
|
22914
|
+
const point2 = line2.projectPoint(center, false);
|
|
22915
|
+
line.userData.expansionWidth = point2.distance(center);
|
|
22916
|
+
line.userData.expansionDirction = point2.directionFrom(center);
|
|
22922
22917
|
}
|
|
22923
22918
|
}
|
|
22924
22919
|
});
|