nested X-Ref

nested X-Ref

Anonymous
Not applicable
351 Views
2 Replies
Message 1 of 3

nested X-Ref

Anonymous
Not applicable
hi,

I ahve to traverse nested x ref drawing databases without opening x-ref drawings.

i am using following code to do so

AcDbDatabase *pCurDwg = new AcDbDatabase(Adesk::kFalse,Adesk::kTrue);

es = pCurDwg->readDwgFile(av_DwgName,_SH_DENYNO);
if(es == Acad::eOk)
{
AcDbBlockTablePointer bt(pCurDwg, AcDb::kForRead);
AcDbBlockTableIterator *it;
es =bt->newIterator(it);
if ( es== Acad::eOk )
{
for ( ; !it->done(); it->step() )
{ AcDbObjectId btrId;
it->getRecordId(btrId);
AcDbBlockTableRecordPointer btr(btrId, AcDb::kForRead);

bool data=false;
data=btr->isFromExternalReference();

if ( data==true )
{ pCurDwg = btr->xrefDatabase();
//Check for valid pointer // if(NULL != pCurDwg) {
//here i am not getting the x-ref drawing pointer i am getting NULL.

the method isFromExternalReference() returns TRUE but i am not getting pointer to that database.

can any one help me to solve this

thanks in advance.

santosh
0 Likes
352 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
santosh wrote: > hi, > > I ahve to traverse nested x ref drawing databases without opening x-ref drawings. > > i am using following code to do so > > AcDbDatabase *pCurDwg = new AcDbDatabase(Adesk::kFalse,Adesk::kTrue); > > es = pCurDwg->readDwgFile(av_DwgName,_SH_DENYNO); > if(es == Acad::eOk) > { > AcDbBlockTablePointer bt(pCurDwg, AcDb::kForRead); > AcDbBlockTableIterator *it; > es =bt->newIterator(it); > if ( es== Acad::eOk ) > { > for ( ; !it->done(); it->step() ) > { AcDbObjectId btrId; > it->getRecordId(btrId); > AcDbBlockTableRecordPointer btr(btrId, AcDb::kForRead); > > bool data=false; > data=btr->isFromExternalReference(); > > if ( data==true ) > { pCurDwg = btr->xrefDatabase(); > //Check for valid pointer // if(NULL != pCurDwg) { > //here i am not getting the x-ref drawing pointer i am getting NULL. > > the method isFromExternalReference() returns TRUE but i am not getting pointer to that database. > > can any one help me to solve this > > thanks in advance. > > santosh The news is not good unless you are running 2005. The following function will force the loading of the xref's- Acad::ErrorStatus acdbResolveCurrentXRefs(AcDbDatabase* pDB, bool, bool) -- Best regards, Byron Blattel CADwerx--Applications for AutoCAD Autodesk Registered Developer Contact Info @ http://www.cadwerx.net Custom Programming Services - ObjectARX/C++/MFC/ASP/STL/ATL/ISAPI...
0 Likes
Message 3 of 3

Anonymous
Not applicable
thanks Byron for your reply!

i am using ACAD2002.

can you please suggest some other method to do it with ACAD2002.

Thanks

Santosh
0 Likes