ARX (VC60+ACAD2002)自定义实体类读写出错
本帖最后由 作者 于 2005-6-8 8:52:11 编辑 <br /><br /> 定义成员:<BR> AcGePoint3d mFirst, mSecond, mThree, mFour;<BR> AcGePoint3d mCenter;Acad::ErrorStatus cascoCEntity::dwgInFields(AcDbDwgFiler* pFiler)<BR>{<BR> assertWriteEnabled();<BR> Acad::ErrorStatus es;
// Call dwgInFields from AcDbEntity<BR> if ((es = AcDbEntity::dwgInFields(pFiler)) != Acad::eOk) {<BR> return es;<BR> }
// Read version number.<BR> Adesk::UInt16 version;<BR> pFiler->readItem(&version);<BR> if (version > VERSION_CASCOCENTITY)<BR> return Acad::eMakeMeProxy;
// Read the data members.<BR> switch (version)<BR> {<BR> case (1):<BR> // TODO: here you can file datamembers not<BR> // created by the ObjectARX Add-In.<BR> <FONT color=#ff0000>pFiler->readItem(&version); //原来这儿多了一行,读了两次,谢谢xd论坛binbin<BR></FONT> pFiler->readItem(&mCenter);<BR> pFiler->readItem(&mFirst);<BR> pFiler->readItem(&mSecond);<BR> pFiler->readItem(&mThree);<BR> pFiler->readItem(&mFour);<BR> break;<BR> }<BR> return pFiler->filerStatus();<BR>}
Acad::ErrorStatus cascoCEntity::dwgOutFields(AcDbDwgFiler* pFiler) const<BR>{<BR> assertReadEnabled();<BR> Acad::ErrorStatus es;
// Call dwgOutFields from AcDbEntity<BR> if ((es = AcDbEntity::dwgOutFields(pFiler)) != Acad::eOk) {<BR> return es;<BR> }
// Write version number.<BR> pFiler->writeItem((Adesk::UInt16) VERSION_CASCOCENTITY);
// Write the data members.<BR> // TODO: here you can file datamembers not<BR> // created by the ObjectARX Add-In.<BR> pFiler->writeItem(mCenter);<BR> pFiler->writeItem(mFirst);<BR> pFiler->writeItem(mSecond);<BR> pFiler->writeItem(mThree);<BR> pFiler->writeItem(mFour);
return pFiler->filerStatus();<BR>}
Acad::ErrorStatus cascoCEntity::dxfInFields(AcDbDxfFiler* pFiler)<BR>{<BR> assertWriteEnabled();<BR> struct resbuf rb;
if ((AcDbEntity::dxfInFields(pFiler) != Acad::eOk) ||<BR> !pFiler->atSubclassData("cascoCEntity"))<BR> return pFiler->filerStatus();
// Read version number.<BR> pFiler->readItem(&rb);<BR> if (rb.restype != AcDb::kDxfInt16) {<BR> pFiler->pushBackItem();<BR> pFiler->setError(Acad::eInvalidDxfCode,<BR> "nError: expected object version group code %d",<BR> AcDb::kDxfInt16);<BR> return pFiler->filerStatus();<BR> } else {<BR> Adesk::UInt16 version = rb.resval.rint;<BR> if (version > VERSION_CASCOCENTITY)<BR> return Acad::eMakeMeProxy;<BR> }
// TODO: here you can file datamembers not<BR> // created by the ObjectARX Add-In.
pFiler->readItem(&rb);<BR> if (rb.restype != AcDb::kDxfXCoord) <BR> mCenter = asPnt3d(rb.resval.rpoint);
pFiler->readItem(&rb);<BR> if (rb.restype != AcDb::kDxfXCoord +1) <BR> mFirst = asPnt3d(rb.resval.rpoint);
pFiler->readItem(&rb);<BR> if (rb.restype != AcDb::kDxfXCoord +2) <BR> mSecond = asPnt3d(rb.resval.rpoint);
pFiler->readItem(&rb);<BR> if (rb.restype != AcDb::kDxfXCoord +3) <BR> mThree= asPnt3d(rb.resval.rpoint);
pFiler->readItem(&rb);<BR> if (rb.restype == AcDb::kDxfXCoord +4) <BR> mFour = asPnt3d(rb.resval.rpoint);
return pFiler->filerStatus();<BR>}
Acad::ErrorStatus cascoCEntity::dxfOutFields(AcDbDxfFiler* pFiler) const<BR>{<BR> assertReadEnabled();<BR> Acad::ErrorStatus es;
if ((es = AcDbEntity::dxfOutFields(pFiler)) != Acad::eOk)<BR> return es;
// Write subclass marker.<BR> pFiler->writeItem(AcDb::kDxfSubclass, "cascoCEntity");
// Write version number.<BR> pFiler->writeItem(AcDb::kDxfInt16, (Adesk::UInt16) VERSION_CASCOCENTITY);
<BR> // TODO: here you can file datamembers not<BR> // created by the ObjectARX Add-In.
pFiler->writeItem(AcDb::kDxfXCoord, mCenter);<BR> pFiler->writeItem(AcDb::kDxfXCoord, mFirst);<BR> pFiler->writeItem(AcDb::kDxfXCoord, mSecond);<BR> pFiler->writeItem(AcDb::kDxfXCoord, mThree);<BR> pFiler->writeItem(AcDb::kDxfXCoord, mFour);
return es;<BR>}<BR>请问我这个自定义实体类保存读取出错在哪儿?
还有本例中夹点函数、拉伸函数、变换函数以及对象捕捉点函数如何编程?<BR>Acad::ErrorStatus cascoCEntity::getGripPoints(AcGePoint3dArray& gripPoints,<BR> AcDbIntArray& osnapModes,<BR> AcDbIntArray& geomIds) const<BR>{。。。。}
Acad::ErrorStatus cascoCEntity::getStretchPoints(AcGePoint3dArray& stretchPoints) const<BR>{。。。。}
Acad::ErrorStatus cascoCEntity::moveGripPointsAt(const AcDbIntArray& indices,<BR> const AcGeVector3d& offset)<BR>{。。。。}
Acad::ErrorStatus cascoCEntity::moveStretchPointsAt(const AcDbIntArray& indices,<BR> const AcGeVector3d& offset)<BR>{。。。。}
请各位大侠帮帮忙呀,能不能给出一个从实体类派生的例子。谢谢大家。
页:
[1]