build-dxf 0.1.151 → 0.1.153
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 -1
- package/src/build.js +66 -42
- package/src/utils/modelScenario/scenario.d.ts +1 -1
package/package.json
CHANGED
package/src/build.js
CHANGED
|
@@ -12667,8 +12667,18 @@ class BayWindow {
|
|
|
12667
12667
|
}
|
|
12668
12668
|
}
|
|
12669
12669
|
}
|
|
12670
|
-
|
|
12670
|
+
const num = Number(i) + 1;
|
|
12671
|
+
this.bayWindowGroup.name = `飘窗_${num}`;
|
|
12671
12672
|
this.bayWindowGroup.userData.category = "bayWindow";
|
|
12673
|
+
this.bayWindowGroup.userData.width = data[i].data.windowWidth;
|
|
12674
|
+
this.bayWindowGroup.userData.height = data[i].data.height2;
|
|
12675
|
+
this.bayWindowGroup.userData.groundHeight = data[i].data.height3;
|
|
12676
|
+
this.bayWindowGroup.userData.distanceToTheTop = data[i].data.height1;
|
|
12677
|
+
for (const w in data[i].lines) {
|
|
12678
|
+
if (data[i].lines[w].userData.isWindow) {
|
|
12679
|
+
this.bayWindowGroup.userData.depth = data[i].dottedLine.distanceToSegment(data[i].lines[w]);
|
|
12680
|
+
}
|
|
12681
|
+
}
|
|
12672
12682
|
Scenario.Instance.group.add(this.bayWindowGroup);
|
|
12673
12683
|
}
|
|
12674
12684
|
}
|
|
@@ -13455,8 +13465,8 @@ class BayWindow {
|
|
|
13455
13465
|
let height2 = Scenario.Instance.height + objData.height3 + objData.height2;
|
|
13456
13466
|
mesh.position.z = height1;
|
|
13457
13467
|
mesh2.position.z = height2;
|
|
13458
|
-
|
|
13459
|
-
|
|
13468
|
+
this.bayWindowGroup.add(mesh);
|
|
13469
|
+
this.bayWindowGroup.add(mesh2);
|
|
13460
13470
|
}
|
|
13461
13471
|
// 共用线处理
|
|
13462
13472
|
// sharedLineProcessing(sharedLine: any, data: any) {
|
|
@@ -14259,6 +14269,11 @@ class Scenario {
|
|
|
14259
14269
|
installBalconys(data, index2) {
|
|
14260
14270
|
let balconyGroup = new Group$1();
|
|
14261
14271
|
balconyGroup.name = `阳台${index2}`;
|
|
14272
|
+
balconyGroup.userData.category = "balcony";
|
|
14273
|
+
balconyGroup.userData.height = data.userData.height;
|
|
14274
|
+
balconyGroup.userData.width = data.length;
|
|
14275
|
+
balconyGroup.userData.depth = 0;
|
|
14276
|
+
balconyGroup.userData.groundHeight = 0;
|
|
14262
14277
|
const point1 = new THREE.Vector3(data.start.x, data.start.y, 0);
|
|
14263
14278
|
const point2 = new THREE.Vector3(data.end.x, data.end.y, 0);
|
|
14264
14279
|
new THREE.Vector3(data.center.x, data.center.y, 0);
|
|
@@ -14282,7 +14297,7 @@ class Scenario {
|
|
|
14282
14297
|
menModel.scale.set(distance2 / size2.x, height / size2.y, wallWidth / size2.z);
|
|
14283
14298
|
menModel.position.set(data.center.x, data.center.y, this.height);
|
|
14284
14299
|
menModel.name = `阳台_${index2}`;
|
|
14285
|
-
menModel.userData.category = "
|
|
14300
|
+
menModel.userData.category = "balcony_";
|
|
14286
14301
|
balconyGroup.add(menModel);
|
|
14287
14302
|
this.group.add(balconyGroup);
|
|
14288
14303
|
}
|
|
@@ -14317,7 +14332,7 @@ class Scenario {
|
|
|
14317
14332
|
balconyModel.scale.set(spacing / size2.x, height / size2.y, wallWidth / size2.z);
|
|
14318
14333
|
balconyModel.position.set(center.x, center.y, this.height);
|
|
14319
14334
|
balconyModel.name = `阳台_${index2}`;
|
|
14320
|
-
balconyModel.userData.category = "
|
|
14335
|
+
balconyModel.userData.category = "balcony_";
|
|
14321
14336
|
balconyGroup.add(balconyModel);
|
|
14322
14337
|
}
|
|
14323
14338
|
this.group.add(balconyGroup);
|
|
@@ -14751,14 +14766,28 @@ class Scenario {
|
|
|
14751
14766
|
}
|
|
14752
14767
|
// 生成梁模型
|
|
14753
14768
|
generateBeamModel(line) {
|
|
14754
|
-
|
|
14755
|
-
|
|
14756
|
-
|
|
14757
|
-
|
|
14758
|
-
|
|
14759
|
-
|
|
14760
|
-
|
|
14761
|
-
|
|
14769
|
+
let basePoints;
|
|
14770
|
+
if (!line.userData.expansionWidth) {
|
|
14771
|
+
let wallWidth;
|
|
14772
|
+
if (line.userData.wallWidth) {
|
|
14773
|
+
wallWidth = line.userData.wallWidth;
|
|
14774
|
+
} else {
|
|
14775
|
+
wallWidth = 0.06;
|
|
14776
|
+
}
|
|
14777
|
+
const MobileX = this.angleToXAxisDegrees(line.start.x, line.start.y, line.end.x, line.end.y, wallWidth, true);
|
|
14778
|
+
const MobileY = this.angleToXAxisDegrees(line.start.x, line.start.y, line.end.x, line.end.y, wallWidth, false);
|
|
14779
|
+
let startingPoint = this.xinLine(MobileX, MobileY, line.start, 0);
|
|
14780
|
+
let finishLine = this.xinLine(MobileX, MobileY, line.end, 1);
|
|
14781
|
+
basePoints = [startingPoint[0], startingPoint[1], finishLine[1], finishLine[0]];
|
|
14782
|
+
} else {
|
|
14783
|
+
const directionX = line.userData.expansionDirction.x * line.userData.expansionWidth;
|
|
14784
|
+
const directionY = line.userData.expansionDirction.y * line.userData.expansionWidth;
|
|
14785
|
+
let pointStart = new THREE.Vector3(line.start.x, line.start.y, this.height);
|
|
14786
|
+
let pointEnd = new THREE.Vector3(line.end.x, line.end.y, this.height);
|
|
14787
|
+
let startExpansion = new THREE.Vector3(pointStart.x + directionX, pointStart.y + directionY, this.height);
|
|
14788
|
+
let endExpansion = new THREE.Vector3(pointEnd.x + directionX, pointEnd.y + directionY, this.height);
|
|
14789
|
+
basePoints = [pointStart, pointEnd, endExpansion, startExpansion];
|
|
14790
|
+
}
|
|
14762
14791
|
const geometry = this.createParallelepipedFromBase(basePoints, line.userData.height);
|
|
14763
14792
|
const material = new THREE.MeshStandardMaterial({
|
|
14764
14793
|
// color: 0x4f90d4,
|
|
@@ -22885,40 +22914,35 @@ function doorToHole(lines, option) {
|
|
|
22885
22914
|
});
|
|
22886
22915
|
return lines;
|
|
22887
22916
|
}
|
|
22917
|
+
function getBeamNearWallVec(line) {
|
|
22918
|
+
const iterator = WallHole.getIterator(line);
|
|
22919
|
+
for (const hole of iterator) {
|
|
22920
|
+
if ("beamNearWallVec" in hole) return Point.from(hole.beamNearWallVec);
|
|
22921
|
+
}
|
|
22922
|
+
}
|
|
22888
22923
|
function beamSupportLine(lines, {}) {
|
|
22889
22924
|
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
22925
|
lines.forEach((line) => {
|
|
22906
22926
|
if (WallHole.isBeam(line)) {
|
|
22907
22927
|
const findLine = line.clone();
|
|
22908
|
-
findLine.setLength(findLine.length -
|
|
22909
|
-
|
|
22910
|
-
|
|
22911
|
-
|
|
22912
|
-
|
|
22913
|
-
|
|
22914
|
-
if (
|
|
22915
|
-
if (
|
|
22916
|
-
|
|
22917
|
-
|
|
22918
|
-
|
|
22919
|
-
|
|
22920
|
-
|
|
22921
|
-
|
|
22928
|
+
findLine.setLength(findLine.length - 4e-3);
|
|
22929
|
+
let rectangle = line.toRectangle(2, "butt");
|
|
22930
|
+
const center = findLine.center;
|
|
22931
|
+
const beamNearWallVec = getBeamNearWallVec(line);
|
|
22932
|
+
const list = lsh.queryRect(rectangle).filter((target) => {
|
|
22933
|
+
if (target.line === line) return false;
|
|
22934
|
+
if (!target.line.isParallelTo(findLine, 10)) return false;
|
|
22935
|
+
if (beamNearWallVec) {
|
|
22936
|
+
const dir = target.line.center.directionFrom(center);
|
|
22937
|
+
if (dir.dot(beamNearWallVec) < 0) return false;
|
|
22938
|
+
}
|
|
22939
|
+
return true;
|
|
22940
|
+
}).map((item) => item.line).sort((a2, b4) => a2.distanceToPoint(center) - b4.distanceToPoint(center));
|
|
22941
|
+
if (list.length) {
|
|
22942
|
+
const line2 = list[0];
|
|
22943
|
+
const point2 = line2.projectPoint(center, false);
|
|
22944
|
+
line.userData.expansionWidth = point2.distance(center);
|
|
22945
|
+
line.userData.expansionDirction = point2.directionFrom(center);
|
|
22922
22946
|
}
|
|
22923
22947
|
}
|
|
22924
22948
|
});
|
|
@@ -74,7 +74,7 @@ export default class Scenario {
|
|
|
74
74
|
overhangWallOffset(data: any, index: string, height: number): THREE.Mesh<THREE.ExtrudeGeometry, THREE.MeshStandardMaterial, THREE.Object3DEventMap> | null;
|
|
75
75
|
dashedLineCeilingTreatment(data: any, index: number | string, item: any): THREE.Mesh<THREE.ExtrudeGeometry, THREE.MeshStandardMaterial, THREE.Object3DEventMap> | null;
|
|
76
76
|
overallTreatmentOfSingleLineWalls(data: any): void;
|
|
77
|
-
generateBeamModel(line: any): Brush
|
|
77
|
+
generateBeamModel(line: any): Brush;
|
|
78
78
|
generateColumnModel(data: any, lines: any, Height: number): THREE.Mesh<THREE.ExtrudeGeometry, THREE.MeshStandardMaterial, THREE.Object3DEventMap> | null;
|
|
79
79
|
createAPlane(lines: LineSegment<Record<string, any>>[], menList: LineSegment<Record<string, any>>[]): void;
|
|
80
80
|
modelLoader(): Promise<void>;
|