在ObjectARX中添加“块”
2015-11-27 09:46
369 查看
[code]acDocManager->lockDocument(curDoc()); // 获得当前图形数据库的块表 AcDbBlockTable *pBlkTbl; acdbHostApplicationServices()->workingDatabase() ->getBlockTable(pBlkTbl, AcDb::kForWrite); // 创建新的块表记录 AcDbBlockTableRecord *pBlkTblRcd; pBlkTblRcd = new AcDbBlockTableRecord(); // 设置块表记录的名称 CString blkName = "DiagramTail"; pBlkTblRcd->setName(blkName); // 将块表记录添加到块表中 AcDbObjectId blkDefId; pBlkTbl->add(blkDefId, pBlkTblRcd); pBlkTbl->close(); // 向块表记录中添加线段 AcGePoint3d RectLD(0,0,0), RectLU(0,18,0), RectRD(390,0,0), RectRU(390,18,0); drawLine(RectLD, RectLU, pBlkTblRcd); drawLine(RectLD, RectRD, pBlkTblRcd); drawLine(RectRU, RectLU, pBlkTblRcd); drawLine(RectRU, RectRD, pBlkTblRcd); //下面添加文字 RectLU.y = RectRU.y = 2.5; AcGePoint3d ptInsertText(10,3,0); CString tempText = "制 图"; drawText(ptInsertText,tempText, pBlkTblRcd); pBlkTblRcd->close(); // 查找用户指定的块定义是否存在 if (!pBlkTbl->has(blkName.AllocSysString())) { acutPrintf(_T("\n当前图形中未包含指定名称的块定义!")); pBlkTbl->close(); return; } AcGePoint3d ptInsert(25,5,0); // 获得用户指定的块表记录 pBlkTbl->getAt(blkName.AllocSysString(), blkDefId); AcDbBlockReference *pBlkRef = new AcDbBlockReference(ptInsert,blkDefId); pBlkTbl->getAt(ACDB_MODEL_SPACE, pBlkTblRcd,AcDb::kForWrite); AcDbObjectId entId; pBlkTblRcd->appendAcDbEntity(entId, pBlkRef); // 关闭数据库的对象 pBlkRef->close(); pBlkTblRcd->close(); pBlkTbl->close(); acDocManager->unlockDocument(curDoc());
相关文章推荐
- 用递归方式解析JSONObject 为HashMap
- Objective C 链式调用
- objective-c 关键字和概念
- Objective-C 字符串
- iOS高效开发必备的10款Objective-C类库
- Objective-C 工厂方法
- Objective-C set/get方法
- 102 For which two database objects can the VERSIONS clause of the Flashback Versions Query be used?
- Swift如何调用Object-C类
- 如何在Objective-C中实现链式语法?
- Objective-C 类,函数调用
- 【读书笔记一】Zen and the Art of Objective_C Craftsmanship
- OC基础
- 92 Examine the output of the query that you executed to list the objects in the recycle bin: SQL> SE
- PHP反射类ReflectionClass和ReflectionObject的使用方法
- SAP锁对象(lock object)
- objective-c 中代码块(blocks)
- 开源库ZXing加入xcode工程报错几个原因及解决方法
- Objective-C官方文档翻译 Block
- Objective-C中的Block