Hi
I would like to set the ElementLineStyle (using standard linestyles 0-7) for a new level. It should be a quite simple task but I got some troubles.
LevelId lvlID = ISessionMgr::GetActiveDgnModelRefP()->GetFileLevelCacheP()->ComputeHighestUsedLevelId(); EditLevelHandle elh = ISessionMgr::GetActiveDgnModelRefP()->GetFileLevelCacheP()->CreateLevel(L"TestLayer", 555, lvlID + 1); LsEntryCP ls = LineStyleManager::ResolveLineStyle(3, ISessionMgr::GetActiveDgnModelRefP()->GetDgnFileP()); if (ls != NULL) { lifalib_dmsg("Name = %ls", ls->GetStyleName()); elh.SetByLevelLineStyle(*ls, NULL, *ISessionMgr::GetActiveDgnModelRefP()->GetDgnFileP()); } else lifalib_dmsg("NULL..."); ISessionMgr::GetActiveDgnModelRefP()->GetFileLevelCacheP()->Write();
My problem is that LineStyleManager::ResolveLineStyle returns NULL.
Is there another way to set the linestyle for a level ?
I've tried to use the MDL funktion mdlLevel_setElementStyle and it works just fine when working in a "normal" active design file, but some of our users often work in a model from a reference file that is "activated". In that case I have to store the fileLevelCache using:
ISessionMgr::GetActiveDgnModelRefP()->GetFileLevelCacheP()->Write();
Then I can set the linestyle for the level and it seems to work just fine, but the linestyle is not saved even though that I use
mdlLevelTable_rewrite(mdlModelRef_getActive());
and / or
Any ideas ?
Regards, Evan
Could you please try with following MDL function to set Line Style on Level element:MSCORE_EXPORT StatusInt mdlLevel_setElementSymbology(DgnModelRefP modelRefIn,LevelId levelIdIn,UInt* colorIn,int* styleIn,LineStyleParams* styleParamsIn,UInt* weightIn)
Hi Sagar
Thank you very much for your reply.
I've just tested it, but the result is the same as using mdlLevel_setElementStyle
What parameters are you passing in? Are you setting styleIn to a value between 0-7 before passing it to the function mdlLevel_setElementSymbology() ?
Can you provide a sample project wherein the said problem is reproducible?