简体   繁体   中英

Autodesk Forge Viewer get local position of fragment

I'm working with Autodesk Viewer v7 trying to get position of fragments in a translated Revit .rvt file. Due to how Revit handles model position, I'm unable to extract the world position of fragments using fragProxy.getWorldMatrix(). So is there a way to get the position of fragment in a translated Revit model? Or if not possible, a way to get local position of the fragment? Thank you very much.

As explained in the other thread : if the fragments in your Forge model have the position baked into their vertices (in other words, if each fragment's transform is an identity matrix), you could try computing an "approximate" position of each fragment in the world coordinate system by computing the fragment's bounding box, and then retrieving its center point:

function getApproximatePosition(model, fragid) {
    const frags = model.getFragmentList();
    let bbox = new THREE.Box3();
    frags.getWorldBounds(fragid, bbox);
    return bbox.center();
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM