自己搞定了,选择集要作为返回值传递给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) ;
- }
|