明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2271|回复: 2

派生自定义实体重载函数【转载】

[复制链接]
发表于 2012-7-13 22:37:23 | 显示全部楼层 |阅读模式
AcDbEntity 是所有具有图形表现的数据库对象的基类。它由AcDbObject派生。创建自定义实体包括以下步骤:
1.从AcDbEntity派生一个自定义类;
2.重载所有必要的AcDbObject函数;
3.重载要求的AcDbEntity函数;
4.重载支持自定义功能的其它函数;
5.如果要支持MATCHPROP命令,执行AcDbMatchProperties作为扩展协议;
6.如果要为自定义实体创建拖曳序列,执行自定义的AcEdJig。

(1)必须重载的AcDbEntity函数
当从AcDbEntity派生自定义类时,下述函数必须重载:
virtual Adesk::Boolean worldDraw(AcGiWorldDraw* mode);
virtual Acad::ErrorStatus getGeomExtents(AcDbExtents& extents)const;
virtual Acad::ErrorStatus transformBy(const AcGeMatrix3d& xform);
virtual Acad::ErrorStatus getTransformedCopy(const AcGeMatrix3d& xform,AcDbEntity*& ent)const;
virtual Acad::ErrorStatus getGripPoint,AcDbIntArray& osnapModes,AcDbIntArray& getomIds)const;
virtual Acad::ErrorStatus moveGripPointsAt(const AcDbIntArray& indices,const AcGeVector3d& offset);
(2)通常需要重载的AcDbEntity函数
当从AcDbEntity派生自定义类时,下述函数通常需要重载,是否重载它们取决于自定义类的功能。
virtual void viewportDraw(AcGiViewportDraw* mode);
virtual void list() const;
vitual Acad::ErrorStatus intersectWith(const AcDbEntity* ent,AcDb::Intersect intType,AcGePoint3dArray& points,int thisGsMarker=0,int otherGsMarker=0)const;
virtual Acad::ErrorStatus intersectWith(const AcDbEntity* ent,AcDb::Intersect intType,const AcGePlane& projPlane,AcGePoint3dArray& points,int thisGsMarker=0,int otherGsMarker=0)const;
vitual Acad::ErrorStatus getOsnapPoints(AcDb::OsnapMode osnapMode,int gsSelectionMark,const AcGePoint3d& pickPoint,const AcGePoint3d& lastPoint,const AcGeMatrixed& viewXform,AcGePoint3dArray& snapPoints,AcDbIntArray& geomIds)const;
virtual Acad::ErrorStatus getStretchPoints(AcGePoint3dArray&)const;
virtual Acad::ErrorStatus moveStretchPointsAt(const AcDbIntArray& indeces,const AcGeVector3d& offset);
virtual Acad::ErrorStatus explode(AcDbVoidPtrArray& entitySet)const;
virtual Acad::ErrorStatus getSubentPathsAtGsMarker(AcDb::SubentType type,int gsMark,const AcGePoint3d& pickPoint,const AcGeMatrix3d& viewXform,int& numPaths,AcDbFullSubentPaths*& subentPaths,int numInserts=0,AcDbObjectId* entAndInsertStack=NULL)const;
virtual Acad::ErrorStatus applyPartialUndo(AcDbDwgFiler* undoFiler,AcRxClass* classObj);
virtual void subSetDatabaseDefaults(AcDbDatabase* pDb);
virtual void saveAs(AcGiWorldDraw *mode,AcDb::SaveType st);
(3)很少重载的AcDbEntity函数
virtual Acad::ErrorStatus setColor(const AcCmColor &color);
virtual Acad::ErrorStatus setColorIndex(Adesk::UInt16 color);
virtual Acad::ErrorStatus setLinetype(const char* newVal);
virtual Acad::ErrorStatus setLinetype(AcDbObjectId newVal);
virtual void getEcs(AcGeMatrix3d& retVal)const;
virtual Acad::ErrorStatus gerGsMarkersAtSubentPath(const AcDbFullSubentPath& subPath,AcDbIntArray& gsMarkers)const;
virtual Acad::ErrorStatus highlight(const AcDbFullSubentPath& subId=kNullSubent)const;
virtual Acad::ErrorStatus unhighlight(const AcDbFullSubentPath& subId=kNullSubent)const;
virtual AcDbEntity* subentPtr(const AcDbFullSubentPath& id)const;
virtual Adesk::Boolean saveImagesByDefault() const;
virtual void setAttributes(AcGiSubEntityTraits* pTraits);
发表于 2012-9-7 10:50:22 | 显示全部楼层
总结不错,顶一个。
发表于 2012-9-7 12:31:49 | 显示全部楼层
列出这么个表,有啥用,还不如详细说一个呢
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-11-29 01:50 , Processed in 0.182121 second(s), 28 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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