The OdBmInitialViewSettings class has a method that allows you to work with initial view settings, which are applied after opening a file. To set the initial view ID, use the setInitialViewId method. This method is available for use only with project files. The initial view ID value is retrieved during the first file rendering, so setting the value before the first rendering can be used for selecting a view to render. Here's an example for how to use the method:
OdBmUniqueElementsTrackingPtr pElemTracking = pDb->getAppInfo(OdBm::ManagerType::UniqueElementsTracking);
OdBmObjectId initialViewSettingsId = pElemTracking->getElementId(OdBm::UniqueElementType::InitialViewSettings);
OdBmInitialViewSettingsPtr pInitialViewSettings = initialViewSettingsId.safeOpenObject();
ODBM_TRANSACTION_BEGIN(t, pDb)
t.start();
if (eOk == pInitialViewSettings->setInitialViewId(viewId)) {
t.commit();
}
else {
pIO->putError(OD_T("Invalid handle"));
t.rollback();
}
ODBM_TRANSACTION_END();
For the full example, see the BmDocSetInitialViewCmd command in BimRv\Examples\TB_DevGuideCommands.