build-dxf 0.1.130 → 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.
Files changed (2) hide show
  1. package/package.json +49 -50
  2. package/src/build.js +22 -15
package/package.json CHANGED
@@ -1,50 +1,49 @@
1
- {
2
- "name": "build-dxf",
3
- "version": "0.1.130",
4
- "description": "",
5
- "main": "./src/index.js",
6
- "types": "./src/index.d.ts",
7
- "scripts": {
8
- "test": "echo \"Error: no test specified\" && exit 1"
9
- },
10
- "exports": {
11
- ".": {
12
- "import": {
13
- "types": "./src/build.d.ts",
14
- "default": "./src/index.js",
15
- "style": "./src/index.css"
16
- },
17
- "require": {
18
- "types": "./src/build.d.ts",
19
- "default": "./src/index.js"
20
- }
21
- },
22
- "./RenderPlugin": {
23
- "import": {
24
- "types": "./src/utils/DxfSystem/plugin/RenderPlugin/index.d.ts",
25
- "default": "./src/index2.js"
26
- },
27
- "require": {
28
- "types": "./src/index.d.ts",
29
- "default": "./src/index2.js"
30
- }
31
- },
32
- "./index.css": "./src/index.css"
33
- },
34
- "style": "src/index.css",
35
- "dependencies": {
36
- "@tweenjs/tween.js": ">=25.0.0",
37
- "clipper-lib": ">=6.4.2",
38
- "dxf-writer": ">=1.18.4",
39
- "vue": ">=3.0.0",
40
- "canvas": "3.2.0",
41
- "three-mesh-bvh": "^0.6.6",
42
- "three-bvh-csg": ">=0.0.17",
43
- "three-csg-ts": ">=3.2.0",
44
- "three": ">=0.181.0",
45
- "node-three-gltf": "2.1.0"
46
- },
47
- "author": "夏过初秋",
48
- "license": "UNLICENSED"
49
- }
50
-
1
+ {
2
+ "name": "build-dxf",
3
+ "version": "0.1.133",
4
+ "description": "",
5
+ "main": "./src/index.js",
6
+ "types": "./src/index.d.ts",
7
+ "scripts": {
8
+ "test": "echo \"Error: no test specified\" && exit 1"
9
+ },
10
+ "exports": {
11
+ ".": {
12
+ "import": {
13
+ "types": "./src/build.d.ts",
14
+ "default": "./src/index.js",
15
+ "style": "./src/index.css"
16
+ },
17
+ "require": {
18
+ "types": "./src/build.d.ts",
19
+ "default": "./src/index.js"
20
+ }
21
+ },
22
+ "./RenderPlugin": {
23
+ "import": {
24
+ "types": "./src/utils/DxfSystem/plugin/RenderPlugin/index.d.ts",
25
+ "default": "./src/index2.js"
26
+ },
27
+ "require": {
28
+ "types": "./src/index.d.ts",
29
+ "default": "./src/index2.js"
30
+ }
31
+ },
32
+ "./index.css": "./src/index.css"
33
+ },
34
+ "style": "src/index.css",
35
+ "dependencies": {
36
+ "@tweenjs/tween.js": ">=25.0.0",
37
+ "clipper-lib": ">=6.4.2",
38
+ "dxf-writer": ">=1.18.4",
39
+ "vue": ">=3.0.0",
40
+ "canvas": "3.2.0",
41
+ "three-mesh-bvh": "^0.6.6",
42
+ "three-bvh-csg": ">=0.0.17",
43
+ "three-csg-ts": ">=3.2.0",
44
+ "three": ">=0.181.0",
45
+ "node-three-gltf": "2.1.0"
46
+ },
47
+ "author": "夏过初秋",
48
+ "license": "UNLICENSED"
49
+ }
package/src/build.js CHANGED
@@ -10545,24 +10545,29 @@ class ThreeVJiaPipeline extends Pipeline {
10545
10545
  console.warn(`第${i}个物品轮廓为空`);
10546
10546
  return;
10547
10547
  }
10548
- const itemPoly = new Polygon(
10548
+ let itemPoly = new Polygon(
10549
10549
  contour.map((p2) => Point.from(p2).rotate(json.center, json.angle))
10550
- ), center = itemPoly.getCenter(), index2 = roomPloys.findIndex((poly) => poly.pointWithin(center));
10550
+ );
10551
+ const center = itemPoly.getCenter(), index2 = roomPloys.findIndex((poly) => poly.pointWithin(center));
10551
10552
  if (index2 < 0) return;
10552
10553
  try {
10553
- const rect = itemPoly.getMinimumBoundingRectangle().map((p2) => p2.toJson2D());
10554
- json.placeHolders.push({
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
  }
@@ -22148,7 +22153,7 @@ class SceneAutoGenerat {
22148
22153
  await Promise.all(this.itemList.map(async (item) => await this.getModel(item)));
22149
22154
  }
22150
22155
  static itemParse(item) {
22151
- const contourData = item.contour ?? item.quadContour;
22156
+ const contourData = item.quadContour ?? item.contour;
22152
22157
  if (!Array.isArray(contourData) || !contourData.length) return null;
22153
22158
  const contour = Point.fromByList(contourData ?? []), rectangle = new Polygon(Qa(contour.map((p2) => [p2.x, p2.y])).map((p2) => Point.from(p2)));
22154
22159
  rectangle.pop();
@@ -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;