Message 1 of 4
Help, AcDbSortentsTable Class is not working properly in ObjectARX 2019
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
hello all:
For INSERT(AcDbBlockTableRecord), non-Model_Space or Paper_Space
AcDbSortentsTable Class is not working properly in ObjectARX 2019.
The following code is the entity or selection set , according to the blocktable space belonging to draworder(moveBottom) operation, the code is normal in AUTOCAD 2004-2018, but no effect in 2019.
es = pSt->moveToBottom(ids );
The return value of es is eOk,
Ask for help.
thanks.
int moveToBottom()
{
resbuf *rb = ads_getargs();
if (!rb)
return RSRSLT;
AcDbObjectIdArray ids, ids1;
AcDbObjectId id;
Acad::ErrorStatus es;
int i = 0;
AcDbObjectId ownerId;
while (rb) {
if (rb->restype == RTENAME) {
if (acdbGetObjectId(id, rb->resval.rlname) == eOk)
{
if (!i)
{
AcDbEntity *pEnt;
es = acdbOpenObject(pEnt, id, kForRead);
if (es == eOk)
{
ownerId = pEnt->ownerId();
pEnt->close();
}
else
return RSRSLT;
}
i = 1;
ids.append(id);
}
}
else if (rb->restype == RTPICKS) {
es = XdDbUtils::getIdArrayFromPickSet(rb->resval.rlname, ids1);
if (es != Acad::eOk) {
rb = rb->rbnext;
continue;
}
if (!i)
{
AcDbEntity *pEnt;
es = acdbOpenObject(pEnt, ids1[0], kForRead);
if (es == eOk)
{
ownerId = pEnt->ownerId();
pEnt->close();
}
else
return RSRSLT;
}
i = 1;
ids.append(ids1);
}
rb = rb->rbnext;
}
if (ids.isEmpty())
return RSRSLT;
AcDbSortentsTable *pSt=NULL;
AcDbBlockTableRecord *pRec;
if (Acad::eOk != acdbOpenObject(pRec, ownerId, AcDb::kForRead))
return RSRSLT;
AcDbObjectId ext_id = pRec->extensionDictionary();
if (AcDbObjectId::kNull == ext_id)
{
if (Acad::eOk != pRec->upgradeOpen())
{
pRec->close();
return RSRSLT;
}
pRec->createExtensionDictionary();
ext_id = pRec->extensionDictionary();
if (AcDbObjectId::kNull == ext_id)
{
pRec->close();
return RSRSLT;
}
}
pRec->close();
AcDbDictionary *pExt;
Acad::ErrorStatus es = acdbOpenObject(pExt, ext_id, AcDb::kForRead);
if (Acad::eOk != es)
return RSRSLT;
AcDbObject *pObj;
if (Acad::eOk != pExt->getAt(_T("ACAD_SORTENTS"), pObj, AcDb::kForWrite))
{
if (Acad::eOk != pExt->upgradeOpen())
{
pExt->close();
return RSRSLT;
}
pSt = new AcDbSortentsTable;
if (NULL == pSt)
{
pExt->close();
return NULL;
}
AcDbObjectId new_id;
if (Acad::eOk != pExt->setAt(_T("ACAD_SORTENTS"), pSt, new_id))
{
delete pSt;
pExt->close();
return NULL;
}
}
else {
pSt = (AcDbSortentsTable *)pObj;
}
pExt->close();
pSt->setBlockId(ownerId);
es = pSt->moveToBottom(ids);
pSt->close();
acedUpdateDisplay();
ads_rett();
return RSRSLT;
}