build-dxf 0.1.155 → 0.1.156
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
CHANGED
package/src/build.js
CHANGED
|
@@ -22947,12 +22947,70 @@ function beamSupportLine(lines, {}) {
|
|
|
22947
22947
|
const line2 = list[0];
|
|
22948
22948
|
const point2 = line2.projectPoint(center, false);
|
|
22949
22949
|
line.userData.expansionWidth = point2.distance(center);
|
|
22950
|
-
line.userData.expansionDirction = point2.directionFrom(center);
|
|
22950
|
+
line.userData.expansionDirction = point2.directionFrom(center).toJson2D();
|
|
22951
22951
|
}
|
|
22952
22952
|
}
|
|
22953
22953
|
});
|
|
22954
22954
|
return lines;
|
|
22955
22955
|
}
|
|
22956
|
+
function roomTest(trajectory2) {
|
|
22957
|
+
return (lines) => {
|
|
22958
|
+
const doubleLines = lines.filter((line) => WH.isDouble(line));
|
|
22959
|
+
if (WH.isPairing(doubleLines)) {
|
|
22960
|
+
return false;
|
|
22961
|
+
}
|
|
22962
|
+
const ply = Polygon.fromByLinePath(lines);
|
|
22963
|
+
if (trajectory2) {
|
|
22964
|
+
let has = Object.keys(trajectory2).some((k) => {
|
|
22965
|
+
const p2 = trajectory2[k];
|
|
22966
|
+
if (ply.pointWithin(p2)) return true;
|
|
22967
|
+
return false;
|
|
22968
|
+
});
|
|
22969
|
+
if (!has) return false;
|
|
22970
|
+
}
|
|
22971
|
+
return true;
|
|
22972
|
+
};
|
|
22973
|
+
}
|
|
22974
|
+
function findRooms(lines, trajectory2) {
|
|
22975
|
+
lines = lines.map((line) => line.clone());
|
|
22976
|
+
lines = splitIntersectedLine(lines, 0);
|
|
22977
|
+
const rooms = [];
|
|
22978
|
+
const maxiCircles = new MaxiCircles();
|
|
22979
|
+
LineSegmentUtils.groupByPath(lines).forEach((group2) => {
|
|
22980
|
+
const removeSet = findDiscretePointLine2(group2, null, true);
|
|
22981
|
+
lines = group2.filter((line) => !removeSet.has(line) && !line.userData.isBayWindow);
|
|
22982
|
+
const circles = maxiCircles.miniCircle(lines).circles.filter(roomTest(trajectory2));
|
|
22983
|
+
const ploys = circles.map(((p2) => Polygon.fromByLinePath(p2)));
|
|
22984
|
+
ploys.forEach((ploy, i) => {
|
|
22985
|
+
const xList = [];
|
|
22986
|
+
const yList = [];
|
|
22987
|
+
ploy.forEach((p2) => {
|
|
22988
|
+
xList.push(p2.x);
|
|
22989
|
+
yList.push(p2.y);
|
|
22990
|
+
});
|
|
22991
|
+
const minX = Math.min(...xList), maxX = Math.max(...xList), minY = Math.min(...yList), maxY = Math.max(...yList), center = new Point((maxX - minX) * 0.5 + minX, (maxY - minY) * 0.5 + minY);
|
|
22992
|
+
rooms.push({
|
|
22993
|
+
lines: circles[i],
|
|
22994
|
+
ploy,
|
|
22995
|
+
center
|
|
22996
|
+
});
|
|
22997
|
+
});
|
|
22998
|
+
});
|
|
22999
|
+
return rooms;
|
|
23000
|
+
}
|
|
23001
|
+
function removeRoomSundries(lines, { trajectory: trajectory2 }) {
|
|
23002
|
+
if (trajectory2) {
|
|
23003
|
+
const ls2 = [...findDiscretePointLine(lines)];
|
|
23004
|
+
const rooms = findRooms(lines, trajectory2);
|
|
23005
|
+
const removeLines = ls2.filter((line) => {
|
|
23006
|
+
const center = line.center;
|
|
23007
|
+
return !!rooms.find((room) => room.ploy.pointWithin(center));
|
|
23008
|
+
});
|
|
23009
|
+
const set2 = new Set(removeLines);
|
|
23010
|
+
lines = lines.filter((line) => !set2.has(line));
|
|
23011
|
+
}
|
|
23012
|
+
return lines;
|
|
23013
|
+
}
|
|
22956
23014
|
const builtinFun = {
|
|
22957
23015
|
init,
|
|
22958
23016
|
DoorToHole: doorToHole,
|
|
@@ -22975,7 +23033,8 @@ const builtinFun = {
|
|
|
22975
23033
|
/** 移除与双线墙链接的短线段
|
|
22976
23034
|
*/
|
|
22977
23035
|
RemoveShortDoubleWall: removeShortDoubleWall,
|
|
22978
|
-
BeamSupportLine: beamSupportLine
|
|
23036
|
+
BeamSupportLine: beamSupportLine,
|
|
23037
|
+
RemoveRoomSundries: removeRoomSundries
|
|
22979
23038
|
};
|
|
22980
23039
|
const TYPE = "LINE";
|
|
22981
23040
|
class LinePipeline extends Pipeline {
|
|
@@ -23466,51 +23525,6 @@ class CorrectionDxf extends Dxf {
|
|
|
23466
23525
|
return this.rotateCorrCad?.downloadDxf(filename, unit);
|
|
23467
23526
|
}
|
|
23468
23527
|
}
|
|
23469
|
-
function roomTest(trajectory2) {
|
|
23470
|
-
return (lines) => {
|
|
23471
|
-
const doubleLines = lines.filter((line) => WH.isDouble(line));
|
|
23472
|
-
if (WH.isPairing(doubleLines)) {
|
|
23473
|
-
return false;
|
|
23474
|
-
}
|
|
23475
|
-
const ply = Polygon.fromByLinePath(lines);
|
|
23476
|
-
if (trajectory2) {
|
|
23477
|
-
let has = Object.keys(trajectory2).some((k) => {
|
|
23478
|
-
const p2 = trajectory2[k];
|
|
23479
|
-
if (ply.pointWithin(p2)) return true;
|
|
23480
|
-
return false;
|
|
23481
|
-
});
|
|
23482
|
-
if (!has) return false;
|
|
23483
|
-
}
|
|
23484
|
-
return true;
|
|
23485
|
-
};
|
|
23486
|
-
}
|
|
23487
|
-
function findRooms(lines, trajectory2) {
|
|
23488
|
-
lines = lines.map((line) => line.clone());
|
|
23489
|
-
lines = splitIntersectedLine(lines, 0);
|
|
23490
|
-
const rooms = [];
|
|
23491
|
-
const maxiCircles = new MaxiCircles();
|
|
23492
|
-
LineSegmentUtils.groupByPath(lines).forEach((group2) => {
|
|
23493
|
-
const removeSet = findDiscretePointLine2(group2, null, true);
|
|
23494
|
-
lines = group2.filter((line) => !removeSet.has(line) && !line.userData.isBayWindow);
|
|
23495
|
-
const circles = maxiCircles.miniCircle(lines).circles.filter(roomTest(trajectory2));
|
|
23496
|
-
const ploys = circles.map(((p2) => Polygon.fromByLinePath(p2)));
|
|
23497
|
-
ploys.forEach((ploy, i) => {
|
|
23498
|
-
const xList = [];
|
|
23499
|
-
const yList = [];
|
|
23500
|
-
ploy.forEach((p2) => {
|
|
23501
|
-
xList.push(p2.x);
|
|
23502
|
-
yList.push(p2.y);
|
|
23503
|
-
});
|
|
23504
|
-
const minX = Math.min(...xList), maxX = Math.max(...xList), minY = Math.min(...yList), maxY = Math.max(...yList), center = new Point((maxX - minX) * 0.5 + minX, (maxY - minY) * 0.5 + minY);
|
|
23505
|
-
rooms.push({
|
|
23506
|
-
lines: circles[i],
|
|
23507
|
-
ploy,
|
|
23508
|
-
center
|
|
23509
|
-
});
|
|
23510
|
-
});
|
|
23511
|
-
});
|
|
23512
|
-
return rooms;
|
|
23513
|
-
}
|
|
23514
23528
|
class ThreeVJia extends Component {
|
|
23515
23529
|
static name = "ThreeVJia";
|
|
23516
23530
|
lineSegments = [];
|
|
@@ -23998,7 +24012,7 @@ async function buildJson(opt, dxfSystem2 = new DxfSystem()) {
|
|
|
23998
24012
|
dxfSystem2.Dxf.linePipeline.add(LinePipeline.builtin.init).add(LinePipeline.builtin.WallHeightHandle).add(LinePipeline.builtin.DoorToHole);
|
|
23999
24013
|
doorFind && dxfSystem2.Dxf.linePipeline.add(LinePipeline.builtin.DoorFind);
|
|
24000
24014
|
if (opt.axisAlignCorr !== false) {
|
|
24001
|
-
dxfSystem2.Dxf.linePipeline.add(LinePipeline.builtin.AxisAlignCorr).add(LinePipeline.builtin.RemoveShortDoubleWall).add(LinePipeline.builtin.BeamSupportLine);
|
|
24015
|
+
dxfSystem2.Dxf.linePipeline.add(LinePipeline.builtin.AxisAlignCorr).add(LinePipeline.builtin.RemoveShortDoubleWall).add(LinePipeline.builtin.BeamSupportLine).add(LinePipeline.builtin.RemoveRoomSundries);
|
|
24002
24016
|
}
|
|
24003
24017
|
if (trajectory2) {
|
|
24004
24018
|
if (typeof trajectory2 === "string") {
|
|
@@ -8,6 +8,7 @@ import { removeShortDoubleWall } from './remove-short-double-wall';
|
|
|
8
8
|
import { doorToHole } from './door-to-hole';
|
|
9
9
|
import { LineSegment } from '../../../../utils/algorithms/LineSegment';
|
|
10
10
|
import { beamSupportLine } from './beam-support-line';
|
|
11
|
+
import { removeRoomSundries } from './remove-room-sundries';
|
|
11
12
|
/**
|
|
12
13
|
* 默认提供的预处理函数
|
|
13
14
|
*/
|
|
@@ -34,4 +35,5 @@ export declare const builtinFun: {
|
|
|
34
35
|
*/
|
|
35
36
|
RemoveShortDoubleWall: typeof removeShortDoubleWall;
|
|
36
37
|
BeamSupportLine: typeof beamSupportLine;
|
|
38
|
+
RemoveRoomSundries: typeof removeRoomSundries;
|
|
37
39
|
};
|
|
@@ -13,6 +13,7 @@ export declare class LinePipeline<T = SetDataOption> extends Pipeline<LineSegmen
|
|
|
13
13
|
DoorSpaceHandle: typeof import('./builtin/door-space-handle').doorSpaceHandle;
|
|
14
14
|
RemoveShortDoubleWall: typeof import('./builtin/remove-short-double-wall').removeShortDoubleWall;
|
|
15
15
|
BeamSupportLine: typeof import('./builtin/beam-support-line').beamSupportLine;
|
|
16
|
+
RemoveRoomSundries: typeof import('./builtin/remove-room-sundries').removeRoomSundries;
|
|
16
17
|
};
|
|
17
18
|
constructor();
|
|
18
19
|
add(handle: (lines: LineSegment<LineUserData>[], option: T) => LineSegment<LineUserData>[]): this;
|