ObjectARX自定义实体实现TR(TRIM)命令

ObjectARX自定义实体需要重载实现subIntersectWith和getSplitCurves方法。

// 2020-10-13 by www.cnblogs.com/ztcad
virtual Acad::ErrorStatus subIntersectWith(const AcDbEntity *pEnt, AcDb::Intersect intType, AcGePoint3dArray points, 
    Adesk::GsMarker thisGsMarker = 0, Adesk::GsMarker otherGsMarker = 0) const;
virtual Acad::ErrorStatus subIntersectWith(const AcDbEntity *pEnt, AcDb::Intersect intType, const AcGePlane& projPlane, AcGePoint3dArray points, 
    Adesk::GsMarker thisGsMarker = 0, Adesk::GsMarker otherGsMarker = 0) const;

//- Closest point on curve.
virtual Acad::ErrorStatus getClosestPointTo (const AcGePoint3d givenPnt, AcGePoint3d pointOnCurve, Adesk::Boolean extend =Adesk::kFalse) const ;
virtual Acad::ErrorStatus getClosestPointTo (const AcGePoint3d givenPnt, const AcGeVector3d direction, AcGePoint3d pointOnCurve, Adesk::Boolean extend =Adesk::kFalse) const ;

//- Get split copies of the curve.
virtual Acad::ErrorStatus getSplitCurves (const AcGeDoubleArray &params, AcDbVoidPtrArray &curveSegments) const ;
virtual Acad::ErrorStatus getSplitCurves (const AcGePoint3dArray &points, AcDbVoidPtrArray &curveSegments) const ;

 subIntersectWith实际是第二个方法起作用,用于交点判断,

getClosestPointTo用于最近点判断,如果少了这个函数,将会删除裁剪返回的所有实体。

getSplitCurves返回裁剪后的实体。

posted @ 2020-10-13 14:07  智图CAD  阅读(837)  评论(2编辑  收藏  举报