Reselect after ForceRebuild3

Hi all

I have written this function within a SWAddin. I need to rebuild the currently selected/active model and then continue with other actions. However, the ForceRebuild3 function deselects the model from the selectionmanager and the other actions can not find it again.

How do I reselect the model after the ForceRebuild3.

bool CadvSWAddin::RebuildModel(CString theCommand) { HRESULT hr; CString rebuildQuestion = _T("Do you want to rebuild the model before "); rebuildQuestion += theCommand; rebuildQuestion += _T("?"); int doRebuild = DisplayUserMessage(G_MessageTypeQuestion, rebuildQuestion, _T("")); if (doRebuild == Confirm_Yes) { IModelDoc2* pModelDoc = NULL; VARIANT_BOOL result;

hr = iSwApp->get_IActiveDoc2(&pModelDoc); if (hr != S_OK || pModelDoc == NULL) { return false; }

hr = pModelDoc->ForceRebuild3(VARIANT_FALSE, &result); if (hr != S_OK || result == VARIANT_FALSE) { return false; }

// Here I want to reselect the Model so it appears in the selection manager pModelDoc->???? }

return true; }

Thanks Stefan Olofsson

Reply to
Stefan Olofsson
Loading thread data ...

The only thing I can think of is to collect objects that are in the SelectionMgr before rebuild and then select them after the rebuild.

Reply to
That70sTick

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.