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

Not able to read the region in autocad drawing

5 REPLIES 5
Reply
Message 1 of 6
chockalingam
528 Views, 5 Replies

Not able to read the region in autocad drawing

Hi,

 

I am trying to read the "region" in autocad drawing using realdwg, but i am getting the following error in reading the entity

 

"Access violation reading location 0xfcaf8008."

 

 

Code Used

*********************************************************************************************************************************************

int DWGMgr::eraseLayer()
{
AcDbBlockTable *pBlockTable;
if(Acad::eOk != m_pCurrentDatabase->getSymbolTable(pBlockTable, AcDb::kForRead))
{
return NS_FAIL;
}
AcDbBlockTableRecord *pBlockTableRecord;
if(Acad::eOk != pBlockTable->getAt(ACDB_MODEL_SPACE, pBlockTableRecord,AcDb::kForRead))
{
pBlockTable->close();
return NS_FAIL;
}
pBlockTable->close();
AcDbBlockTableRecordIterator *pBlkTblRcdItr;
pBlockTableRecord->newIterator(pBlkTblRcdItr);

AcDbObjectId pObjId;
for(pBlkTblRcdItr->start(); !pBlkTblRcdItr->done();pBlkTblRcdItr->step())
{
AcDbEntity* pEnt = NULL;
AcDbObject* ppObj = NULL;
Acad::ErrorStatus es ;
es = pBlkTblRcdItr->getEntityId(pObjId);

es = pBlkTblRcdItr->getEntity(pEnt,AcDb::kForWrite);
if(pEnt == NULL)
continue;
TCHAR* pszLayerName = pEnt->layer();
if(NSSTRCMP(pszLayerName, _T("ERRORS")) == 0)
{
pEnt->erase(true);
}

pEnt->close();
}
pBlockTableRecord->close();
delete pBlkTblRcdItr;
return NS_SUCCESS;
}

*********************************************************************************************************************************************

5 REPLIES 5
Message 2 of 6
owenwengerd
in reply to: chockalingam

I don't understand your question. Does the displayed code cause an access violation? If so, which line of code?

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

I am getting the error when opening "region" for write

 

es = pBlkTblRcdItr->getEntity(pEnt,AcDb::kForWrite);

 

 

Thanks

Chockalingam

Message 4 of 6
owenwengerd
in reply to: chockalingam

I guess you mean "AcDbRegion"? How do you know it's an AcDbRegion if the attempt to open fails? If you break on that exception, what is the call stack?

--
Owen Wengerd
ManuSoft
Message 5 of 6
chockalingam
in reply to: chockalingam

Yes i am mentioning about "AcDbRegion"

 

If i remove the "AcDbRegion" from my drawing then no error found, everything works fine

 

In the output window i get the following message

*********************************************************************************************************************************************

Object dump complete.
AcDb.dll Terminating!
acfirst.dll Terminating!
First-chance exception at 0x786836e3 in CADLoader.exe: 0xC0000005: Access violation reading location 0xfcba5b80.
Unhandled exception at 0x771515de in CADLoader.exe: 0xC0000005: Access violation reading location 0xfcba5b80.

*********************************************************************************************************************************************

Message 6 of 6
owenwengerd
in reply to: chockalingam

You need to break on the exception and get the stack trace at the point of the exception.

--
Owen Wengerd
ManuSoft

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

Post to forums  

Autodesk Design & Make Report

”Boost