以下示例演示如何创建新的块表记录并将其追加到块表中。然后,它会创建一行并将其附加到新的块表记录中。 void makeABlock() { // Create and name a new block table record. // AcDbBlockTableRecord *pBlockTableRec = new AcDbBlockTableRecord(); pBlockTableRec->setName("ASDK-NO-ATTR"); // Get the block table. // AcDbBlockTable *pBlockTable = NULL; acdbHostApplicationServices()->workingDatabase() ->getSymbolTable(pBlockTable, AcDb::kForWrite); // Add the new block table record to the block table. // AcDbObjectId blockTableRecordId; pBlockTable->add(blockTableRecordId, pBlockTableRec); pBlockTable->close(); // Create and add a line entity to the component's // block record. // AcDbLine *pLine = new AcDbLine(); AcDbObjectId lineId; pLine->setStartPoint(AcGePoint3d(3, 3, 0)); pLine->setEndPoint(AcGePoint3d(6, 6, 0)); pLine->setColorIndex(3); pBlockTableRec->appendAcDbEntity(lineId, pLine); pLine->close(); pBlockTableRec->close(); } |
|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-1-8 19:26
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.