基于 dbID 创建传感器覆盖的问题

Issue with creating sensor overlay based on dbIDs

我正在尝试创建与 Autodesk 的 IoT 演示类似的东西 (https://forge-rcdb.autodesk.io/configurator?id=58adee163e6f342cf1e92dae) 但是,我并没有知道每个传感器的坐标,而是试图使用资产的 dbId 来确定位置。即使使用不同的示例,我似乎也无法正确对齐叠加层。该点似乎与我所做的选择不符。红点是叠加层,选择了我从中获得位置的资产。

example image

public createPoint() {
  const viewer = this.viewer;

  viewer.model.getData().instanceTree.enumNodeFragments(4295, (frag) => {
    const renderProxy = viewer.impl.getRenderProxy(viewer.model, frag);

    const position = new THREE.Vector3();
    position.setFromMatrixPosition( renderProxy.matrixWorld );

    const worldToClient = viewer.worldToClient(position);

    const element = <HTMLElement>document.getElementsByClassName('bimSensorNode-1')[0];
    element.style.top = worldToClient.y + 'px';
    element.style.left = worldToClient.x + 'px';

  });
}

您可以关注此博客 post,了解如何添加“3d-markup-icons-and-info-card”:

https://forge.autodesk.com/blog/3d-markup-icons-and-info-card

它在 GitHub 上有源代码,还有一种帮助技术可以在此处廉价地识别精确的 x、y、z 点:

https://github.com/wallabyway/markupExt/issues/2

假设您想要在 table 的边缘获得一个 x,y,z 点。使用鼠标,按住 ALT 键并单击 table 的边缘...这将设置一个绿色轴心点。现在使用此代码检索 x、y、z 点...

NOP_VIEWER.getCamera().pivot;

如果有帮助请告诉我。 干杯 迈克尔