build-dxf 0.1.1 → 0.1.2

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.1",
3
+ "version": "0.1.2",
4
4
  "description": "线段构建双线墙壁的dxf版本",
5
5
  "main": "./src/index.js",
6
6
  "types": "./src/index.d.ts",
package/src/build.js CHANGED
@@ -13705,7 +13705,10 @@ class LoadModel {
13705
13705
  if (this._cache.has(name)) return this._cache.get(name);
13706
13706
  const promise = new Promise(async (resolve) => {
13707
13707
  const response = await fetch(`${VITE_OSS_BASEURL}models/${name}.glb`);
13708
- if (!response.ok) throw new Error(`下载失败: ${response.status}`);
13708
+ if (!response.ok) {
13709
+ resolve(null);
13710
+ return;
13711
+ }
13709
13712
  const arrayBuffer = await response.arrayBuffer();
13710
13713
  const gltf = await new Promise((resolve2, reject) => {
13711
13714
  loader.parse(arrayBuffer, "", resolve2, reject);
@@ -14225,6 +14228,7 @@ class SceneAutoGenerat {
14225
14228
  const min = rectangle.getMinLengthInfo();
14226
14229
  const center = Box2.fromByPoints(...rectangle).center;
14227
14230
  LoadModel.loadGlb(item.category)?.then((model) => {
14231
+ if (!model) return;
14228
14232
  model = model.clone(true);
14229
14233
  model.rotateX(Math.PI * 0.5);
14230
14234
  model.traverse((mesh) => {
@@ -3,5 +3,5 @@ export declare class LoadModel {
3
3
  private static _cache;
4
4
  private static _nameMap;
5
5
  static addNameMap(mapName: string, name: string): void;
6
- static loadGlb(name: string): Promise<Group<import('three').Object3DEventMap>> | undefined;
6
+ static loadGlb(name: string): Promise<Group<import('three').Object3DEventMap> | null> | undefined;
7
7
  }