- 积分
- 1423
- 明经币
- 个
- 注册时间
- 2003-8-7
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
发表于 2003-10-31 20:25:00
|
显示全部楼层
可将帮助文件里的功能实现部分添加到你的程序当中,为何不能以函数的形式添加,
我也不知道。
void myEntityContext::onCommand(Adesk::UInt32 cmdIndex)
{
struct resbuf *ebuf, *eb;
ads_name en;
acdbEntLast(en);
ebuf = acdbEntGet(en);
eb = ebuf;
acutPrintf("\nResults of entgetting last entity\n");
// Print items in the list.
for (eb = ebuf; eb != NULL; eb = eb->rbnext)
{
int rt;
//所选实体为形位公差类型,从autocad自带的lisp编辑器中可看到相关图元参数
/* if (eb->restype ==-1 )
{acutPrintf("(%d . <Entity name: %8lx>)\n",eb->restype, eb->resval.rlname[0]); }
else if(eb->restype ==0)
{acutPrintf("(%d . \"%s\")\n", eb->restype,eb->resval.rstring); }
else if(eb->restype ==330)
{acutPrintf("(%d . <Entity name: %8lx>)\n",eb->restype, eb->resval.rlname[0]); }
else if(eb->restype ==5)
{acutPrintf("(%d . \"%s\")\n", eb->restype,eb->resval.rstring); }
else if(eb->restype ==67)
{acutPrintf("(%d . %d)\n", eb->restype,eb->resval.rint); }
//else if(eb->restype ==410)
// {acutPrintf("(%d . %d)\n", eb->restype,eb->resval.rint); }
if ((eb->restype >= 0) && (eb->restype <= 9))
{ rt = RTSTR ; acutPrintf("(%d . \"%s\")\n", eb->restype,eb->resval.rstring); }
else if ((eb->restype >= 10) && (eb->restype <= 19)&&(eb->restype >= 210) && (eb->restype <= 239))
{ rt = RT3DPOINT; acutPrintf("(%d . %0.3f %0.3f %0.3f)\n",eb->restype,eb->resval.rpoint[X], eb->resval.rpoint[Y], eb->resval.rpoint[Z]); }
else if ((eb->restype >= 38) && (eb->restype <= 59))
{rt = RTREAL ;acutPrintf("(%d . %0.3f)\n", eb->restype,eb->resval.rreal); }
else if ((eb->restype >= 60) && (eb->restype <= 79))
{rt = RTSHORT ; acutPrintf("(%d . %d)\n", eb->restype,eb->resval.rint); }
//else if ((eb->restype >= 210) && (eb->restype <= 239))
// rt = RT3DPOINT ;
else if (eb->restype < 0)
// Entity name (or other sentinel)
{ rt = eb->restype; acutPrintf("(%d . <Entity name: %8lx>)\n",eb->restype, eb->resval.rlname[0]); }
else
{ rt = RTNONE;acutPrintf("(%d . Unknown type)\n", eb->restype); }
}
从帮助项中提取的源代码,还有写Unknown type,不过,你按合适的判断语句和输出语句就可看到在正确的参数。 |
|