Category Solids and parts, Object ProSolid

Function ProSolidRayIntersectionCompute


Description
Returns a list of ray intersections with a model. The function computes the intersection points of both the original ray and its "negative" with the geometry of the model. The output array is sorted in order of increasing signed distance. It is the responsibility of the user to find whether the ray is inside or outside the model.

If a ray hits in the middle of a face on the model, the face is selected. If however, the intersection point is very close (within an internally determined selection aperture) to an edge is also selected. Thus, more than one entry of type surface or edge in the ProSelection array may correspond to one actual piercing of the model by the ray.

In an assembly, each part is processed separately. Therefore, if two coincident mating faces are hit, these will be recorded as two separate hits, because they are on two distinct faces.

You can set the default value of the aperture_radius using the configuration file option "pick_aperture_radius value" (the default is 7). This is the radius, in pixels, that controls whether a ray is close enough to an edge for it to be counted as a ray hit.

Replacement in Object TOOLKIT: wfcWModel::ComputeRayIntersections
Synopsis
#include <ProSolid.h>
ProErrorProSolidRayIntersectionCompute(
ProMdl model
/* (In)
The part or assembly through which the ray is shot.
*/
double aperture_radius
/* (In)
The value of pick_aperture_radius. If the value is less than or equal to 0.0, the function uses the default value (7.0), or the current value in the configuration file.
*/
ProRay* p_ray
/* (In)
The starting point of the ray and the direction vector (defined as X,Y,Z). The vector is normalized within the function before it is being used.
*/
ProSelection** p_sel_arr
/* (Out)
An array of ProSelection, one for each selection made. The geometry is in terms of the coordinate system of the part being intersected, not the parent assembly. The function allocates the memory for this argument, and reuses it on subsequent calls.
*/
int* p_count
/* (Out)
The number of selections in p_sel_arr. If the ray does not intersect the model, p_count is 0.
*/
)
Returns
PRO_TK_NO_ERRORThe function successfully retrieved the information.
PRO_TK_E_NOT_FOUNDNo objects were found in the workspace.
PRO_TK_BAD_INPUTSOne or more of the invalid arguments are invalid.

Manual References:

  1. Pro/DEVELOP to Creo Toolkit Function Mapping: Equivalent Pro/DEVELOP Functions
  2. Fundamentals: Objects and Actions
  3. Core: 3D Geometry: Ray Tracing
  4. Core: 3D Geometry: Ray Tracing
  5. User Interface: Selection: Unpacking a ProSelection Object

Sample Code References:

  1. pt_examples ( TestSolid.c )
  2. pt_examples ( TestRay.c )