然而,我正在尝试创建类似于autodesk (https://forge-rcdb.autodesk.io/configurator?id=58adee163e6f342cf1e92dae)的IoT演示,而不是知道每个传感器的坐标,而是尝试使用资产的dbId来确定位置。即使使用了不同的例子,我似乎也不能正确地对齐覆盖图。这一点似乎与我所作的选择不符。红点是覆盖图,我从中获得位置的资源处于选中状态。
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';
});
}
发布于 2019-01-12 07:58:41
你可以阅读这篇博文,了解如何添加"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
假设你想在一张桌子的边缘得到一个x,y,z点。使用鼠标,按住ALT键并单击桌子的边缘...这将设置一个绿色轴心点。现在使用下面的代码来检索x,y,z点。
NOP_VIEWER.getCamera().pivot;
如果有帮助,请告诉我。为迈克尔干杯
https://stackoverflow.com/questions/54150253
复制相似问题