修改多段线的凸度
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;
ptCur.y=result.resval.rpoint;
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;
}
}
}
页:
[1]