最近点用pickPoint来计算,垂点用lastPoint计算.
一般AcDbCurve类可以用AcGe类的 getClosestPointTo 来实现计算需要的点值.
下面是代码示例:
case AcDb:: kOsModeNear:{AcGeLine3d line3d(m ptA,m_ptC);AcGePointOnCurve3d tmpPt;line3d. getClosestPointTo(pickPoint, tmpPt);AcGePoint3d pt=tmpPt pointO;snapPoints. append(AcGePoint3d(pt));line3d. set(m ptB,m_ptD);line3d. getClosestPointTo(pickPoint, tmpPt);pt=tmpPt pointO;snapPoints. append(AcGePoint3d(pt)};break;case AcDb: kOsModePerp:{AcGeLine3d line3d(m ptA,m_ptC);AcGePointOnCurve3d tmpPt;line3d. getClosestPointTo(lastPoint, tmpPt);AcGePoint3d pt=tmpPt pointO;snapPoints. append(AcGePoint3d(pt));line3d. set(m_ptB,m_ptD);lime3d. getClosestPointTo(lastPointtmpPt);pt=tmpPt pointO;snapPoints. append(AcGePoint3d(pt));}break;
