Hi everybody,
In Microstation V8i, we used to use "mdlLevel_setDisplay()" to turn on or off level in reference files.
Now, on Connect Edition, it seems that theses functions don't work.
We tried this
DgnModelP pRefModel = dgnRefAttachP-> GetDgnModelP(); FileLevelCache& fileLevelCache = pRefModel->GetDgnFileP()->GetLevelCacheR(); for (EditLevelHandle level(fileLevelCache.begin()); level != fileLevelCache.end(); ++level) { WString nomNiveau; level.GetDisplayName(nomNiveau); bool flagAff = false; if (nomNiveau.CompareTo(DEF_NIVEAU_PTRL_MASQ) == 0 || nomNiveau.CompareTo(DEF_NIVEAU_PTRL_TRAITE) == 0) { flagAff = false; } else { flagAff = true; } level.SetDisplay(flagAff); } fileLevelCache.Write();
We tried this but it doesn't work on a reference file, our code is ok on the active file.
Can you help me?
Hervé
Hi hervecuzon,
A colleague Yongan.Fu provided a code snip (below for convenience) showing how to turn off all levels in the 1st Attachment's 1st View and effectively replace calls to mdlLevel_setDisplay(); Please give something similar to this a try to see if it helps resolve your issue.
void listReference(WCharCP unparsed) { DgnModelP pActiveModel = ISessionMgr::GetActiveDgnModelP(); DgnAttachmentArrayP pAttachArray = pActiveModel->GetDgnAttachmentsP(); if (NULL == pAttachArray) { mdlDialog_dmsgsPrint(L"No Attached Reference"); return; } for (DgnAttachmentP pAttach : *pAttachArray) { mdlDialog_dmsgsPrint(pAttach->GetAttachFileName().GetWCharCP()); BitMaskCP lvlMask = mdlView_getLevelDisplayMask(pAttach, 0, ViewLevelDisplayType::Normal); BitMaskP newLvlMask = mdlBitMask_clone(lvlMask); mdlBitMask_setAll(newLvlMask, FALSE); mdlView_setLevelDisplayMask(pAttach, 0, newLvlMask, TRUE); mdlBitMask_free(&newLvlMask); pAttach->Rewrite(true, true); } }
HTH,Bob
Thanks Bob,
Finally, we found a solution with the "old" mdl function
mdlLevel_setDisplay(dgnRefAttachP, IdNiveau, false); for (int i = 0; i < MAX_VIEWS; ++i) { if(mdlView_isActive(i)) mdlView_setLevelDisplay(dgnRefAttachP, i, IdNiveau, false); }
With using the both functions mdllevel_setDisply and mdlView_setlevelDisplay it works fine.
Thanks for your help
Answer Verified By: Robert Hook