明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1576|回复: 1

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

[复制链接]
发表于 2013-8-2 10:17:17 | 显示全部楼层 |阅读模式
用法 (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[X];p1.y = pt1[Y];p1.z = pt1[Z];
  }
  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[X];p2.y = pt2[Y];p2.z = pt2[Z];
  }
  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) ;
}
发表于 2013-8-2 17:10:56 | 显示全部楼层
能解释一下这三句是什么意思吗?
acedRetVoid();
  return RTNORM;
  return (RSRSLT) ;
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-11-25 07:35 , Processed in 0.155239 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表