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:
The lines are on top of the hatch.
After inserting it to the current dwg, the block looks like this:
The hatch is now on top of the lines. Is this a know side-effect of wblockCloneObjects?
Regards
Markus
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.
@owenwengerd wrote:Are you cloning the AcDbBlockTableRecord object?
Yes. I search the block in the external blocktable, and pass its id wblockCloneObjects.
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;