插入块的代码:
AcDbDatabase *pCurDb; AcDbBlockTable *pBlkTable; AcDbBlockTableRecord *pBlkTableRecord; AcDbBlockReference *pInsrtObj; AcDbObjectId blkId; pCurDb = acdbHostApplicationServices()->workingDatabase();
pCurDb->getBlockTable(pBlkTable, AcDb::kForRead); if(!pBlkTable->has(blkName)) { acutPrintf("\nBlock definition %s not found. ", blkName); pBlkTable->close(); return; }
pBlkTable->getAt(blkName, blkId);
//下面的这一行在模态对话框中能很好的执行,但是在非模态对话框中却使CAD出现严重错误。不知怎么回事。请各位能指点一下迷津谢谢。
pBlkTable->getAt(ACDB_MODEL_SPACE, pBlkTableRecord, AcDb::kForWrite); pBlkTable->close();
pInsrtObj = new AcDbBlockReference(insPt, blkId);
pBlkTableRecord->appendAcDbEntity(blkId, pInsrtObj);
pBlkTableRecord->close(); pInsrtObj->close();
Modal对话框中 按纽单击事件 以上代码能通过编译、执行
Modeless对话框中 按纽单击事件 以上代码能通过编译,执行时出现错误。
为这个问题都忙活了一天了,不知怎么解决。请一定指点一下!谢谢。 |