Пример из библиотеки samples\database\xrecord_dg
void createXrecord()
{
Acad::ErrorStatus es;
AcDbObjectId DictId, xrecObjId;
AcDbDictionary *pDict;
AcDbDictionaryPointer pNamedobj(acdbHostApplicationServices()->workingDatabase()->
namedObjectsDictionaryId(), AcDb::kForWrite);
if ((es = pNamedobj.openStatus()) != Acad::eOk) {
acutPrintf(_T("\nError open namedObjectsDictionary: %s"), acadErrorStatusText(es));
return;
}
if ((es = pNamedobj->getAt(_T("ASDK_DICT"), DictId)) == Acad::eKeyNotFound)
{
pDict = new AcDbDictionary;
if ((es = pNamedobj->setAt(_T("ASDK_DICT"), pDict, DictId)) != Acad::eOk)
{ acutPrintf(_T("\nError pNamedobj->setAt(): %s"), acadErrorStatusText(es));
return; }
}
else if (es != Acad::eOk)
{ acutPrintf(_T("\nError pNamedobj->getAt(): %s"), acadErrorStatusText(es));
return; }
AcDbXrecord *pXrec = new AcDbXrecord;
if ((es = pDict->setAt(_T("XREC1"), pXrec, xrecObjId)) != Acad::eOk) {
acutPrintf(_T("\nError pDict->getAt(): %s"), acadErrorStatusText(es));
return;
}
pDict->close();
// Create a resbuf list to add to the xrecord.
struct resbuf *pHead;
ads_point testpt = {1.0, 2.0, 0.0};
pHead = acutBuildList(AcDb::kDxfText,
_T("This is a test Xrecord list"),
AcDb::kDxfXCoord, testpt,
AcDb::kDxfReal, 3.14159,
AcDb::kDxfAngle, 3.14159,
AcDb::kDxfColor, 1,
AcDb::kDxfInt16, 180,
0);
pXrec->setFromRbChain(*pHead);
acutRelRb(pHead);
pXrec->close();
}
void getXrecord()
{
Acad::ErrorStatus es;
AcDbDictionaryPointer pNamedobj(acdbHostApplicationServices()->workingDatabase()
->namedObjectsDictionaryId(), AcDb::kForRead);
if ((es = pNamedobj.openStatus()) != Acad::eOk) {
acutPrintf(_T("\nError open namedObjectsDictionary: %s"),acadErrorStatusText(es));
return;
}
AcDbDictionary *pDict;
if ((es = pNamedobj->getAt(_T("ASDK_DICT"), (AcDbObject*&)pDict,
AcDb::kForRead)) != Acad::eOk)
{ acutPrintf(_T("\nError pNamedobj->getAt(): %s"),acadErrorStatusText(es));
pNamedobj->close();
return; }
AcDbXrecord *pXrec;
if ((es = pDict->getAt(_T("XREC1"), (AcDbObject*&) pXrec, AcDb::kForRead)) != Acad::eOk)
{ acutPrintf(_T("\nError pDict->getAt(): %s"), acadErrorStatusText(es));
pDict->close();
return; }
pDict->close();
struct resbuf *pRbList;
pXrec->rbChain(&pRbList);
pXrec->close();
printList(pRbList);
acutRelRb(pRbList);
}
ну и eraseXrecord указанная выше...
специально проверял, eraseXrecord выдает eWasOpenForWrite....