AcDbAnnotativeObjectPE for AcDbMLeaderStyle doesnot work
I have function for make a new style (AcDbDimStyle, AcDbTextStyle, AcDbMLeaderStyle, etc.) Annotative
but for AcDbMLeaderStyle is "annotationTargetPE" in the next line NULL. In Acad it works.
AcDbAnnotativeObjectPE* annotationTargetPE = ACRX_PE_PTR(pObj, AcDbAnnotativeObjectPE);
Here is whole function:
bool CMajAnno::MakeAnnotative(AcDbObject* pObj, bool bAnnotative/* = true/, bool bFromStyle/ = false*/)
{
if (!pObj)
{
throw CMAJEX("Objekt je null");
}
if (!pObj->isWriteEnabled())
{
pObj->close();
throw CMAJEX("Objekt není otevřen pro zápis!!");
}
Acad::ErrorStatus es = Acad::eNotApplicable; AcDbAnnotativeObjectPE* annotationTargetPE = ACRX_PE_PTR(pObj, AcDbAnnotativeObjectPE); if (!annotationTargetPE) { pObj->close(); throw CMAJEX("Nepodařilo se otevřít AcDbAnnotativeObjectPE"); } else { if (annotationTargetPE->annotative(pObj) == bAnnotative) es = Acad::eOk; else { if (bFromStyle) { bool bUpdated; es = annotationTargetPE->setFromStyle(pObj, bUpdated); AcDbBlockReference* pBref = NULL; if (((es != Acad::eOk) || !bUpdated) && (pBref = AcDbBlockReference::cast(pObj))) es = MakeBrefAnnotativeLikeBlock(pBref, bUpdated); } else { es = annotationTargetPE->setAnnotative(pObj, true); } } } return (es == Acad::eOk);
}
0