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