马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
 - 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) ;
- }
|