My code to add a Dimension Style from a .dgnlib to the model is failing with a return code of 32768:
pDimStyle = DimensionStyle::GetByName(L"Architectural", StyleIteratorMode::ActiveFileOnly); wprintf(L"pDimStyle=%p, pDimStyle.IsValid()=%d, pDimStyle.IsNull()=%d\n", pDimStyle, pDimStyle.IsValid(), pDimStyle.IsNull()); if (!pDimStyle.IsValid() || pDimStyle.IsNull()) { // DimStyle NOT in current active file wprintf(L"Style [%s] NOT found in the file\n", L"Architectural"); pDimStyle = DimensionStyle::GetByName(L"Architectural", StyleIteratorMode::LibrariesOnly); if (pDimStyle.IsValid() && !pDimStyle.IsNull()) { // DimStyle FOUND in library. Save it to current file // add to local file iStatus = pDimStyle->Add(); // 32768=?? wprintf(L"pDimStyle->Add(), iStatus=%d\n", iStatus); } else { mdlDialog_openInfoBox(L"Error: Dimension Style Name Not Found."); return; } }
Not sure what's going on here. It seems I can CREATE a new Dimension Style and add it to the model.
Bruce
Bruce Reeves SRNS said:Not sure what's going on here if (!pDimStyle.IsValid() || pDimStyle.IsNull())
if (!pDimStyle.IsValid() || pDimStyle.IsNull())
Those methods of RefCountedBase do the same thing. They test whether the encapsulated pointer is nullptr.
RefCountedBase
nullptr
Regards, Jon Summers LA Solutions