明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1110|回复: 0

[讨论]请教一下从AcDbLine派生时需要重载哪些函数?

[复制链接]
发表于 2005-4-8 09:13:00 | 显示全部楼层 |阅读模式
请教一下从AcDbLine派生时需要重载哪些函数?
可以派生出来的,但好象有些函数不能用,比如TRIM EXTEND等,请大家讨论一下还有哪些函数需要重载?
以下是代码:
#include "aced.h"
#include "adslib.h"
#include "dbsymtb.h"
#include "acgi.h"
#include "dbapserv.h"
#include "dbents.h"

class myline: public AcDbLine
{
public:
ACRX_DECLARE_MEMBERS(myline);
myline();
~myline();
};

ACRX_DXF_DEFINE_MEMBERS(myline,AcDbEntity,
AcDb::kDHL_CURRENT, AcDb::kMReleaseCurrent, 0x5,\
myline,myline);

myline::myline()
{
}
myline::~myline()
{
}

void
addmyline()
{
ads_point pt1,pt2;
if ((ads_getpoint(NULL,"\nStart point:",pt1))!=RTNORM)
return;
if ((ads_getpoint(pt1,"\nEnd point:",pt2))!=RTNORM)
return;

AcGePoint3d pt11,pt21;
pt11.set(pt1[X],pt1[Y],pt1[Z]);
pt21.set(pt2[X],pt2[Y],pt2[Z]);

myline *pNewObj = new myline;
pNewObj->setStartPoint(pt11);
pNewObj->setEndPoint(pt21);

AcDbBlockTable *pBlockTable;
acdbHostApplicationServices()->workingDatabase()
->getSymbolTable(pBlockTable, AcDb::kForRead);

AcDbBlockTableRecord *pBlock;
pBlockTable->getAt(ACDB_MODEL_SPACE, pBlock,
AcDb::kForWrite);

AcDbObjectId objId;
pBlock->appendAcDbEntity(objId, pNewObj);

pBlockTable->close();
pBlock->close();
pNewObj->close();
}


void
initapp()
{
myline::rxInit();
acrxBuildClassHierarchy();

acedRegCmds->addCommand("qx",
"qq",
"qq",
ACRX_CMD_TRANSPARENT,
addmyline);
}


extern "C" AcRx::AppRetCode
acrxEntryPoint(AcRx::AppMsgCode msg, void* appId)
{
switch (msg) {
case AcRx::kInitAppMsg:
acrxDynamicLinker->unlockApplication(appId);
acrxDynamicLinker->registerAppMDIAware(appId);
initapp();
break;
case AcRx::kUnloadAppMsg:
acedRegCmds->removeGroup("qx");
deleteAcRxClass(myline::desc());
}
return AcRx::kRetOK;
}
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-11-26 08:43 , Processed in 0.176472 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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