|
1.提取实体的扩展数据,本代码在VC++6.0,2002通过
//
// ObjectARX defined commands
#include "StdAfx.h"
#include "StdArx.h"
// This is command 'TEST'
int printdxf(struct resbuf *eb);
void test()
{
// TODO: Implement the command
struct resbuf *ebuf, *eb;
ads_name ent1;
ads_point pt;
acedEntSel("\n请选择对像",ent1,pt);
ebuf = acdbEntGet(ent1);
eb = ebuf;
acutPrintf("\nResults of entgetting last entity\n");
// Print items in the list.
for (eb = ebuf; eb != NULL; eb = eb->rbnext)
printdxf(eb);
// Release the acdbEntGet() list.
acutRelRb(ebuf);
}
int printdxf(struct resbuf *eb)
{
int rt;
if (eb == NULL)
return RTNONE;
if ((eb->restype >= 0) && (eb->restype restype >= 10) && (eb->restype restype >= 38) && (eb->restype restype >= 60) && (eb->restype restype >= 210) && (eb->restype restype restype;
else
rt = RTNONE;
switch (rt) {
case RTSHORT:
acutPrintf("(%d . %d)\n", eb->restype,
eb->resval.rint);
break;
case RTREAL:
acutPrintf("(%d . %0.3f)\n", eb->restype,
eb->resval.rreal);
break;
case RTSTR:
acutPrintf("(%d . \"%s\")\n", eb->restype,
eb->resval.rstring);
break;
case RT3DPOINT:
acutPrintf("(%d . %0.3f %0.3f %0.3f)\n",
eb->restype,
eb->resval.rpoint[X], eb->resval.rpoint[Y],
eb->resval.rpoint[Z]);
break;
case RTNONE:
acutPrintf("(%d . Unknown type)\n", eb->restype);
break;
case -1:
case -2:
// First block entity
acutPrintf("(%d . )\n",
eb->restype, eb->resval.rlname[0]);
}
return eb->restype;
} |
|