Autodesk.AutoCAD.DatabaseServices Namespace > Entity Class > Entity Methods > IntersectWith Method > IntersectWith(Entity, Autodesk.AutoCAD.DatabaseServices.Intersect, Plane, Point3dCollection, IntPtr, IntPtr) Method
Entity.IntersectWith(Entity, Autodesk.AutoCAD.DatabaseServices.Intersect, Plane, Point3dCollection, IntPtr, IntPtr) Method   
Description
Function usage

This method finds the intersections of the entity pointed to by entityPointer and all the edges of the bounding box of this entity. 

The intersectType is used to determine how to deal with extending the two entities in order to calculate intersections. 

Any intersection points found are appended to the points array. All points are in WCS coordinates. 

The thisGraphicSystemMarker and otherGraphicSystemMarker arguments are intended to provide this function with information to allow it to localize the search for intersections to be between specific subentities. However, this function is not required to make use of either of these arguments (most, if not all, of the AutoCAD built-in entity classes do not). When calling this function, either or both of these arguments may be 0 in order to indicate that they should be ignored. 

 

Function implementation in derived classes

This function should do all it can to find all intersection points between the entity it's being called on and the entity pointed to by entityPointer. All intersection points found should be appended to the points array. All such points must be in WCS coordinates. 

When implementing the intersection calculation portion of this function you should take a good look at the graphics classes to see if they can provide any useful functionality to help in finding intersections with the geometric primitives that make up the entity this function is being called on and the entityPointer entity. For example, the Curve3d class has an IsOn() method that will indicate if a supplied point is on the curve and the CircularArc3d class has several IntersectWith() methods to find intersections with other graphics types. 

If the entityPointer entity is a type not recognized by this function, it is quite reasonable to call the entityPointer entity's IntersectWith() method passing in a pointer to this entity as the "entityPointer", and all the other arguments passed into this function (remembering to convert the intType argument If necessary) to see if that entity can determine any intersection points. This is what the AutoCAD built-in classes do. 

Also, don't forget to take into account the intersectType value. The intersectType tells you which, if any, of the two entities should be extended to find "apparent" intersections. It is not required that apparent intersection be supported. 

The thisGraphicSystemMarker and otherGraphicSystemMarker arguments are provided to allow this function to determine exactly which subentities are involved in the intersection operation (for example, if this function is being called by AutoCAD as part of an intersection Osnap operation these arguments would indicate which subentities are within the osnap pickbox). For these arguments, a value less than or equal to zero indicates that that argument should not be used.

Visual Basic
Public Function IntersectWith(
    entityPointer As Entity, 
    intersectType As Autodesk.AutoCAD.DatabaseServices.Intersect, 
    projectionPlane As Plane, 
    points As Point3dCollection, 
    thisGraphicSystemMarker As IntPtr, 
    otherGraphicSystemMarker As IntPtr
) As void
C#
public void IntersectWith(
    Entity entityPointer, 
    Autodesk.AutoCAD.DatabaseServices.Intersect intersectType, 
    Plane projectionPlane, 
    Point3dCollection points, 
    IntPtr thisGraphicSystemMarker, 
    IntPtr otherGraphicSystemMarker
);
Parameters
Parameters 
Description 
Entity entityPointer 
Input entity with which "this" entity is to intersect 
Autodesk.AutoCAD.DatabaseServices.Intersect intersectType 
Input type of intersection requested 
Point3dCollection points 
Output with the points of intersection appended 
IntPtr thisGraphicSystemMarker 
Input GS marker of subentity of "this" entity that's involved in the intersection operation. Use the 0 default if not applicable. 
IntPtr otherGraphicSystemMarker 
Input GS marker of subentity of the entity pointed to by entityPointer that's involved in the intersection operation. Use the 0 default if not applicable. 
Links
   Comments?