build-dxf 0.1.116 → 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.116",
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
@@ -7,9 +7,10 @@ import Drawing from "dxf-writer";
7
7
  import { Brush, Evaluator, SUBTRACTION } from "three-bvh-csg";
8
8
  import { OBJExporter } from "three/examples/jsm/exporters/OBJExporter.js";
9
9
  const VITE_OSS_BASEURL = "https://image.cnyang.cn/common-assets/".endsWith("/") ? "https://image.cnyang.cn/common-assets/" : "https://image.cnyang.cn/common-assets//";
10
- const DEFAULT_WALL_WIDTH = 0.24;
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(
@@ -1,9 +1,10 @@
1
1
  export declare const API_BASE_URL = "";
2
2
  export declare const VITE_OSS_BASEURL: any;
3
- export declare const DEFAULT_WALL_WIDTH = 0.24;
3
+ 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;
@@ -13,6 +13,7 @@ export interface DrawHoleData {
13
13
  export declare class DrawHole extends Command<{
14
14
  pointerMove: {
15
15
  point: THREE.Vector3;
16
+ line?: LineSegment | null;
16
17
  };
17
18
  }> {
18
19
  static name: string;
@@ -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/index.css CHANGED
@@ -1268,10 +1268,10 @@ button[data-v-7a78abcb]:active {
1268
1268
  color: #a7a7a7
1269
1269
  }
1270
1270
 
1271
- [data-v-835cd80b] {
1271
+ [data-v-6beef164] {
1272
1272
  font-family: 宋体;
1273
1273
  }
1274
- .button[data-v-835cd80b] {
1274
+ .button[data-v-6beef164] {
1275
1275
  padding: 5px 10px;
1276
1276
  border: none;
1277
1277
  background: var(--primary-color);
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();
@@ -13365,7 +13366,10 @@ class DrawHole extends Command {
13365
13366
  wall.position.z = 0.01;
13366
13367
  const {
13367
13368
  pageDestroy
13368
- } = createPage$2(this.domElement, this.editWidth.bind(this));
13369
+ } = createPage$2(this.domElement, async () => {
13370
+ await this.editWidth();
13371
+ holeLine.setLength(this.defaultWidth);
13372
+ });
13369
13373
  const lineSelector = new LineSelector(this.editor).setType("wall");
13370
13374
  lineSelector.onPointerMove = (line3, result) => {
13371
13375
  this.domElement.style.cursor = line3 ? "move" : "no-drop";
@@ -13392,7 +13396,8 @@ class DrawHole extends Command {
13392
13396
  wall.visible = true;
13393
13397
  this.dispatchEvent({
13394
13398
  type: "pointerMove",
13395
- point: result.point
13399
+ point: result.point,
13400
+ line: line3
13396
13401
  });
13397
13402
  };
13398
13403
  this.addCommandEndHandle().add(() => {
@@ -13408,6 +13413,7 @@ class DrawHole extends Command {
13408
13413
  if (lineSelector.paused) return;
13409
13414
  lineSelector.pause();
13410
13415
  await this.editWidth();
13416
+ holeLine.setLength(this.defaultWidth);
13411
13417
  lineSelector.resume();
13412
13418
  });
13413
13419
  const line2 = await lineSelector.getLines();
@@ -15360,7 +15366,7 @@ class VerticalCorrContinue extends Command {
15360
15366
  return data;
15361
15367
  }
15362
15368
  }
15363
- function buildDashedHelperLine$1(start, end, offset = 0.5) {
15369
+ function buildDashedHelperLine(start, end, offset = 0.5) {
15364
15370
  const offsetDistance = end.leftNormal(start).multiplyScalar(offset);
15365
15371
  const startOffPoint = start.clone().add(offsetDistance);
15366
15372
  const endOffPoint = end.clone().add(offsetDistance);
@@ -15407,7 +15413,7 @@ class RayDistance extends Command {
15407
15413
  points.sort((a, b) => point.distance(a) - point.distance(b)).forEach((p, i) => {
15408
15414
  const distance = point.distance(p) * 1e3;
15409
15415
  if (distance < 1e-3) return;
15410
- const points2 = buildDashedHelperLine$1(point, p, i * 0.3);
15416
+ const points2 = buildDashedHelperLine(point, p, i * 0.3);
15411
15417
  const auxiliaryLine = new Lines();
15412
15418
  auxiliaryLine.position.z = 6e-3;
15413
15419
  auxiliaryLine.material = new THREE.LineDashedMaterial({
@@ -15439,17 +15445,6 @@ class RayDistance extends Command {
15439
15445
  next();
15440
15446
  }
15441
15447
  }
15442
- function buildDashedHelperLine(start, end, offset = 0.5) {
15443
- const offsetDistance = end.leftNormal(start).multiplyScalar(offset);
15444
- const startOffPoint = start.clone().add(offsetDistance);
15445
- const endOffPoint = end.clone().add(offsetDistance);
15446
- return [
15447
- start,
15448
- startOffPoint,
15449
- endOffPoint,
15450
- end
15451
- ];
15452
- }
15453
15448
  class ManualDistance extends Command {
15454
15449
  static name = "ManualDistance";
15455
15450
  container = new THREE.Group();
@@ -15487,28 +15482,12 @@ class ManualDistance extends Command {
15487
15482
  * @param points
15488
15483
  */
15489
15484
  async ray(next, { point1, point2 }) {
15485
+ const lineAlignmentGuide = new LineAlignmentGuide();
15486
+ this.container.add(lineAlignmentGuide);
15487
+ lineAlignmentGuide.set(new LineSegment(point1, point2));
15490
15488
  this.renderer.createLineSegments([new LineSegment(point1, point2)], 0, { color: 65280 }, this.container);
15491
- const distance = point1.distance(point2) * 1e3;
15492
- const points = buildDashedHelperLine(point1, point2, 0.3);
15493
- const auxiliaryLine = new Lines();
15494
- auxiliaryLine.position.z = 6e-3;
15495
- auxiliaryLine.material = new THREE.LineDashedMaterial({
15496
- color: 16777215,
15497
- dashSize: 0.02,
15498
- gapSize: 0.02
15499
- });
15500
- auxiliaryLine.setPoint(...points.map((p) => new THREE.Vector3(p.x, p.y, 0)));
15501
- this.container.add(auxiliaryLine);
15502
- setTimeout(() => auxiliaryLine.computeLineDistances());
15503
- const text = this.renderer.createText(Number(distance.toFixed(0)) + "mm", points[1].clone().add(points[2]).multiplyScalar(0.5), {
15504
- background: "#333333",
15505
- padding: "0px",
15506
- borderRadius: "0px",
15507
- color: "#fff"
15508
- }, this.container);
15509
- this.addEventRecord("clear", () => {
15510
- auxiliaryLine.removeFromParent();
15511
- text.removeFromParent();
15489
+ this.addCommandEndHandle(() => {
15490
+ lineAlignmentGuide.removeFromParent();
15512
15491
  });
15513
15492
  await this.awaitOnlyKeys(["enter"]);
15514
15493
  next();
@@ -17217,18 +17196,18 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
17217
17196
  shortcut: ClippingLine.shortcutKeys.join(" + ")
17218
17197
  },
17219
17198
  {
17220
- command: RayDistance.commandName,
17221
- name: "射线测距",
17199
+ command: ManualDistance.commandName,
17200
+ name: "手动测距",
17222
17201
  show: true,
17223
17202
  src: images["../assets/images/激光测距.svg"].default,
17224
- shortcut: RayDistance.shortcutKeys.join(" + ")
17203
+ shortcut: ManualDistance.shortcutKeys.join(" + ")
17225
17204
  },
17226
17205
  {
17227
- command: ManualDistance.commandName,
17228
- name: "手动测距",
17206
+ command: RayDistance.commandName,
17207
+ name: "射线测距",
17229
17208
  show: true,
17230
17209
  src: images["../assets/images/激光测距.svg"].default,
17231
- shortcut: ManualDistance.shortcutKeys.join(" + ")
17210
+ shortcut: RayDistance.shortcutKeys.join(" + ")
17232
17211
  }
17233
17212
  ], otherCommandList = [
17234
17213
  {
@@ -17797,7 +17776,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
17797
17776
  };
17798
17777
  }
17799
17778
  });
17800
- const EditorToolContent = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-835cd80b"]]);
17779
+ const EditorToolContent = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-6beef164"]]);
17801
17780
  class StorageHelper {
17802
17781
  static get(key, defaultValue = void 0) {
17803
17782
  const value = localStorage.getItem(key);