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

wblockCloneObjects draworder

3 REPLIES 3
Reply
Message 1 of 4
mgriesser
536 Views, 3 Replies

wblockCloneObjects draworder

Hello!

 

I am using wblockCloneObjects to load a certain block from an external dwg. The block consists of a hatch and some lines. In the external dwg it looks like this:

1.png  The lines are on top of the hatch.

 

After inserting it to the current dwg, the block looks like this:

 2.png

 

The hatch is now on top of the lines. Is this a know side-effect of wblockCloneObjects?

 

 

Regards

Markus

3 REPLIES 3
Message 2 of 4
owenwengerd
in reply to: mgriesser

Are you cloning the AcDbBlockTableRecord object? if so, I would expect the draworder information to get cloned as well. On the other hand, if you clone only the entities owned by the block table record, then I would expect the results you show.

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


@owenwengerd wrote:

Are you cloning the AcDbBlockTableRecord object?


 

Yes. I search the block in the external blocktable, and pass its id wblockCloneObjects.

 

Message 4 of 4
Balaji_Ram
in reply to: mgriesser

Hi Markus,

 

I tried to reproduce this behavior but it seems to be working ok on AutoCAD 2011.

Here is the code snippet and the drawing that I am using to test.

 

To try this :

1) copy the attached Test.dwg to c:\Temp

2) Run the command to clone the "Test1" and "Test2" blocks from Test.dwg to the current drawing

3) Insert "Test1" and "Test2" blocks

 

Test1 and Test2 have different draw orders for the hatch and a circle which are being cloned correctly.

 

Acad::ErrorStatus es;
TCHAR fullpath[_MAX_PATH];

int ret = acedFindFile( ACRX_T("C:\\Temp\\Test.dwg"), fullpath );
if ( ret != RTNORM )
	  return;

AcDbDatabase *pSrcDb = new AcDbDatabase( false, false );
es = pSrcDb->readDwgFile( fullpath, _SH_DENYNO );
if ( es != Acad::eOk )
{
	  acutPrintf( _T("\nCan not open file.") );
	  delete pSrcDb;
	  return;
}

AcApDocument *pActiveDoc = acDocManager->mdiActiveDocument();
AcDbDatabase *pDestDb    = pActiveDoc->database();

AcDbObjectIdArray objIds2Copy;
AcDbBlockTable *pBlockTable;

es = pSrcDb->getSymbolTable(pBlockTable, AcDb::kForRead);
AcDbObjectId recordId = AcDbObjectId::kNull;

es = pBlockTable->getAt(ACRX_T("TEST1"), recordId, AcDb::kForRead);
objIds2Copy.append(recordId); 

es = pBlockTable->getAt(ACRX_T("TEST2"), recordId, AcDb::kForRead);
objIds2Copy.append(recordId); 

es = pBlockTable->close();

AcDbIdMapping idMap;
es = pSrcDb->wblockCloneObjects(objIds2Copy, acdbSymUtil()->blockModelSpaceId(pDestDb), idMap, AcDb::kDrcReplace);
if(es == Acad::ErrorStatus::eOk)
	acutPrintf( _T("\nCloned the block to the current drawing.") );
else
	acutPrintf( _T("\nFailed to clone the block to the current drawing.") );

delete pSrcDb;

 



Balaji
Developer Technical Services
Autodesk Developer Network

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

Post to forums  

Autodesk Design & Make Report

”Boost