Replies: 1 comment
-
You can try out the following code, it work for me. const vp = IModelApp.viewManager.selectedView;
// open a different imodel
const otherIModel = await BriefcaseConnection.openFile({fileName, readonly});
// load the target model to display
const modelProps = await otherIModel.models.queryProps({from: "BisCore.GeometricModel3d"});
const modelId = modelProps[0].id;
await otherIModel.models.load(modelId);
// create a ViewState
const viewCreator = new ViewCreator3d(otherIModel);
const defaultView = await viewCreator.createDefaultView({}, [modelId]);
// can setup the transformation of the model
defaultView.modelDisplayTransformProvider = {
getModelDisplayTransform(modelId) {
return { transform };
}
};
// add it to viewport
const treeRef = createPrimaryTileTreeReference(defaultView, otherIModel.models.getLoaded(modelId) as GeometricModelState);
vp.addTiledGraphicsProvider({
forEachTileTreeRef: (_vp, func) => func(treeRef)
});
// find the right time to close the other imodel
vp.iModel.onClose.addListener(() => otherIModel.close()); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I want to load multiple .bim models into a single view,I would greatly appreciate it if you have any good suggestions.
Beta Was this translation helpful? Give feedback.
All reactions