TA的每日心情 | 开心 6 小时前 |
---|
签到天数: 20 天 [LV.4]偶尔看看III
管理员
- 积分
- 1393
|
- static void zffObjectARX采用MyCommand5(void)
- {
- ads采用point pick;
- ads采用name name;
- if (acedEntSel(NULL,name,pick)!=RTNORM)
- {
- return;
- }
- AcGePoint3d ptClosest;
- AcDbObjectId polyId;
- double param;
- AcDbPolyline* pPoly=NULL;
- acdbGetObjectId(polyId,name);
- acdbOpenObject(pPoly,polyId,AcDb::kForWrite);
- pPoly->getClosestPointTo(asPnt3d(pick),ptClosest);
- pPoly->getParamAtPoint(ptClosest,param);
- int vernum=int(param);
- int vernumEnd=int(param+1);
- AcGePoint3d ptS,ptE;
- pPoly->getPointAt(vernum,ptS);
- pPoly->getPointAt(vernumEnd,ptE);
- pPoly->close();
- AcGePoint2d ptCur;
- int track=1,type;
- struct resbuf result;
- while (track>0)
- {
- acedGrRead(track,&type,&result);
- ptCur.x=result.resval.rpoint[X];
- ptCur.y=result.resval.rpoint[Y];
- AcGeCircArc2d arc(CPointUtil::ToPoint2d(ptS),ptCur,CPointUtil::ToPoint2d(ptE));
- AcGePoint2d ptCenter=arc.center();
- AcGeVector2d verS(ptS.x-ptCenter.x,ptS.y-ptCenter.y);
- double angleS=verS.angle();
- AcGeVector2d verE(ptE.x-ptCenter.x,ptE.y-ptCenter.y);
- double angleE=verE.angle();
- double bulge=(angleE-angleS)/pi();
- acdbOpenObject(pPoly,polyId,AcDb::kForWrite);
- pPoly->setBulgeAt(vernum,bulge);
- pPoly->close();
- if (type==3)
- {
- track=0;
- }
- }
- }
复制代码 |
|