IndexedViewportP viewPort = IViewManager::GetActiveViewSet().GetSelectedViewport(); if (viewPort == nullptr) { return false; } DgnFileP dgnFile = viewPort->GetRootModel()->GetDgnFileP(); DisplayStyleCP pDisStyle = DisplayStyleManager::FindDisplayStyleByName(L"Smooth", dgnFile); if (!pDisStyle) { return false; } int iIndex = pDisStyle->GetIndex(); ElementId eleId = 968; MSElement ele; mdlAssoc_getElement(&ele, nullptr, eleId, ACTIVEMODEL); if (SUCCESS != mdlElement_setDisplayStyle(&ele, iIndex)) { return false; } MSElementDescrP pEleDescr; mdlAssoc_getElementDescr(&pEleDescr, nullptr, eleId, ACTIVEMODEL, true); UInt32 posOld = elementRef_getFilePos(pEleDescr->h.elementRef); UInt32 posNew = mdlElmdscr_rewrite(pEleDescr, NULL, posOld); if (posOld != posNew) { return false; } return true;