Hide Table of Contents
RayIntersections Method (IModelDoc2)

Intersects a given set of rays with a specified set of bodies.

.NET Syntax

Visual Basic (Declaration) 
Function RayIntersections( _
   ByVal BodiesIn As System.Object, _
   ByVal BasePointsIn As System.Object, _
   ByVal VectorsIn As System.Object, _
   ByVal Options As System.Integer, _
   ByVal HitRadius As System.Double, _
   ByVal Offset As System.Double _
) As System.Integer
Visual Basic (Usage) 
Dim instance As IModelDoc2
Dim BodiesIn As System.Object
Dim BasePointsIn As System.Object
Dim VectorsIn As System.Object
Dim Options As System.Integer
Dim HitRadius As System.Double
Dim Offset As System.Double
Dim value As System.Integer
value = instance.RayIntersections(BodiesIn, BasePointsIn, VectorsIn, Options, HitRadius, Offset)
System.int RayIntersections( 
   System.object BodiesIn,
   System.object BasePointsIn,
   System.object VectorsIn,
   System.int Options,
   System.double HitRadius,
   System.double Offset
System.int RayIntersections( 
&   System.Object^ BodiesIn,
&   System.Object^ BasePointsIn,
&   System.Object^ VectorsIn,
&   System.int Options,
&   System.double HitRadius,
&   System.double Offset



Array of bodies that are hit by the rays (see Remarks)


Array of doubles containing the x,y,z base points of each ray


Array of doubles containing the direction vectors of each ray


Number of options as defined in swRayPtsOpts_e


Radius of hit cylinder; this is used mainly in grazing cases to establish a hit


Length tolerance to use to establish whether a hit on a face represents the entry or exit of the ray from the body (see Remarks)

Return Value

Number of intersections found


The method performs the intersection operations between the specified bodies and the ray vectors. To get the results (a set of intersection points, intersection normals, and the bodies that were hit from your bodiesIn array) of the intersection operations, you must call IModelDoc2::GetRayIntersectionsPoints or IModelDoc2::IGetRayIntersectionPoints and IModelDoc2::GetRayIntersectionTopology or IModelDoc2::IGetRayIntersectionsTopology.

Information returned by IModelDoc2::GetRayIntersectionsPoints, IModelDoc2::IGetRayIntersectionPoints, IModelDoc2::GetRayIntersectionTopology, and IModelDoc2::IGetRayIntersectionsTopology depends partially on the value of the options argument. Valid values can be concatenated together using bitwise operations. See IModelDoc2::GetRayIntersectionsPoints or IModelDoc2::IGetRayIntersectionPoints to see which data is always output regardless of the values specified in the options argument.

For each ray that hits an edge or a vertex, the offset distance is added in both the positive and negative directions along the ray and the points computed are tested for spatial inclusion in the hit body. This determines if the ray was entering, leaving, or just grazing the body at the hit point. Entry and exit onto faces can be computed does not require such an offset.


See Also


SOLIDWORKS 2001Plus FCS, Revision Number 10.0

Provide feedback on this topic

SOLIDWORKS welcomes your feedback concerning the presentation, accuracy, and thoroughness of the documentation. Use the form below to send your comments and suggestions about this topic directly to our documentation team. The documentation team cannot answer technical support questions. Click here for information about technical support.

* Required

Subject:   Feedback on Help Topics
Page:   RayIntersections Method (IModelDoc2)
*   I acknowledge I have read and I hereby accept the privacy policy under which my Personal Data will be used by Dassault Systèmes

Print Topic

Select the scope of content to print:


We have detected you are using a browser version older than Internet Explorer 7. For optimized display, we suggest upgrading your browser to Internet Explorer 7 or newer.

 Never show this message again

Web Help Content Version: API Help (English only) 2016 SP05

To disable Web help from within SOLIDWORKS and use local help instead, click Help > Use SOLIDWORKS Web Help.

To report problems encountered with the Web help interface and search, contact your local support representative. To provide feedback on individual help topics, use the “Feedback on this topic” link on the individual topic page.