build-dxf 0.1.131 → 0.1.133
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 +21 -14
package/package.json
CHANGED
package/src/build.js
CHANGED
|
@@ -10545,24 +10545,29 @@ class ThreeVJiaPipeline extends Pipeline {
|
|
|
10545
10545
|
console.warn(`第${i}个物品轮廓为空`);
|
|
10546
10546
|
return;
|
|
10547
10547
|
}
|
|
10548
|
-
|
|
10548
|
+
let itemPoly = new Polygon(
|
|
10549
10549
|
contour.map((p2) => Point.from(p2).rotate(json.center, json.angle))
|
|
10550
|
-
)
|
|
10550
|
+
);
|
|
10551
|
+
const center = itemPoly.getCenter(), index2 = roomPloys.findIndex((poly) => poly.pointWithin(center));
|
|
10551
10552
|
if (index2 < 0) return;
|
|
10552
10553
|
try {
|
|
10553
|
-
|
|
10554
|
-
|
|
10555
|
-
name: placeHoldersMap[item.category],
|
|
10556
|
-
polygon: rect,
|
|
10557
|
-
direction: Point.from(item.direction).rotate(Point.zero(), json.angle),
|
|
10558
|
-
height: item.box.max.z - item.box.min.z,
|
|
10559
|
-
sillHeight: item.box.min.z - z,
|
|
10560
|
-
roomId: rooms[index2].roomTypeId,
|
|
10561
|
-
id: i
|
|
10562
|
-
});
|
|
10554
|
+
let newR = itemPoly.getMinimumBoundingRectangle();
|
|
10555
|
+
if (newR) itemPoly = newR;
|
|
10563
10556
|
} catch (error) {
|
|
10564
|
-
console.warn(`第${i}
|
|
10565
|
-
}
|
|
10557
|
+
console.warn(`第${i}个物品 转四边形错误`);
|
|
10558
|
+
}
|
|
10559
|
+
const direction = Point.from(item.direction).normalize().rotate(Point.zero(), json.angle);
|
|
10560
|
+
if (itemPoly[1].distanceSquared(itemPoly[0]) < itemPoly[2].distanceSquared(itemPoly[1])) itemPoly.reverse();
|
|
10561
|
+
const rect = itemPoly.map((p2) => p2.toJson2D());
|
|
10562
|
+
json.placeHolders.push({
|
|
10563
|
+
name: placeHoldersMap[item.category],
|
|
10564
|
+
polygon: rect,
|
|
10565
|
+
direction: direction.toJson2D(),
|
|
10566
|
+
height: item.box.max.z - item.box.min.z,
|
|
10567
|
+
sillHeight: item.box.min.z - z,
|
|
10568
|
+
roomId: rooms[index2].roomTypeId,
|
|
10569
|
+
id: i
|
|
10570
|
+
});
|
|
10566
10571
|
});
|
|
10567
10572
|
return json;
|
|
10568
10573
|
}
|
|
@@ -22966,6 +22971,8 @@ class ThreeVJia extends Component {
|
|
|
22966
22971
|
angleCorrectionDxf.addEventListener("cadChange", async () => {
|
|
22967
22972
|
this.neededUpdate = true;
|
|
22968
22973
|
this.trajectory = angleCorrectionDxf.options.trajectory;
|
|
22974
|
+
const json = ThreeVJiaPipeline.appendPlaceHolders(this.toJson(), angleCorrectionDxf.options.publicInfo, angleCorrectionDxf.options.originalZ);
|
|
22975
|
+
console.log(json);
|
|
22969
22976
|
});
|
|
22970
22977
|
}
|
|
22971
22978
|
cacheJson;
|