明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1476|回复: 0

ARX (VC60+ACAD2002)自定义实体类读写出错

[复制链接]
发表于 2005-6-7 18:42:00 | 显示全部楼层 |阅读模式
本帖最后由 作者 于 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)
{。。。。} 请各位大侠帮帮忙呀,能不能给出一个从实体类派生的例子。谢谢大家。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-11-26 07:36 , Processed in 0.159657 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表