# Invert effect of the pipe function

Hi there,
I’d like to script a function which would analyse a pipe-shaped polysurfaces (steel reinforcements). The aim is to find the developped length and diameter of each selected geometry.
I’ve got hundreds of them and I cannot imagine doing it manually.
Here is an example of what I’ve got :

Any advice would be much appreciated
Thank you

Hi @BaptisteC,

pipes created in Rhino do have specific properties on which a possible script could rely. Not shure if this applies to your pipes. If every pipe is a capped polysurface or surface, you could explode and measure the diameter from the planar cap borders. If the diameters are all same, the pipe has constant diameter. If they are not capped, you could duplicate the borders, and check if they are circular, then get the diameter.

Getting the pipe length(s) is more difficult. If the pipes where created in Rhino, you have to find the initial pipe curve(s) first. Usually, a pipe surface or polysurface has the length side along U-direction and the radial side along V-direction. (if created in Rhino). If you suppose that, you could create two opposite isocurves per pipe segment and tween a curve between them. This is the originating pipe curve from which you could measure the length from. Do this for every pipe segment (in case of a polysurface) and add all lengths together. This would be the length of one pipe.

c.

Hi Clement,
Thank you for your reply.
Indeed, the diameter will be quite easier to determine than the length of these pipes. Moreover, they all have constant diameter (3, 4, 5, 6, 8, 10, 12, 14, 16 or 20 mm). By extracting caps of the pipe I should be able to find the diameter with an acceptable accuracy.
Unfortunately, this has not been created in Rhino, so I cannot consider the geometry as a perfect pipe-shaped. I noticed that some of them are open and few little parts of surfaces may be missing depending on the object. But I don’t need the exact length (ceiling to centimeter should be enough), so I guess I could maybe start with rebuilding an approaching pipe. Which is kind of difficult without having the initial curve …
Anyway, I will investigate your idea of evaluating opposite points on the pipe and analyse their intermediate curve.
Let’s start

Hi @BaptisteC,

if the pipes are coming from a different application, you cannot rely on uv directions. But you may check this by analyzing the closed direction of the pipe surface. Below is an example with all you need to measure diameter, make the tween curve and get its length etc.

To prevent measurement errors, consider what happens if a pipe is trimmed (unshrinked) or if a cap is not planar. eg. create a polysurface pipe from a rectangle curve… there are various possible error cases, all can be handled

MeasurePipe.py (3.5 KB)

c.