Python: Convert an open curve into a sweep or pipe with radius 1.5mm

Hi,
I want to use python to convert any open curve into a solid pipe following the path of the curve. Making the object have a tube diameter of 1.5mm. Is this possible?

Also is it possible to make this random open curve have smooth curved or fillet edges so it does not have sharp angles in the pipe. I assume we either fillet the curve first, then sweep but I want to automate this in python so the user selects the open curver and changes automatically in a smooth solid pipe.
Thanks.

The title says radius 1.5, the body of the post says diameter…

Are you wanting to just pipe multiple curves “solid” at 1.5 diameter/radius? The normal Rhino pipe command will do this already - just not the intermediate fillet part. Python rhinoscriptsyntax also has an AddPipe() method.

Adding intermediate ‘fillets’ at any kink points is tricky if the curves being piped are non-planar, but probably scriptable (using blends not fillets) with some effort. Otherwise running the equivalent of Rhino’s FilletCorners with an appropriate radius before piping will probably do the trick.

1 Like

FilletCorners only fillets kinks where the curve is planar around the kink. It does not fillet where the curve has a tight radius but is not kinked, nor where the curve is not planar for a sufficient distance around a kink. So the challenge is is how to automate revising a curve such that the minimum radius of the curve is larger than a specified value.

1 Like

Thanks will try this out, regarding diamter/radius apologies, this number is not really important, as long as a pipe of some size is created, preferabbly around that 1.5mm size.

Good insight thank you. The open curve im working with just has straight lines connecting each other. The fillet corners tool works for what I want with a 3D open curve but I want this to work in python.

Yes. I tried to imply that in my first post, but it wasn’t all that clear.

Yes. Perhaps one could analyze the curvature over the entire curve and find the areas where it is smaller than the pipe radius (plus a tolerance margin), cut those areas out and replace them with G1 blend curves. That’s too much math for my tiny brain though. Plus it wouldn’t cover all possible cases like a small fillet between two lines.

I guess in this case I would just do a FilletCorners and then maybe do some checking - to see if any kinks are left in a curve (i.e. it didn’t fillet) or if there is still a spot on the curve smaller than the pipe radius. Then just ignore those curves and signal the user that they couldn’t be processed.