- UID
- 674793
- 积分
- 1874
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2013-4-1
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
- //提取DXF值 By Gu_xl
- //调用方式
- //(GetDxf ename code [AllFlag])
- // ename 图元名
- // code 组码
- // AllFlag 可选参数,提供且不为nil时返回所有相同组码值
- static int ads_GetDxf (void)
- {
- struct resbuf *rb = acedGetArgs();
- struct resbuf *rbdxf=NULL,*rbtmp;
- if (rb == NULL)
- {
- acdbFail(_T("参数太少!"));
- return RTERROR;
- }
- if (rb->restype == RTENAME)
- {
- ads_name ent;
- ads_name_set(rb->resval.rlname,ent);
- if (rb->rbnext == NULL)
- {
- acdbFail(_T("参数太少!"));
- return RTERROR;
- }
- rb = rb->rbnext;
- if (rb->restype != RTSHORT)
- {
- acdbFail(_T("参数错误!"));
- return RTERROR;
- }
- int i = rb->resval.rint;
- bool bAllDxf = false;
- if (rb->rbnext != NULL)
- {
- rb = rb->rbnext;
- if (rb->restype != RTNIL)
- {
- bAllDxf = true;
- }
- if (rb->rbnext != NULL)
- {
- acdbFail(_T("参数太多!"));
- return RTERROR;
- }
- }
- struct resbuf *rbRetList = NULL,*rbRetTmp = rbRetList;
- struct resbuf *rbStr;
- rbStr = acutNewRb(RTSTR);
- rbStr->resval.rstring = _T("*");
- rbdxf = acdbEntGetX(ent,rbStr);
- acutRelRb(rbStr);
- rbtmp = rbdxf;
- while (rbtmp != NULL)
- {
- if (rbtmp->restype == i)
- {
- if (i == -3)
- {
- AcDbEntity *pEnt;
- AcDbObjectId Id;
- acdbGetObjectId(Id,ent);
- acdbOpenObject(pEnt,Id,AcDb::kForRead);
- struct resbuf *rbList = pEnt->xData((ACHAR *)0);
- pEnt->close();
- acedRetList(rbList);
- acutRelRb(rbList);
- acutRelRb(rbdxf);
- return (RSRSLT);
- }
- else if (((-2 <= i) && (i <= -1)) ||
- ((330 <= i) && (i <= 369))
- )
- {
- if (bAllDxf)
- {
- if (rbRetList != NULL)
- {
- rbRetTmp->rbnext = acutBuildList(RTENAME,rbtmp->resval.rlname,RTNONE);
- rbRetTmp = rbRetTmp->rbnext;
- }
- else
- {
- rbRetList = acutBuildList(RTENAME,rbtmp->resval.rlname,RTNONE);
- rbRetTmp = rbRetList;
- }
- }
- else
- {
- acedRetName(rbtmp->resval.rlname,RTENAME);
- acutRelRb(rbdxf);
- return (RSRSLT);
- }
-
- }
- else if (((0 <= i) && (i <= 9)) ||
- ((100 <= i) && (i <= 105)) ||
- ((300 <= i) && (i <= 329)) ||
- ((390 <= i) && (i <= 399)) ||
- ((410 <= i) && (i <= 419)) ||
- ((430 <= i) && (i <= 437)) ||
- ((470 <= i) && (i <= 479)) ||
- (i == 999)
- )
- {
- if (bAllDxf)
- {
- if (rbRetList != NULL)
- {
- rbRetTmp->rbnext = acutBuildList(RTSTR,rbtmp->resval.rstring,RTNONE);
- rbRetTmp = rbRetTmp->rbnext;
- }
- else
- {
- rbRetList = acutBuildList(RTSTR,rbtmp->resval.rstring,RTNONE);
- rbRetTmp = rbRetList;
- }
- }
- else
- {
- acedRetStr(rbtmp->resval.rstring);
- acutRelRb(rbdxf);
- return (RSRSLT);
- }
-
- }
- else if (((10 <= i) && (i <= 37)) ||
- ((110 <= i) && (i <= 230))
- )
- {
- if (bAllDxf)
- {
- if (rbRetList != NULL)
- {
- rbRetTmp->rbnext = acutBuildList(RT3DPOINT,rbtmp->resval.rpoint,RTNONE);
- rbRetTmp = rbRetTmp->rbnext;
- }
- else
- {
- rbRetList = acutBuildList(RT3DPOINT,rbtmp->resval.rpoint,RTNONE);
- rbRetTmp = rbRetList;
- }
- }
- else
- {
- acedRetPoint(rbtmp->resval.rpoint);
- acutRelRb(rbdxf);
- return (RSRSLT);
- }
-
- }
- else if (((38 <= i) && (i <= 58)) ||
- ((460 <= i) && (i <= 469))
- )
- {
- if (bAllDxf)
- {
- if (rbRetList != NULL)
- {
- rbRetTmp->rbnext = acutBuildList(RTREAL,rbtmp->resval.rreal,RTNONE);
- rbRetTmp = rbRetTmp->rbnext;
- }
- else
- {
- rbRetList = acutBuildList(RTREAL,rbtmp->resval.rreal,RTNONE);
- rbRetTmp = rbRetList;
- }
- }
- else
- {
- acedRetReal(rbtmp->resval.rreal);
- acutRelRb(rbdxf);
- return (RSRSLT);
- }
-
- }
- else if (((60 <= i) && (i <= 99)) ||
- ((270 <= i) && (i <= 299)) ||
- ((370 <= i) && (i <= 389)) ||
- ((400 <= i) && (i <= 409))
- )
- {
- if (bAllDxf)
- {
- if (rbRetList != NULL)
- {
- rbRetTmp->rbnext = acutBuildList(RTSHORT,rbtmp->resval.rint,RTNONE);
- rbRetTmp = rbRetTmp->rbnext;
- }
- else
- {
- rbRetList = acutBuildList(RTSHORT,rbtmp->resval.rint,RTNONE);
- rbRetTmp = rbRetList;
- }
- }
- else
- {
- acedRetInt(rbtmp->resval.rint);
- acutRelRb(rbdxf);
- return (RSRSLT);
- }
-
- }
- else if (((420 <= i) && (i <= 427)) ||
- ((440 <= i) && (i <= 459))
- )
- {
- if (bAllDxf)
- {
- if (rbRetList != NULL)
- {
- rbRetTmp->rbnext = acutBuildList(RTLONG,rbtmp->resval.rlong,RTNONE);
- rbRetTmp = rbRetTmp->rbnext;
- }
- else
- {
- rbRetList = acutBuildList(RTLONG,rbtmp->resval.rlong,RTNONE);
- rbRetTmp = rbRetList;
- }
- }
- else
- {
- struct resbuf *rbVar = acutBuildList(RTLONG,rbtmp->resval.rlong,RTNONE);
- acedRetVal(rbVar);
- acutRelRb(rbVar);
- //长整型数无法直接返回
- //acedRetInt(rbtmp->resval.rlong);
- acutRelRb(rbdxf);
- return (RSRSLT);
- }
- }
- if (!bAllDxf)
- {
- break;
- }
- }
-
-
- rbtmp = rbtmp->rbnext;
- }
- if (bAllDxf)
- {
- acedRetList(rbRetList);
- acutRelRb(rbRetList);
- acutRelRb(rbdxf);
- return (RSRSLT);
- }
- acutRelRb(rbdxf);
-
- }
- else if (rb->restype == RSRSLT)
- {
-
- }
- else
- {
- acdbFail(_T("参数错误!"));
- return RTERROR;
- }
- acedRetNil();
-
- return (RSRSLT);
- }
|
|