- 积分
- 2646
- 明经币
- 个
- 注册时间
- 2011-1-1
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
楼主 |
发表于 2013-8-14 20:09:35
|
显示全部楼层
luowy 发表于 2013-8-14 10:51
选择集用完是要释放掉的,
既然用arx了,干嘛还要用lsp?
自己搞定了,选择集要作为返回值传递给Lisp,就不能释放!
- //连续画直线,返回选择集
- static int ads_line1(void)
- {
- struct resbuf *pArgs =acedGetArgs () ;
- //判断第一点
- AcGePoint3d p1;
- if (pArgs == NULL)
- {
- acdbFail(_T("\n参数错误"));
- return RTERROR;
- }
- if (pArgs->restype == RTPOINT)
- {
- AcGePoint2d p;
- p = asPnt2d(pArgs->resval.rpoint);
- p1.set(p.x,p.y,0.0);
- pArgs = pArgs->rbnext;
- }
- else if (pArgs->restype == RT3DPOINT)
- {
- p1 = asPnt3d(pArgs->resval.rpoint);
- pArgs = pArgs->rbnext;
- }
- else
- {
- acdbFail(_T("\n参数错误"));
- return RTERROR;
- }
- //判断第二点
- AcGePoint3d p2;
- if (pArgs == NULL)
- {
- acdbFail(_T("\n参数错误"));
- return RTERROR;
- }
- if (pArgs->restype == RTPOINT)
- {
- AcGePoint2d p;
- p = asPnt2d(pArgs->resval.rpoint);
- p2.set(p.x,p.y,0.0);
- pArgs = pArgs->rbnext;
- }
- else if (pArgs->restype == RT3DPOINT)
- {
- p2 = asPnt3d(pArgs->resval.rpoint);
- pArgs = pArgs->rbnext;
- }
- else
- {
- acdbFail(_T("\n参数错误1"));
- return RTERROR;
- }
- ads_name ent,ss;
- AcDbObjectId IdLine;
- IdLine = CCreateEnt::CreateLine(p1,p2);
- acdbGetAdsName(ent,IdLine);
- if (acedSSAdd(ent,NULL,ss) != RTNORM)
- {
- acdbFail(_T("\n实体添加错误1"));
- return RTERROR;
- }
- p1 = p2;
- while (pArgs != NULL)
- {
- if (pArgs->restype == RTPOINT)
- {
- AcGePoint2d p;
- p = asPnt2d(pArgs->resval.rpoint);
- p2.set(p.x,p.y,0.0);
- pArgs = pArgs->rbnext;
- }
- else if (pArgs->restype == RT3DPOINT)
- {
- p2 = asPnt3d(pArgs->resval.rpoint);
- pArgs = pArgs->rbnext;
- }
- else
- {
- acdbFail(_T("\n参数错误1"));
- return RTERROR;
- }
- IdLine = CCreateEnt::CreateLine(p1,p2);
- acdbGetAdsName(ent,IdLine);
- if (acedSSAdd(ent,ss,ss) != RTNORM)
- {
- acdbFail(_T("\n实体添加错误2"));
- return RTERROR;
- }
- p1 = p2;
- }
-
- acedRetName(ss,RTPICKS);
- return (RSRSLT) ;
- }
|
|