求助 创建字典 异常
请教各位,我创建一个新字典(ASDK_DICT),将它添加到命名对象字典中,创建了一个类abc的对象,使用setAt函数将其添加到字典中。但在setAt函数中出现异常,代码如下:<br/><br/> AcDbDictionary *pNamedObj;<br/> AcDbDictionary *pNameList;<br/> <br/> <br/> acdbHostApplicationServices()->workingDatabase()<br/> ->getNamedObjectsDictionary(pNamedObj,AcDb::kForWrite);<br/> <br/> if (pNamedObj->getAt("ASDK_DICT",<br/> (AcDbObject*&)pNameList, AcDb::kForWrite)<br/> == Acad::eKeyNotFound)<br/> {<br/> pNameList = new AcDbDictionary;<br/> AcDbObjectId DictId;<br/> pNamedObj->setAt("ASDK_DICT", pNameList, DictId);<br/> }<br/> pNamedObj->close();<br/><br/> <br/> abc *p1=new abc(1);<br/> <br/> AcDbObjectId objId;<br/> if ((pNameList->getAt("dict1", objId))<br/> == Acad::eKeyNotFound)<br/> {<br/> <br/> pNameList->setAt("dict1", p1, objId); //出现异常<br/> p1->close();<br/> } else {<br/> delete p1;<br/> ads_printf("dict1 already exists\n");<br/> }<br/> <br/> acutPrintf("创建字典成功!\n");<br/><br/>请教各位这是什么原因呢?应该怎样改呢?谢谢!
页:
[1]