- 积分
- 2672
- 明经币
- 个
- 注册时间
- 2010-9-7
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
用法 (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) ;
}
|
|