build-dxf 0.1.107 → 0.1.108
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 +27 -15
- package/src/dxfSystem/plugins/index.d.ts +1 -0
package/package.json
CHANGED
package/src/build.js
CHANGED
|
@@ -9572,6 +9572,10 @@ const holeTypeMap = {
|
|
|
9572
9572
|
passageEntrance: "WALL_HOLE",
|
|
9573
9573
|
bay_window: "BAY_WINDOW"
|
|
9574
9574
|
};
|
|
9575
|
+
const placeHoldersMap = {
|
|
9576
|
+
switch: "开关",
|
|
9577
|
+
socket: "插座"
|
|
9578
|
+
};
|
|
9575
9579
|
const WALL_HEIGHT_KEY = /* @__PURE__ */ Symbol("height");
|
|
9576
9580
|
class ThreeVJiaPipeline extends Pipeline {
|
|
9577
9581
|
manager;
|
|
@@ -9604,17 +9608,10 @@ class ThreeVJiaPipeline extends Pipeline {
|
|
|
9604
9608
|
if (lines2.length < 4) return lines2;
|
|
9605
9609
|
let newLine = null;
|
|
9606
9610
|
let wallWidth = 0;
|
|
9607
|
-
|
|
9608
|
-
|
|
9609
|
-
|
|
9610
|
-
|
|
9611
|
-
wallWidth = Math.min(len1, len2);
|
|
9612
|
-
} else {
|
|
9613
|
-
lines2 = [...lines2].sort((a2, b4) => a2.length() - b4.length());
|
|
9614
|
-
const line1 = lines2[0], line2 = lines2[1];
|
|
9615
|
-
newLine = new LineSegment(line1.center.clone(), line2.center.clone());
|
|
9616
|
-
wallWidth = line1.length();
|
|
9617
|
-
}
|
|
9611
|
+
lines2 = [...lines2].sort((a2, b4) => a2.length() - b4.length());
|
|
9612
|
+
const line1 = lines2[0], line2 = lines2[1];
|
|
9613
|
+
newLine = new LineSegment(line1.center.clone(), line2.center.clone());
|
|
9614
|
+
wallWidth = line1.length();
|
|
9618
9615
|
mergeLineUserData(newLine, lines2);
|
|
9619
9616
|
newLine.userData.wallWidth = wallWidth;
|
|
9620
9617
|
return [newLine];
|
|
@@ -9795,13 +9792,13 @@ class ThreeVJiaPipeline extends Pipeline {
|
|
|
9795
9792
|
const rooms = json.rooms, roomPloys = rooms.map((room) => new Polygon(room.polygon.map((p2) => Point.from(p2))));
|
|
9796
9793
|
if (roomPloys.length === 0) return json;
|
|
9797
9794
|
publicInfo.itemInfo.forEach((item, i) => {
|
|
9798
|
-
if (item.category
|
|
9795
|
+
if (!placeHoldersMap[item.category]) return;
|
|
9799
9796
|
const itemPoly = new Polygon(item.contour.map((p2) => Point.from(p2).rotate(json.center, json.angle))), center = itemPoly.getCenter(), index2 = roomPloys.findIndex((poly) => poly.pointWithin(center));
|
|
9800
9797
|
if (index2 < 0) return;
|
|
9801
9798
|
json.placeHolders.push({
|
|
9802
|
-
name: item.category,
|
|
9803
|
-
polygon:
|
|
9804
|
-
direction: item.direction,
|
|
9799
|
+
name: placeHoldersMap[item.category],
|
|
9800
|
+
polygon: itemPoly.getMinimumBoundingRectangle().map((p2) => p2.toJson2D()),
|
|
9801
|
+
direction: Point.from(item.direction).rotate(Point.zero(), json.angle),
|
|
9805
9802
|
height: item.box.max.z - item.box.min.z,
|
|
9806
9803
|
sillHeight: item.box.min.z - z,
|
|
9807
9804
|
roomId: rooms[index2].roomTypeId,
|
|
@@ -11335,7 +11332,22 @@ function axisAlignCorr(lines, option, verticalReferenceLine) {
|
|
|
11335
11332
|
}
|
|
11336
11333
|
return lines;
|
|
11337
11334
|
}
|
|
11335
|
+
function sparse(trajectory2, size2 = 0.4) {
|
|
11336
|
+
const idSet = /* @__PURE__ */ new Set();
|
|
11337
|
+
Object.keys(trajectory2 ?? {}).forEach((key) => {
|
|
11338
|
+
const p2 = trajectory2[key], i = Math.round(p2.x / size2), j = Math.round(p2.y / size2), id = BigInt(i) << 32n | BigInt(j) & 0xffffffffn;
|
|
11339
|
+
if (idSet.has(id)) {
|
|
11340
|
+
delete trajectory2[key];
|
|
11341
|
+
return;
|
|
11342
|
+
}
|
|
11343
|
+
idSet.add(id);
|
|
11344
|
+
});
|
|
11345
|
+
}
|
|
11338
11346
|
function init(lines, option) {
|
|
11347
|
+
if (option.trajectory) {
|
|
11348
|
+
sparse(option.trajectory, 0.2);
|
|
11349
|
+
sparse(option.trajectory, 0.5);
|
|
11350
|
+
}
|
|
11339
11351
|
BuildGroup.doubleWall.setTrajectory(option.trajectory);
|
|
11340
11352
|
lines = lines.map((line) => line.clone());
|
|
11341
11353
|
return lines;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|