标签:ase close put mode clone dbblock bho dal tor
方法1:
AcDbDatabase *pdb;
acdbCurDwg()->wblock(pdb);
pdb->saveAs(str);
pdb->closeInput(true);
delete pdb;
方法2:
AcDbDatabase * pDB=acdbHostApplicationServices()->workingDatabase();
AcDbBlockTable *pBT1;
pDB->getBlockTable(pBT1,AcDb::kForRead);
AcDbBlockTableRecord *pBTR1;
pBT1->getAt(ACDB_MODEL_SPACE,pBTR1,AcDb::kForRead);
AcDbBlockTableRecordIterator * pBTRIt;
AcDbObjectIdArray objArr;
AcDbIdMapping idMap;
pBTR1->newIterator(pBTRIt);
pBTRIt->start();
for (;!pBTRIt->done();pBTRIt->step())
{
AcDbObjectId objID;
pBTRIt->getEntityId(objID);
objArr.append(objID);
}
delete pBTRIt;
pBTR1->close();
pBT1->close();
AcDbDatabase* pTempDb=new AcDbDatabase();
idMap.setDestDb(pTempDb);
pTempDb->getSymbolTable(pBT1,AcDb::kForRead);
Acad::ErrorStatus e;
AcDbBlockTableRecord * pBTR2;
AcDbObjectId pSpaceObjID;
pBT1->getAt(ACDB_MODEL_SPACE,pSpaceObjID);
pBT1->close();
// pSpaceObjID=getBlockId(ACDB_PAPER_SPACE);
e=pTempDb->wblockCloneObjects(objArr,pSpaceObjID,idMap,AcDb::kDrcIgnore);
//acdbHostApplicationServices()->setWorkingDatabase(pTempDb);
//if (Acad::eOk!=acdbHostApplicationServices()->workingDatabase()
//->insert(AcGeMatrix3d::kIdentity,pTempDb))
//{
//acedAlert(_T("insert 操作失败!"));
//}
//delete pTempDb;
pTempDb->saveAs(str);
delete pTempDb;
标签:ase close put mode clone dbblock bho dal tor
原文地址:https://www.cnblogs.com/mjgw/p/12406152.html