I am working on platform that links the data between our local databases and the 3d model ( using Autodesk forge bim360 to viewer the models and retrieves the metadata of each obj in the 3d model), all good if the model is .rvt
.
But, when it comes to IFC files all the methods I was using it fails. I couldn't find anything in the forge docs.
I am using the methods below to get all the need data from the Revit Model .rvt
export const findLeafNodes = (model: Autodesk.Viewing.GuiViewer3D | undefined) => {
if (!model) return;
return new Promise(function (resolve, reject) {
model.getObjectTree(function (tree: any) {
let leaves: number[] = [];
tree.enumNodeChildren(
tree.getRootId(),
function (dbId: any) {
if (tree.getChildCount(dbId) === 0) {
leaves.push(dbId);
}
},
true
);
resolve(leaves);
}, reject);
});
};
export const getProps = (
model: Autodesk.Viewing.GuiViewer3D,
ids: number[]
) => {
if (!model) return;
return new Promise((resolve, rejects) => {
try {
model.model.getBulkProperties2(
ids,
{},
(result) => {
resolve(result);
},
(err) => {
rejects(err);
}
);
} catch (error) {
console.log(error);
}
});
};