修改多段线的凸度
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了修改多段线的凸度相关的知识,希望对你有一定的参考价值。
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;
}
}
}
以上是关于修改多段线的凸度的主要内容,如果未能解决你的问题,请参考以下文章