Reselect after ForceRebuild3

  • Thread starter Thread starter Stefan Olofsson
  • Start date Start date
S

Stefan Olofsson

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
 
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.
 
Back
Top