求教:自定义实体加不到数据库记录里怎么办啊???
这是我自定义的一个实体类:class AsdkEllipseJig : public AcEdJig
{<BR>public:<BR> AsdkEllipseJig(const AcGePoint3d&, const AcGeVector3d&);<BR> void doIt();<BR> virtual DragStatus sampler();<BR> virtual Adesk::Boolean update();<BR> virtual AcDbEntity* entity() const;
private:<BR> AcDbEllipse *mpEllipse;<BR> AcGePoint3d mCenterPt, mAxisPt;<BR> AcGeVector3d mMajorAxis, mNormal;<BR> double mRadiusRatio;<BR> int mPromptCounter;<BR>};
用下面的这个实体插入数据库记录的代码:
AsdkMyClass * pclass= new AsdkMyClass(12);//,startPt,endPt);<BR> pclass->setData(50);<BR> AcDbBlockTable *pBlockTable;<BR> acdbHostApplicationServices()->workingDatabase()<BR> ->getSymbolTable(pBlockTable, AcDb::kForRead);
AcDbBlockTableRecord *pBlockTableRecord;<BR> pBlockTable->getAt(ACDB_MODEL_SPACE, pBlockTableRecord,<BR> AcDb::kForWrite);<BR> pBlockTable->close();
AcDbObjectId classId;<BR> pBlockTableRecord->appendAcDbEntity(classId, pclass);
pBlockTableRecord->close();<BR> pclass->close();<BR>可执行到 pBlockTableRecord->appendAcDbEntity(classId, pclass);就出错,谁能告诉为什么吗,错在哪儿了?小弟谢谢啦! AcEdJig不是数据库实体类,不可以加入MS
AsdkMyClass 不明你的类种类,
可能你没有将你的类註册到ACAD 不好意思啊,我拷错了,我的自定义类应该是这样的
class AsdkMyClass : public AcDbEntity<BR>//<BR>//<BR>{<BR>public:<BR> ACRX_DECLARE_MEMBERS(AsdkMyClass);<BR> AsdkMyClass(): mIntval(0) {};<BR> AsdkMyClass(const Adesk::Int16& val): mIntval(val) {};<BR> virtual Adesk::Boolean worldDraw(AcGiWorldDraw* mode){return Adesk::kTrue;};
Acad::ErrorStatus getData (Adesk::Int16&);<BR> Acad::ErrorStatus setData (Adesk::Int16);
virtual Acad::ErrorStatus dwgInFields (AcDbDwgFiler*);<BR> virtual Acad::ErrorStatus dwgOutFields(AcDbDwgFiler*)<BR> const;<BR> virtual Acad::ErrorStatus dxfInFields (AcDbDxfFiler*);<BR> virtual Acad::ErrorStatus dxfOutFields(AcDbDxfFiler*)<BR> const;<BR>private:<BR> Adesk::Int16 mIntval;<BR>};
ACRX_DXF_DEFINE_MEMBERS(AsdkMyClass, AcDbObject, <BR>AcDb::kDHL_CURRENT, AcDb::kMReleaseCurrent, <BR>0,<BR> ASDKMYCLASS, SAMP2); 你没有将你的类註册到ACAD 我明白了,搞定!easypower谢谢你了啊!以后有问题还得向你请教。
页:
[1]