Finding Hole Diameter

I am new to Three Js
I want to identify there is hole in uploaded stl file
Not able to find out this solution
Can you give me suggestion for it?

I want to identify there is hole in uploaded stl file

This doesn’t sound like a three.js problem, but rather a CAD/3D printing problem.
Why do you need to find the hole? Is it for 3D printing?

You might get better results on a different forum. For example, someone asked the same question here:

You could try searching further in that forum.

1 Like

Providing a file and/or a screenshot at least would help to understand your issue.

1 Like

Yes ,
It is for 3D Printing
Actually i want to find hole diameter of uploaded stl file
for that i have to identify hole in uploaded file

You can use Raycaster.
Find a point of intersection on the hole’s surface. It’s raycaster’s origin.
Get intersection’s face’s normal and convert it into world space. It’s raycaster’s direction.
Set raycaster’s origin and direction.
Find intersection point. Highly likely, it’ll be opposite to the previous point you found.
Find distance between points. This is the diameter you’re looking for.

1 Like

Can you give simple demo?

I sending the screenshot of stl file which have hole
Also send the stl file
Hole.stl (89.7 KB)

I think your problem is a lot harder than it appears originally.

If you want to find the dimensions of a hole, that’s relatively easy to do using discretization of some sort, like casting rays from center of the hole and then measuring distance between closest set of opposing contacts or something like that.

What you said in the last post though, “finding this hole” - that part is not trivial for arbitrary polygonal meshes. To identify something as a hole would require a special algorithm which is not known to me. I suggest reading some mathematics and CAD related papers on topology analysis for that.

1 Like

I thought about it a bit, you could trace paths using Djikstra’s from every polygon to every other polygon, and find looping paths. If there exists a looping path who’s combined curvature is positive - relative to triangle normal - you found a path that forms a hole. When i say “positive curvature”, I mean that the next triangle in the path has its normal pointing inwards toward the previous triangle’s normal.

The performance of such an algorithm would be O(n^3), where n is number of triangles. Which is to say - it would be pretty bad, but it would work. And it would find all loops that contribute to topological holes.


Have you got solution on this sonali??