【问题标题】:Transforming coordinates from Revit to Viewer将坐标从 Revit 转换为 Viewer
【发布时间】:2019-08-03 16:52:08
【问题描述】:

我想在查看器中放置一些 three.js 对象,在 Revit 模型中具有该对象的估计坐标。如何将这些坐标转换为查看器坐标以放置对象?

【问题讨论】:

    标签: javascript autodesk-forge autodesk-viewer autodesk-model-derivative


    【解决方案1】:

    由于 Forge 查看器默认会对加载的模型应用全局偏移以避免坐标浮动问题,因此您必须从 Revit 空间中您拥有的 three.js 对象的坐标中减去它。

    // To obtain the global offset
    const globalOffset = viewer.model.getData().globalOffset;
    
    const ptInRvt = new THREE.Vector3( 10, 5 ,0 );
    
    // Apply the offset
    const offsetPt = ptInRvt.clone().sub( globalOffset );
    

    如果有某些原因,您的全局偏移量为零。您也可以使用放置偏移量来偏移它

    // placement offset
    const offsetMatrix = viewer.model.getData().placementWithOffset;
    
    const ptInRvt = new THREE.Vector3( 10, 5 ,0 );
    
    const offsetPt = ptInRvt.applyMatrix4( offsetMatrix );
    

    希望对你有帮助。

    【讨论】:

    • 工作正常!谢谢
    猜你喜欢
    • 1970-01-01
    • 2017-03-08
    • 2018-05-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-21
    • 1970-01-01
    • 2016-09-28
    相关资源
    最近更新 更多