【问题标题】:Example of simple geometry creation in forge viewer angularForge viewer angular 中的简单几何创建示例
【发布时间】:2019-09-14 03:01:18
【问题描述】:

我在 Angular 7 中使用 ng2-adsk-forge-viewer 库在浏览器中显示 dmg 文件。我想在视图上创建自定义几何图形。

我创建了一个扩展并添加了这个方法。扩展运行正常,但出现错误

private addToScene() {
     const geom = new THREE.SphereGeometry(10, 8, 8);
     const material = new THREE.MeshBasicMaterial({ color: 0xff0000 });
     const sphereMesh = new THREE.Mesh(geom, material);
     sphereMesh.position.set(1, 2, 3);
     this.viewer.impl.createOverlayScene('custom-scene');
     this.viewer.impl.addOverlay('custom-scene', sphereMesh);
     this.viewer.impl.invalidate(true);
}

我收到此错误消息

three.js:35 THREE.Object3D.add:对象不是 THREE.Object3D 的实例。 Mesh {uuid: "1CA8B8ED-5370-45FE-B20C-BB6AF483716E", name: "", type: "Mesh", parent: null, children: Array(0), ...}

【问题讨论】:

    标签: angular forge


    【解决方案1】:

    经过这么多小时的调试,我找到了解决方案 我正在从“三个”导入三个,例如 import * as THREE。 将其更改为声明 const THREE: any working

    【讨论】:

      猜你喜欢
      • 2020-10-21
      • 2018-12-06
      • 2021-01-16
      • 2019-04-02
      • 2018-10-14
      • 2021-06-16
      • 2021-09-21
      • 2017-10-25
      • 2010-12-09
      相关资源
      最近更新 更多