Auto-find good pipe thickness

Hi community!

I have lots of winding curves and, some of them have tiny radius/sharp curvature (not sure what’s the right term, sorry!)

I need to visually check those tiny-radius curves to make sure they don’t self-intersect (if they do, I need to lower the radius to get valid geometry)

Is there a way to automate this process? (find the largest pipe radius such that, none of the curves have self-intersection when turned into pipe with this radius value––without me visually checking the preview)

Thanks a ton!
pipe_radius.gh (20.7 KB)

Does the radius adjustment need to be the same for all curves or are the self-interesting ones the only ones you decrease the radius for? Not necessarily the full solution but if you get the cross sections, or projections, of these objects and check for curve self-intersections then you can dispatch the parent curves and adjust their radii.

1 Like

Take a look at this topic, it has a script example to find self intersections:

I think instead of changing the radius for each problematic curve, maybe you could also just Shrinkwrap when there are self intersections on a mesh?

mesh_self_intersections_shrinkwrap.gh (29.3 KB)

2 Likes

you could probably write a gh script that uses CurvePlane() method to iteratively go through a number of of sample points on the curve and check for the smallest distance between the intersection points. if you return that smallest distance, you can set your pipe radius to be smaller than that

1 Like

Thanks so much for your help René, Martin, and Adel! (I just got back to computer to write this message)

It makes a lot of sense to use the resulting pipe and detect intersection there. Perhaps there is some math behind it––that which allow us to infer the radius at which those intersections would happen directly from the curve itself! :thinking:

I also found this discussion Help in removing self-intersections within a brep - Grasshopper. Nik Willmore mentions using marching cubes to make the pipe. Though that discussion is about a different kind of (benign, rather than broken surfaces) self-intersection, the marching cubes method should apply here–creating a reasonable volume even at failing radii.