Reputation: 33
In the Autodesk Forge Viewer, when getting the maxtrixWorld
property of an object that is a "Room", I have observed that the property is identical for each Room in the model, regardless of where the object is actually located in the model. This is not the case for any other objects in the model (they all have unique maxtrixWorld
properties that correspond to their location in the model).
I have retrieved the maxtrixWorld
data via multiple methods based on the fragment IDs that build the room objects, all resulting in the same outcome:
Get a THREE.Mesh object with a maxtrixWorld
property
const renderProxy = viewer.impl.getRenderProxy(viewer.model, fragId);
Get a THREE.Mesh object with a maxtrixWorld
property
const meshObj = fragList.getVizmesh(fragId);
Get the matrixWorld via fragList helper function getWorldMatrix()
const matrix = new THREE.Matrix4(); fragList.getWorldMatrix(fragId, matrix);
The Rooms do appear in the correct location in the model, which makes me think that they have a transformation baked into their geometry since their matrices are not determining their location in the model.
Is this a limitation of how Rooms are built in Revit or perhaps a result of the model translation process? Is there a way to retrieve the correct matrix information for these objects? The models are being processed via Forge with the generateMasterViews
flag set to true, which enables the room data to be generated.
Upvotes: 1
Views: 80
Reputation: 9942
I just tried getting the world transform of a couple of rooms in one of the official Revit samples (rac_advanced_sample_project.rvt), using the following code in the viewer:
function logWorldTransforms(viewer, dbid) {
let tree = viewer.model.getInstanceTree();
let frags = viewer.model.getFragmentList();
let mtx = new THREE.Matrix4();
tree.enumNodeFragments(dbid, function (fragid) {
frags.getWorldMatrix(fragid, mtx);
console.log(mtx.toArray());
}, true);
}
And you're right - no matter which room I tried, they all had the same matrix (in my case with a constant offset of (-140.60, 0.50, -17.48)
). When using the generateMasterViews
flag, the Model Derivative service most likely bakes the offsets into each room's geometry. With that said, you can still get the bounding box of each room, and that will give you a better indication of where the room is positioned.
If you believe this is a bug, please report it to forge (dot) help (at) autodesk (dot) com
.
Upvotes: 1