findBRepUsingRay With Temporary objects

findBRepUsingRay With Temporary objects

ebunn3
Advocate Advocate
495 Views
1 Reply
Message 1 of 2

findBRepUsingRay With Temporary objects

ebunn3
Advocate
Advocate

Will findBRepUsingRay work with a temporary body that is not in the model window?

 

Eric

0 Likes
Accepted solutions (1)
496 Views
1 Reply
Reply (1)
Message 2 of 2

KrisKaplan
Autodesk
Autodesk
Accepted solution

Unfortunately, no. findBRepUsingRay is a method on the Component, so it will only find bodies contained in the component. There isn't an equivalent method for a set of transient brep bodies.

 

You could manually do the equivalent with the geometry APIs. You could first get the Body.boundingBox and disqualify the body if your ray does not intersect the bounds.

Then for each Face (until you find an intersection): 

  • get Face.surface
  • use InfiniteLine3D.intersectWithSurface to check if the ray's line intersects the surface geometry
  • continue if it doesn't intersect
  • continue if the intersection point is 'behind' your starting point for the ray
  • get the face's surface evaluator with Face.evaluator
  • call SurfaceEvaluator.getParameterAtPoint to get the parameter on the surface at the intersection
  • if SurfaceEvaluator.isParameterOnFace is true at that parameter point, the ray hit within the bounds of the face at this point.
  • Continue if you want more than one intersection. Sort results by distance from your ray's start point

Kris 



Kris Kaplan