286168051 发表于 2013-8-2 10:17:17

ARX定义lisp函数之-创建直线

用法 (CREATELINE pt1 pt2)
static int ads_createline(void)
{
//----- Remove the following line if you do not expect any argument for this ADS function
struct resbuf *rb =acedGetArgs () ;
// TODO: add your code here
if (rb == NULL)
{acdbFail(_T("参数太少"));
acedRetVoid();
   return RTERROR;
}
ads_point pt1;
AcGePoint3d p1;
if (rb->restype == RTPOINT || rb->restype == RT3DPOINT)
{
   ads_point_set(rb->resval.rpoint,pt1);
   p1.x = pt1;p1.y = pt1;p1.z = pt1;
}
else
{
   acdbFail(_T("参数错误"));
   acedRetVoid();
   return RTERROR;
}
rb = rb->rbnext;
if (rb == NULL)
{
   acdbFail(_T("参数太少"));
   acedRetVoid();
   return RTERROR;
}
ads_point pt2;
AcGePoint3d p2;
if (rb->restype == RTPOINT || rb->restype == RT3DPOINT)
{
   ads_point_set(rb->resval.rpoint,pt2);
   p2.x = pt2;p2.y = pt2;p2.z = pt2;
}
else
{acdbFail(_T("参数错误"));
acedRetVoid();
   return RTERROR;
}

if (rb->rbnext !=NULL)
{
   acdbFail(_T("参数太多"));
   acedRetVoid();
   return RTERROR;
}
AcDbLine *pLine = new AcDbLine(p1,p2);
AcDbBlockTable *pBlkTbl;
acdbHostApplicationServices()->workingDatabase()->getSymbolTable(pBlkTbl,AcDb::kForRead);
AcDbBlockTableRecord *pBlkTblRcd;
pBlkTbl->getAt(ACDB_MODEL_SPACE,pBlkTblRcd,AcDb::kForWrite);
pBlkTbl->close();
AcDbObjectId entId;
pBlkTblRcd->appendAcDbEntity(entId,pLine);
pBlkTblRcd->close();
pLine->close();
acedRetVoid();
return RTNORM;
// TODO: Replace the following line by your returned value if any
acedRetVoid () ;

return (RSRSLT) ;
}

wangph 发表于 2013-8-2 17:10:56

能解释一下这三句是什么意思吗?
acedRetVoid();
return RTNORM;
return (RSRSLT) ;
页: [1]
查看完整版本: ARX定义lisp函数之-创建直线