1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| static void LHMyGroupMyCommand() { AcDbDatabase* pDB = acdbHostApplicationServices()->workingDatabase(); AcDbBlockTableRecord* newBlock = new AcDbBlockTableRecord(); newBlock->setName(L"测试块定义"); newBlock->setOrigin(AcGePoint3d(0, 0, 0)); AcDbLine* pLine2 = new AcDbLine(AcGePoint3d(0, 0, 0), AcGePoint3d(1000, 1000, 0)); AcDbCircle* pCircle2 = new AcDbCircle(AcGePoint3d(0, 0, 0), AcGeVector3d(0, 0, 1), 500); AcDbArc* pArc2 = new AcDbArc(AcGePoint3d(100, 100, 0), 200, 90, 180); newBlock->appendAcDbEntity(pLine2); newBlock->appendAcDbEntity(pCircle2); newBlock->appendAcDbEntity(pArc2); AcDbObjectId blockDefinitionId; pBlockTable->add(blockDefinitionId, newBlock); newBlock->close(); pLine2->close(); pCircle2->close(); pArc2->close(); AcDbBlockReference* reference = new AcDbBlockReference(AcGePoint3d(1000, 1000, 0), blockDefinitionId); pBlockTableRecord->appendAcDbEntity(reference); reference->close(); pBlockTable->close(); pBlockTableRecord->close(); }
|