int myExtendPolyline(AcDbPolyline* pl,double sOff,double eOff)
{
ASSERT(pl);
if (pl->numVerts() < 2)
{
return 0;
}
if (sOff > 0)
{
AcGePoint3d sPt,sPt2;
pl->getStartPoint(sPt);
pl->getPointAt(1,sPt2);
double td1,td2;
pl->getDistAtPoint(sPt,td1);
pl->getDistAtPoint(sPt2,td2);
double off = td2 - td1;
double sParam = fabs(sOff) / off;
if(pl->extend(-sParam) != Acad::eOk)
{
ASSERT(0);
return 0;
}
}
if (eOff > 0)
{
AcGePoint3d ePt,ePt2;
pl->getEndPoint(ePt);
pl->getPointAt(pl->numVerts() - 2,ePt2);
double td1,td2;
pl->getDistAtPoint(ePt2,td1);
pl->getDistAtPoint(ePt,td2);
double off = td2 - td1;
double eparam = fabs(eOff) / off;
if(pl->extend(eparam) != Acad::eOk)
{
ASSERT(0);
return 0;
}
}
return 1;
}
AcDbCurve::extend 延长指定多义线的前后长度
最新推荐文章于 2024-08-11 23:28:31 发布