码迷,mamicode.com
首页 > 其他好文 > 详细

objectarx 把当前图形输出

时间:2020-03-04 09:58:18      阅读:90      评论:0      收藏:0      [点我收藏+]

标签: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;

objectarx 把当前图形输出

标签:ase   close   put   mode   clone   dbblock   bho   dal   tor   

原文地址:https://www.cnblogs.com/mjgw/p/12406152.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!