请教各位高手,下断代码最后返回的值 es 总是 eWrongObjectType?
请教各位高手,下断代码最后返回的值 es 总是 eWrongObjectType?AcDbDictionary *pNamedobj;
acdbHostApplicationServices()->workingDatabase()->
getNamedObjectsDictionary(pNamedobj, AcDb::kForWrite);
AcDbDictionary *pDict;
Acad::ErrorStatus es;
if (pNamedobj->getAt("ZLDWGPROP_DICT", (AcDbObject*&) pDict,
AcDb::kForWrite) == Acad::eKeyNotFound)
{
pDict = new AcDbDictionary;
// Create new objects to add to the new dictionary,
// add them, then close them.
//
AsdkMyClass *pObj2 = new AsdkMyClass(2);
AcDbObjectId rId1;
es = pDict->setAt("PROJECTNAME", pObj2, rId1);// 增加字典条目PROJECTNAME
}
附:(class AsdkMyClass : public AcDbObject)
可能是以下原因:
AcDbDictionary *pNamedobj;acdbHostApplicationServices()->workingDatabase()->
getNamedObjectsDictionary(pNamedobj, AcDb::kForWrite);
AcDbDictionary *pDict;
Acad::ErrorStatus es;
if (pNamedobj->getAt("ZLDWGPROP_DICT", (AcDbObject*&) pDict,
AcDb::kForWrite) == Acad::eKeyNotFound)
{
pDict = new AcDbDictionary;
//以下为增加部分
AcDbObjectId DictId;
pNamedobj->setAt("ZLDWGPROP_DICT", pDict, DictId);
//没找到,就要创建并加入
}
pNamedobj->close();
if (pDict) {
//结束
// Create new objects to add to the new dictionary,
// add them, then close them.
//
AsdkMyClass *pObj2 = new AsdkMyClass(2);
AcDbObjectId rId1;
es = pDict->setAt("PROJECTNAME", pObj2, rId1);// 增加字典条目PROJECTNAME
//以下为增加部分
pObj2->close();
pDict->close();
//结束
}
问题解决,非常感谢。
非常感谢,问题解决,原因AsdkMyClass 未执行初始化rxInit()出现上述错误;
页:
[1]