build-dxf 0.1.110 → 0.1.111

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/build.js +20 -10
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "build-dxf",
3
- "version": "0.1.110",
3
+ "version": "0.1.111",
4
4
  "description": "线段构建双线墙壁的dxf版本",
5
5
  "main": "./src/index.js",
6
6
  "types": "./src/index.d.ts",
package/src/build.js CHANGED
@@ -9833,17 +9833,27 @@ class ThreeVJiaPipeline extends Pipeline {
9833
9833
  if (roomPloys.length === 0) return json;
9834
9834
  publicInfo.itemInfo.forEach((item, i) => {
9835
9835
  if (!placeHoldersMap[item.category]) return;
9836
- const contour = item.quadContour ?? item.contour, itemPoly = new Polygon(contour.map((p2) => Point.from(p2).rotate(json.center, json.angle))), center = itemPoly.getCenter(), index2 = roomPloys.findIndex((poly) => poly.pointWithin(center));
9836
+ const contour = item.quadContour ?? item.contour;
9837
+ if (contour.length === 0) {
9838
+ console.warn(`第${i}个物品轮廓为空`);
9839
+ return;
9840
+ }
9841
+ const itemPoly = new Polygon(contour.map((p2) => Point.from(p2).rotate(json.center, json.angle))), center = itemPoly.getCenter(), index2 = roomPloys.findIndex((poly) => poly.pointWithin(center));
9837
9842
  if (index2 < 0) return;
9838
- json.placeHolders.push({
9839
- name: placeHoldersMap[item.category],
9840
- polygon: itemPoly.getMinimumBoundingRectangle().map((p2) => p2.toJson2D()),
9841
- direction: Point.from(item.direction).rotate(Point.zero(), json.angle),
9842
- height: item.box.max.z - item.box.min.z,
9843
- sillHeight: item.box.min.z - z,
9844
- roomId: rooms[index2].roomTypeId,
9845
- id: i
9846
- });
9843
+ try {
9844
+ const rect = itemPoly.getMinimumBoundingRectangle().map((p2) => p2.toJson2D());
9845
+ json.placeHolders.push({
9846
+ name: placeHoldersMap[item.category],
9847
+ polygon: rect,
9848
+ direction: Point.from(item.direction).rotate(Point.zero(), json.angle),
9849
+ height: item.box.max.z - item.box.min.z,
9850
+ sillHeight: item.box.min.z - z,
9851
+ roomId: rooms[index2].roomTypeId,
9852
+ id: i
9853
+ });
9854
+ } catch (error) {
9855
+ console.warn(`第${i}个物品解析异常`);
9856
+ }
9847
9857
  });
9848
9858
  return json;
9849
9859
  }