build-dxf 0.1.58 → 0.1.59

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "build-dxf",
3
- "version": "0.1.58",
3
+ "version": "0.1.59",
4
4
  "description": "线段构建双线墙壁的dxf版本",
5
5
  "main": "./src/index.js",
6
6
  "types": "./src/index.d.ts",
package/src/build.js CHANGED
@@ -6198,7 +6198,7 @@ class CAD {
6198
6198
  /** 添加组并执行偏移
6199
6199
  * @description 使用 ClipperLib 对每个点组进行线偏移处理,生成具有指定宽度的墙体路径
6200
6200
  */
6201
- addGroupByOffset(lines, joinType = "jtMiter", endType = "etOpenButt", scale2 = 1e5) {
6201
+ addGroupAndOffset(lines, joinType = "jtMiter", endType = "etOpenButt", scale2 = 1e5) {
6202
6202
  const groups = LineSegment.groupByPoint(lines);
6203
6203
  const polygons = groups.flatMap((group2) => Polygon.multipleFromByLines(group2));
6204
6204
  const offset2 = new ClipperLib.ClipperOffset(2, 0.25);
@@ -6735,7 +6735,7 @@ class DxfDataPlugin {
6735
6735
  line.end.add(direct.clone().multiplyScalar(-DEFAULT_WALL_WIDTH * 0.5));
6736
6736
  }
6737
6737
  });
6738
- cad.addGroupByOffset(wall);
6738
+ cad.addGroupAndOffset(wall);
6739
6739
  cad.addGroups(doubleWallGroup, "doubleWall");
6740
6740
  cad.unionGroupAll();
6741
6741
  cad.addGroup(doors, "door");
@@ -7006,7 +7006,7 @@ function buildBayWindowGroup(lines, clear = true) {
7006
7006
  if (circles.length === 0 && bayWindowLine.userData?.outSize) {
7007
7007
  const direct = Point.from(bayWindowLine.userData.outSize.direction), point2 = bayWindowLine.center.add(direct.multiplyScalar(1e-8));
7008
7008
  circles.push([bayWindowLine]);
7009
- bayWindowLine.points.map((p2) => {
7009
+ const paths = bayWindowLine.points.map((p2) => {
7010
7010
  const path = /* @__PURE__ */ new Set();
7011
7011
  maxiCircles.findSameSidePath({
7012
7012
  path,
@@ -7016,8 +7016,33 @@ function buildBayWindowGroup(lines, clear = true) {
7016
7016
  exitPoint: p2,
7017
7017
  grid: lines
7018
7018
  });
7019
- circles[0].push(...path);
7020
- });
7019
+ return [...path];
7020
+ }).filter((path) => path.length);
7021
+ circles[0].push(...paths.flat(2));
7022
+ if (paths.length === 2) {
7023
+ const line1 = paths[0][paths[0].length - 1], line2 = paths[1][paths[1].length - 1];
7024
+ let point1, point22, min = Infinity;
7025
+ line1.points.forEach((p2) => {
7026
+ line2.points.forEach((p22) => {
7027
+ const distance2 = p2.distance(p22);
7028
+ if (distance2 < min && distance2 < 0.3) {
7029
+ point1 = p2;
7030
+ point22 = p22;
7031
+ min = distance2;
7032
+ }
7033
+ });
7034
+ });
7035
+ if (point1 && point22) {
7036
+ const point3 = line1.projectPoint(point22, false);
7037
+ if (point3) {
7038
+ const newLine = new LineSegment(point3.clone(), point22.clone());
7039
+ lines.push(newLine);
7040
+ circles[0].push(newLine);
7041
+ point1.copy(point3);
7042
+ newLine.userData.isWindowWall = true;
7043
+ }
7044
+ }
7045
+ }
7021
7046
  }
7022
7047
  const id = uuid();
7023
7048
  if (circles.length) {
@@ -16658,6 +16683,7 @@ class SceneAutoGenerat {
16658
16683
  mesh.position.z = this.z;
16659
16684
  mesh.name = `平面_out_${i}_${j}`;
16660
16685
  mesh.userData.category = "plane";
16686
+ mesh.userData.area = poly.area();
16661
16687
  this.scene.add(mesh);
16662
16688
  });
16663
16689
  });
@@ -16667,6 +16693,7 @@ class SceneAutoGenerat {
16667
16693
  mesh.position.z = this.z;
16668
16694
  mesh.name = `平面_${i}_${j}`;
16669
16695
  mesh.userData.category = "plane";
16696
+ mesh.userData.area = Polygon.fromByLines2(circle).area();
16670
16697
  mesh.userData.room = true;
16671
16698
  this.scene.add(mesh);
16672
16699
  });
@@ -23,6 +23,8 @@ export type WallLineGlobalOption = {
23
23
  isBayWindow?: boolean;
24
24
  /** 是不是飘窗墙壁 */
25
25
  isWindowWall?: boolean;
26
+ /** 是不是阳台护栏 */
27
+ isBalconyRailing?: boolean;
26
28
  /** 是不是门线 */
27
29
  isDoor?: boolean;
28
30
  doorAutomaticFind?: boolean;
@@ -65,7 +65,7 @@ export declare class CAD {
65
65
  /** 添加组并执行偏移
66
66
  * @description 使用 ClipperLib 对每个点组进行线偏移处理,生成具有指定宽度的墙体路径
67
67
  */
68
- addGroupByOffset(lines: LineSegmentType[], joinType?: JoinType, endType?: EndType, scale?: number): this;
68
+ addGroupAndOffset(lines: LineSegmentType[], joinType?: JoinType, endType?: EndType, scale?: number): this;
69
69
  /**
70
70
  * 合并所有组
71
71
  */
@@ -132,7 +132,7 @@ export declare class CAD {
132
132
  referenceLine: LineSegment<Record<string, any>>;
133
133
  };
134
134
  }
135
- /** dxf 数据处理插件
135
+ /** dxf 绘制插件
136
136
  */
137
137
  export declare class DxfDrawPlugin implements ICADPlugin {
138
138
  /** 获取角度范围
@@ -144,7 +144,7 @@ export declare class DxfDrawPlugin implements ICADPlugin {
144
144
  private getArcAngleRange;
145
145
  install(cad: CAD): void;
146
146
  }
147
- /** dxf 绘制插件
147
+ /** dxf 数据处理插件
148
148
  */
149
149
  export declare class DxfDataPlugin implements ICADPlugin {
150
150
  lines: LineSegment<LineUserData>[];
@@ -12,7 +12,9 @@ interface IDockInfo {
12
12
  export declare class DoorFind {
13
13
  lines: LineSegment[];
14
14
  grid: PointVirtualGrid<LineSegment<LineUserData>>;
15
- quadtree: Quadtree<LineSegment<LineUserData>>;
15
+ quadtree: Quadtree<{
16
+ index: number;
17
+ }>;
16
18
  constructor(lines: LineSegment<LineUserData>[]);
17
19
  /**
18
20
  * 查找兄弟门(双开门)