IntersectWith:判断实体是否相交。
IntersectWith函数的定义形式(1)为:
void IntersectWith(Entity entityPointer,Intersect intersectType,Point3dCollection points,Int32 thisGraphicSystemMarker,Int32 otherGraphicSystemMarker);
第一个参数:entityPointer:实体;第二个参数:intersectType:相交的类型(AcDb::kOnBothOperands:俩个实体都不延伸; ExtendBoth : 两个实体都延伸 ; ExtendArgument :只延伸作为参数的实体(该方法的第一个参数; ExtendThis : 只延伸原实体(调用该方法的实体) )
)第三个参数:获取所有相交的点。
IntersectWith函数的定义形式(2)为:
void IntersectWith(Entity entityPointer, Intersect intersectType,Plane projectionPlane,Point3dCollection points, Int32 thisGraphicSystemMarker,Int32 otherGraphicSystemMarker);
与前一种定义形式相比,多了第三个参数: 当前两个实体相交的投影平面 。
具体用法如例:
AcGePoint3dArray polyLine;//点数组
AcDbPolyline * pPl = ArxUtils::CreatePolyline(polyLine,true);//多段线
if (NULL == pPl)
return false;
Acad::ErrorStatus es;
AcDbEntity *pEntity = NULL;//多段线实体
es = acdbOpenObject(pEntity,arrPolyLineId[nIndex],AcDb::kForRead);
if (es != Acad::eOk)
return false;
pPl->intersectWith(pEntity,AcDb::kOnBothOperands,intersectPoints);
if (intersectPoints.length() > 0)
return true;//有交点