build-dxf 0.1.117 → 0.1.118

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.117",
3
+ "version": "0.1.118",
4
4
  "description": "线段构建双线墙壁的dxf版本",
5
5
  "main": "./src/index.js",
6
6
  "types": "./src/index.d.ts",
package/src/build.js CHANGED
@@ -10,6 +10,7 @@ const VITE_OSS_BASEURL = "https://image.cnyang.cn/common-assets/".endsWith("/")
10
10
  const DEFAULT_WALL_WIDTH = 0.12;
11
11
  const DEFAULT_WALL_HEIGHT = 2.8;
12
12
  const DEFAULT_DOOR_HEIGHT = 2.1;
13
+ const DOUBLE_DOOR_WIDTH = 1.5;
13
14
  const DOOR_GROUND_CLEARANCE_HEIGHT = 0;
14
15
  const DEFAULT_WINDOW_HEIGHT = 0.8;
15
16
  const WINDOW_GROUND_CLEARANCE_HEIGHT = 0.7;
@@ -2712,7 +2713,7 @@ class WallHole {
2712
2713
  static getMinWidth(key, type) {
2713
2714
  if (key === "drawWindow") return 0.3;
2714
2715
  if (key === "passageEntrance") {
2715
- if (type === "door") return 0.3;
2716
+ if (type === "door") return 0.4;
2716
2717
  }
2717
2718
  return 0.05;
2718
2719
  }
@@ -9643,7 +9644,15 @@ function buildBayWindowGroup(lines, clear = true) {
9643
9644
  removeSet.clear();
9644
9645
  bayWindowLines.forEach((bayWindowLine) => {
9645
9646
  let { circles } = MaxiCircles.instance.miniCircle(lines_, { circleEdges: [bayWindowLine] });
9646
- circles = circles.filter((group) => group.some((line) => line.userData.isWindow && line.userData.pair === bayWindowLine.userData.pair));
9647
+ circles = circles.filter(
9648
+ (group) => group.some((line) => {
9649
+ if (!line.userData.isWindow) return false;
9650
+ for (const data of WallHole.getIterator(line)) {
9651
+ if (data.pair === bayWindowLine.userData.pair) return true;
9652
+ }
9653
+ return false;
9654
+ })
9655
+ );
9647
9656
  if (circles.length) {
9648
9657
  grid.queryPolygon(Polygon.fromByLines(circles[0]), "inside").forEach((res) => removeSet.add(res.userData));
9649
9658
  }
@@ -11432,8 +11441,12 @@ function axisAlignCorr(lines, option, verticalReferenceLine) {
11432
11441
  list.forEach((lines2) => {
11433
11442
  const list2 = lines2.filter((line) => line.userData.isBayWindow || line.userData.isWindow), pair = uuid();
11434
11443
  list2.forEach((line) => {
11435
- if (line.userData.isWindow) line.userData.isBayWindowWin = true;
11436
- line.userData.pair = pair;
11444
+ if (line.userData.isWindow) {
11445
+ line.userData.isBayWindowWin = true;
11446
+ for (const data of WallHole.getIterator(line)) {
11447
+ if (data.type === "window") data.pair = pair;
11448
+ }
11449
+ } else line.userData.pair = pair;
11437
11450
  });
11438
11451
  });
11439
11452
  const lineSegments = correction(lines, verticalReferenceLine, option);
@@ -22141,7 +22154,7 @@ class DxfDrawPlugin {
22141
22154
  const doorThickness = DEFAULT_WALL_WIDTH * 0.2;
22142
22155
  const list = [];
22143
22156
  setColor("yellow");
22144
- if (line.length < 1.2) {
22157
+ if (line.length < DOUBLE_DOOR_WIDTH) {
22145
22158
  line.extendAlongDirection(-doorThickness * 0.5);
22146
22159
  const normal = lineSegment.normal();
22147
22160
  let door = new LineSegment(
@@ -4,6 +4,7 @@ export declare const DEFAULT_WALL_WIDTH = 0.12;
4
4
  export declare const DEFAULT_WALL_HEIGHT = 2.8;
5
5
  export declare const DOUBLE_WALL_FIND_WIDTH = 0.4;
6
6
  export declare const DEFAULT_DOOR_HEIGHT = 2.1;
7
+ export declare const DOUBLE_DOOR_WIDTH = 1.5;
7
8
  export declare const DOOR_GROUND_CLEARANCE_HEIGHT = 0;
8
9
  export declare const DEFAULT_WINDOW_HEIGHT = 0.8;
9
10
  export declare const WINDOW_GROUND_CLEARANCE_HEIGHT = 0.7;
@@ -26,6 +26,7 @@ export interface HoleData {
26
26
  nearId?: number;
27
27
  doorId?: number;
28
28
  nearDoorId?: number;
29
+ pair?: string | number;
29
30
  }
30
31
  export type EntityType = "beams" | "door";
31
32
  export type Shape = "line" | "arc" | "polygon";
@@ -73,7 +73,7 @@ export declare class WallHole {
73
73
  * @param line
74
74
  * @returns
75
75
  */
76
- static getMinWidth(key: HoleKeyType, type?: 'door' | "window"): 0.3 | 0.05;
76
+ static getMinWidth(key: HoleKeyType, type?: 'door' | "window"): 0.4 | 0.3 | 0.05;
77
77
  /** 清理孔洞
78
78
  * @param target
79
79
  * @param key
package/src/index3.js CHANGED
@@ -13049,6 +13049,7 @@ class LineAlignmentGuide extends Lines {
13049
13049
  constructor() {
13050
13050
  super();
13051
13051
  this.continuous = false;
13052
+ this.addEventListener("removed", () => this.clear());
13052
13053
  }
13053
13054
  set(line2, points = []) {
13054
13055
  this.clear();
@@ -15365,7 +15366,7 @@ class VerticalCorrContinue extends Command {
15365
15366
  return data;
15366
15367
  }
15367
15368
  }
15368
- function buildDashedHelperLine$1(start, end, offset = 0.5) {
15369
+ function buildDashedHelperLine(start, end, offset = 0.5) {
15369
15370
  const offsetDistance = end.leftNormal(start).multiplyScalar(offset);
15370
15371
  const startOffPoint = start.clone().add(offsetDistance);
15371
15372
  const endOffPoint = end.clone().add(offsetDistance);
@@ -15412,7 +15413,7 @@ class RayDistance extends Command {
15412
15413
  points.sort((a, b) => point.distance(a) - point.distance(b)).forEach((p, i) => {
15413
15414
  const distance = point.distance(p) * 1e3;
15414
15415
  if (distance < 1e-3) return;
15415
- const points2 = buildDashedHelperLine$1(point, p, i * 0.3);
15416
+ const points2 = buildDashedHelperLine(point, p, i * 0.3);
15416
15417
  const auxiliaryLine = new Lines();
15417
15418
  auxiliaryLine.position.z = 6e-3;
15418
15419
  auxiliaryLine.material = new THREE.LineDashedMaterial({
@@ -15444,17 +15445,6 @@ class RayDistance extends Command {
15444
15445
  next();
15445
15446
  }
15446
15447
  }
15447
- function buildDashedHelperLine(start, end, offset = 0.5) {
15448
- const offsetDistance = end.leftNormal(start).multiplyScalar(offset);
15449
- const startOffPoint = start.clone().add(offsetDistance);
15450
- const endOffPoint = end.clone().add(offsetDistance);
15451
- return [
15452
- start,
15453
- startOffPoint,
15454
- endOffPoint,
15455
- end
15456
- ];
15457
- }
15458
15448
  class ManualDistance extends Command {
15459
15449
  static name = "ManualDistance";
15460
15450
  container = new THREE.Group();
@@ -15492,28 +15482,12 @@ class ManualDistance extends Command {
15492
15482
  * @param points
15493
15483
  */
15494
15484
  async ray(next, { point1, point2 }) {
15485
+ const lineAlignmentGuide = new LineAlignmentGuide();
15486
+ this.container.add(lineAlignmentGuide);
15487
+ lineAlignmentGuide.set(new LineSegment(point1, point2));
15495
15488
  this.renderer.createLineSegments([new LineSegment(point1, point2)], 0, { color: 65280 }, this.container);
15496
- const distance = point1.distance(point2) * 1e3;
15497
- const points = buildDashedHelperLine(point1, point2, 0.3);
15498
- const auxiliaryLine = new Lines();
15499
- auxiliaryLine.position.z = 6e-3;
15500
- auxiliaryLine.material = new THREE.LineDashedMaterial({
15501
- color: 16777215,
15502
- dashSize: 0.02,
15503
- gapSize: 0.02
15504
- });
15505
- auxiliaryLine.setPoint(...points.map((p) => new THREE.Vector3(p.x, p.y, 0)));
15506
- this.container.add(auxiliaryLine);
15507
- setTimeout(() => auxiliaryLine.computeLineDistances());
15508
- const text = this.renderer.createText(Number(distance.toFixed(0)) + "mm", points[1].clone().add(points[2]).multiplyScalar(0.5), {
15509
- background: "#333333",
15510
- padding: "0px",
15511
- borderRadius: "0px",
15512
- color: "#fff"
15513
- }, this.container);
15514
- this.addEventRecord("clear", () => {
15515
- auxiliaryLine.removeFromParent();
15516
- text.removeFromParent();
15489
+ this.addCommandEndHandle(() => {
15490
+ lineAlignmentGuide.removeFromParent();
15517
15491
  });
15518
15492
  await this.awaitOnlyKeys(["enter"]);
15519
15493
  next();