For me is here not clear what you mean with 'pipe"
a.) pipe feature
b.) ProPiping module
c.) or any feature geometry which should implement a pipe geometry?
======
So if you have the option b.) in this case I could not provide a help because I am not expert in this module
For the other options for example to define a direction and to find the next surface in this direction you can try to use the function ProSolidRayIntersectionCompute to find all surfaces in a particular vector direction:
// 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.
//
This could be, here a suggestion of the first step. But I think your algorithm needs some time to be implemented step by step, and it is not very probable that someone who did not have a similar project will take the time to implement it. Otherwise is an interesting challenge if you have the time for it. 😉