将几个实体对象变成一个块

CString blockName = _T("建北图元");

AcDbBlockTable *pBlkTab;

acdbHostApplicationServices()->workingDatabase()->getBlockTable(pBlkTab, AcDb::kForWrite);

AcDbBlockTableRecord *pBlkTabRcd;

pBlkTabRcd = new AcDbBlockTableRecord();

pBlkTabRcd->setName(blockName);

AcDbObjectId blockId;
pBlkTab->add(blockId, pBlkTabRcd);
pBlkTab->close();

pBlkTabRcd->appendAcDbEntity(p1);

pBlkTabRcd->appendAcDbEntity(p2);

pBlkTabRcd->appendAcDbEntity(p3);

p1->close();

p2->close();

p3->close();

AcDbBlockReference *pBlkRef = new AcDbBlockReference(ptInsert, blockId);

AcDbObjectId idXdata=CDwgDatabaseUtil::PostToModelSpace(pBlkRef, m_pDatabase);

pBlkTabRcd->close();

posted @ 2015-11-23 16:16  xzh1993  阅读(271)  评论(0编辑  收藏  举报