|
Acad::ErrorStatus es;
AcDbCircle *pCirc1 = new AcDbCircle(AcGePoint3d(1, 1, 1), AcGeVector3d(0, 0, 1), 1.0),
*pCirc2 = new AcDbCircle(AcGePoint3d(4, 4, 4), AcGeVector3d(0, 0, 1), 2.0);
AcDbBlockTable *pBlockTable;
AcDbDatabase *pDbSource = acdbHostApplicationServices()->workingDatabase(); //TB
es = pDbSource->getSymbolTable(pBlockTable, AcDb::kForRead);
AcDbBlockTableRecord *pBlockTableRecord;
pBlockTable->getAt(ACDB_MODEL_SPACE, pBlockTableRecord, AcDb::kForWrite);
pBlockTable->close();
AcDbObjectIdArray ObjIdArr;
AcDbObjectId CircleId;
es = pBlockTableRecord->appendAcDbEntity(CircleId, pCirc1);
ObjIdArr.append(pCirc1->objectId()); //TB NOW your circle has am objectID!
es = pCirc1->close();
es = pBlockTableRecord->appendAcDbEntity(CircleId, pCirc2);
ObjIdArr.append(pCirc2->objectId()); //TB NOW your circle has am objectID!
es = pCirc2->close();
es = pBlockTableRecord->close();
AcDbDatabase *pDb = new AcDbDatabase();
AcDbBlockTable *pBt;
pDb->getSymbolTable(pBt, AcDb::kForRead);
AcDbBlockTableRecord *pBtr;
pBt->getAt(ACDB_MODEL_SPACE, pBtr, AcDb::kForRead);
pBt->close();
AcDbObjectId ObjId = pBtr->objectId();
AcDbIdMapping IdMap;
//TB IdMap.setDestDb(pDb);
es = pBtr->close(); // es returing eNotHandled
es = pDbSource->wblockCloneObjects(ObjIdArr, ObjId, IdMap, AcDb::kDrcReplace, false);
es = pDb->saveAs(_T("c:\\temp\\abc.dwg"));
delete pDb; |
|