Reputation: 1
I am currently working with a Navisworks file which is a composition of at least .dwg and .rvt (I don't have original files). I want to be able to list existing declared rooms and room volumes on .nwd file and if possible their data all this processing file on FORGE. Something similar to activating "Master view" for REVIT files on FORGE to extract room volumes.
Upvotes: 0
Views: 737
Reputation: 7070
The generateMasterView option only works for RVT, unfortunately.
For Navisworks files (NWD/NWC), it requires enabling the Convert Room Geometry
in the Navisworks options. Otherwise, the converted NWD/NWC from RVT won't have Revit Room data. See Navisworks manual here.
So, firstly, I would advise you to check if you can see Rooms
on Forge Viewer's Model Structure panel like this snapshot when opening your navisworks file with Forge Viewer after translating it to SVF.
If rooms are there, congratulation! We can rebuild the room data from model properties and bounding boxes. On the contrary, you cannot see the Rooms
node, you must go back to ask the owner of your Navisworks files to enable the Convert Room Geometry
in the Navisworks option, redo the export RVT -> NWC, and link DWG.
Here is the code snippet for rebuilding the room data from model properties and bounding boxes. For details, please check https://forge.autodesk.com/blog/add-data-visualization-heatmaps-rooms-non-revit-model-part-i-nwc
async function getBoxAsync(dbId, model) {
return new Promise((resolve, reject) => {
const tree = model.getInstanceTree();
const frags = model.getFragmentList();
tree.enumNodeFragments(dbId, function(fragid) {
let bounds = new THREE.Box3();
frags.getWorldBounds(fragid, bounds);
return resolve(bounds);
}, true);
});
}
function getLevel(box, floors) {
const currentElevation = box.min.z;
if (currentElevation < floors[0].zMin) {
return floors[0];
} else if (currentElevation > floors[floors.length - 1].zMax) {
return floors[floors.length - 1];
} else {
return floors.find(f => f.zMin <= currentElevation && f.zMax >= currentElevation );
}
}
async function getPropAsync(dbId, model) {
return new Promise((resolve, reject) => {
model.getProperties(dbId, result => resolve(result));
});
}
function getRoomName(dbId, model) {
const tree = model.getInstanceTree();
return tree.getNodeName( dbId );
}
async function getRoomDbIds(model) {
return new Promise((resolve, reject) => {
model.search( 'Rooms', resolve, reject, ['Category'])
});
}
const dataVizExtn = await viewer.loadExtension('Autodesk.DataVisualization');
const model = viewer.model;
const levelExt = await viewer.loadExtension('Autodesk.AEC.LevelsExtension');
const floors = levelExt.floorSelector.floorData;
const dbIds = await getRoomDbIds(model);
for ( let i = dbIds.length - 1; i >= 0; i-- ) {
const dbId = dbIds[i];
const box = await getBoxAsync(dbId, model);
const level = getLevel(box, floors);
const name = getRoomName(dbId, model);
// Do your tasks here
}
To calculate Room's volume, you may check out this blog to calculate it from mesh data.
https://forge.autodesk.com/blog/get-volume-and-surface-area-viewer
Upvotes: 0