My goal is to find the nearest Room of a given position, but my models are linked models/ federated or aggregated model, I don't know the correct name, but they're models which have 2 or more linked revit models in it, but const info = new Autodesk.DataVisualization.Core.ModelStructureInfo(model); const levelRoomsMap = await info.getLevelRoomsMap(); only works in each model separately, not in the main federated one, if you know how to solve this, please help.
I'm trying to see if with the aggregated view this Rooms appear in the main model, but I'm using MultiViewerFactory to initialize the viewer, and don't know how to mix them, what I've tried:
function auxinitViewer(factory, aggV, container, config = {}) {
const viewer = factory.createViewer(
container,
config,
aggV // HERE WAS Autodesk.Viewing.GuiViewer3D
);
viewer.start();
viewer.setTheme("light-theme");
return viewer;
}
export function initViewer(container) {
return new Promise(function (resolve, reject) {
Autodesk.Viewing.Initializer(
{
// OPTIONS
},
function () {
let aggV = new Autodesk.Viewing.AggregatedView();
window.factory = new Autodesk.Viewing.MultiViewerFactory();
window.viewer1 = auxinitViewer(window.factory, aggV, container, {
extensions: [
// ...
],
});
resolve(window.viewer1);
}
);
});
}
So if you know how to solve this problem at all or how to mix MultiViewerFactory and AggregatedView in viewer initialization please take a note.
Unfortunately, loading multiple models in the viewer or AggregatedView won't create a federated model object. Instead, the viewer creates a model object for each loaded model. We see all loaded models using
AggregatedView.viewer.getAllModels(). Therefore, you must createModelStructureInfofor each model loaded in the viewer.Here is a code snippet of using
MultiViewerFactory, but I'm afraid that might not fit your needs.To load rooms and aggregate it with the main model in one single APS viewer instance, we can do the following: