ObjectARX
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

appenAcDbEntity() cause INTERNAL ERROR !dbobji.cpp@387

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
kulist
1594 Views, 2 Replies

appenAcDbEntity() cause INTERNAL ERROR !dbobji.cpp@387

Hi!

 

I've just met an internal error in objectARX when I create a BTR and append entities to it. The BT successfully opened, BTR created, and AcDbLine entity is appended to the record, however when I want to append a "Revision Cloud" also to the BTR I get the INTERNAL ERROR !dbobji.cpp@387 message.

 

The revision cloud is created with acedCommand(RTSTR, L"_REVCLOUD", RTNONE); in a ON_CLICK event handle function. After the cloud is created I start to create the Block. I use acdbEntLast() function to get its ads_name, it's successfully got. After I can get the ObjectId from it without difficulty, and here I Open the entity as AcDbPolyline().

 

I can get its startPoint, change its Layer, but when I try to append it to the BlockReference all hope is gone:)

 

More attribute is also appeneded to the block without any problem.

 

I'm waiting for any suggestion, thank you.

 

Some code pieces:

BeginEditorCommand();

 

// Base point of Revision Cloud
bool bLoop = true;

acedInitDialog(true);
acedCommand(RTSTR, L"_REVCLOUD", RTNONE);
    
while(bLoop)
{
        resbuf rb;

        acedGetVar(L"cmdnames", &rb);
        if(_tcsstr(_tcsupr(rb.resval.rstring), L"REVCLOUD") != NULL)
        {
            acedCommand(RTSTR, PAUSE, RTNONE);
        }
        else
        {
            bLoop = false;
        }
        free(rb.resval.rstring);
}
CompleteEditorCommand(FALSE);

 

// Create BlockRecord

AcDbBlockTableRecord *pBlockRecord = new AcDbBlockTableRecord;

pBlockRecord->setName(Name.c_str());
pBlockRecord->setOrigin(AcGePoint3d(0, 0, 0));

if((acErr = pBlockTable->add(pBlockRecord)) != Acad::eOk)
{
        delete pBlockRecord;
        pBlockTable->close();

        return acErr;
}

pBlockTable->close();

 

// Get Entity

ads_name nmWolke;
if(acdbEntLast(nmWolke) != RTNORM)
{
        ...
        return (Acad::eInvalidAdsName);
}

 

// Open Entity

AcDbPolyline *pWolke = new AcDbPolyline();
if((acErr = acdbOpenAcDbEntity((AcDbEntity *&)pWolke, eId, AcDb::kForWrite)) != Acad::eOk)
{
        delete pWolke;
        ...
        return acErr;
}

 

// Append

if((acErr = pBlockRecord->appendAcDbEntity(pWolke)) != Acad::eOk) // This is the BADGUY
{
        delete pWolke;
        ....
        return acErr;
}

2 REPLIES 2
Message 2 of 3
owenwengerd
in reply to: kulist

Your entity is already in the database, so it already belongs to a BTR. Instead of appendEntity(), you need to call AcDbBlockTableRecord::assumeOwnershipOf().

--
Owen Wengerd
ManuSoft
Message 3 of 3
kulist
in reply to: owenwengerd

Thank you owenwengerd! The solution is so obvious as I read, but sure would have taken a lot of time to figure it out by my own. Thank you again;

Regards, István

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost