is there a python pipe tool ? extrude poly ring along poly line

Hi guys

is there a python script which can extrude a polgon like a square or ring along a polygon line?

The twist bug in Blender’s curves render them unusable for generating pipes for pipe chairs.

Like a curly-cue twist, or some other elaborate design? I used the bezier curve and bezier circle while following along a tutorial that I downloaded where I made a canvas and pipe poolside (or lawn) chair. It seemed okay with me, but I did some tweaking here and there after I converted it to a mesh.

I’ve been wanting to do more elaborate designs with the curves, which is why I took an interest in your post about this. If there is some magical way, such as, with a python script, or tactical technique to get around potential problems, I second your request to learn more.

Use dupliverts to clone your cross section down the poly line(or curve), make real , combine them into one object, select them then hit the fkey —> skinfaces/edgeloops.

for a curve you could animate your cross section down the curve with a constraint then use dupliframes… use the framestep to set the number of crosssections…


I looked into the dupli verts trick also had rotate activated but the cross sections
are kinda not as much rotated as needed.

here is a screen-shot

maybe something I missed?

I see the dupli verts orientation only works fine when you work on faces BUT not on lines.

see the image:

have you tried with curve modifer and array to make a pipe isntead ?

there was a thread a fe days ago on this

very interesting way of doing pipe !

also there is a script to do Y Tee pipe joint but for mesh only no curves here
search wiki script list for it of forum here

hope it helps

In anycase, both curve deform and duplis with rotations will be affected by the twist bug.

You can use a recent build of the 2.4 branch or a 2.5 build that should both have fixes for twist, save convert to mesh then append the result in your main file.


hi teeth

i looked into both 2.49 and 2.5 (win/mac) and both have the twist bug still present.

what fix are you talking about? Maybe I am missing something on my side.


Hi there… I wanna ask what are images attached by cekuhnen? If they are products of dupli work or something else?

In general, I have worked a little bit on the idea of developing a script which can do this - bend a pipe or extrude a contour along a path, etc. In principle I know what it should do, just I havent implemented this in Python…

Lets take a very simple example… bending a pipe with normal at 90 degrees. Lets take it that the pire has a section of a circle with radius r and we would like to bend it on radius R. Following the method for bending pipes widely used in industry (there are such manual or automatic machines), R should be the internal radius of the pipe at its bent section. Therefore the outer radius is to be R+2*r and the radius at the middle of pipe = R+r. At first I wanted to use the middle radius but after selecting the parameters R and r, the script needs to calculate if it is possible to bend the “pipe” using these parameters as middle radius should comply with the requirement Rmiddle >= R+r. So it is not a very nice approach (to use the middle radius although it is very comprehensive of what you’re doing). Sooo lets use R and r as parameters and, if needed, to calculate Rmiddle… Virtually, the radius which you use for bending can be = 0. In practice, R is always >= r and that is why I like to use the capital letter R for the radius which is used to bend the pie and r for the radius of pipe’s section (if it is a circle as in the case above). Sooo after getting the parameters R and r => it could be easy to generate the knee of the pipe. Two more parameters are needed for constructing a pipe knee: N_sections --> the number of sections within the knee and the angle of bending… Phew… then the script should rotate properly the sections to be used for knee and ONLY after connecting all these, the knee will be ready… Frankly, more problems can come from from determing the stright parts of the pipe…

I think I can re-start my work on this type of a script. My idea is to make it use each closed contour… It would be nice, I think! :slight_smile:

Without such a script, everyone can simulate its work like this:

TASK: Produce a knee pipe with parameters R = 1; r = 1; N_sections = 9 and angle_of_knee = 90.


  1. With your 3D-cursor at (0,0,0), add a circle with radius = 1. Choose the number of verts of the circle yourself…
  2. Suppose that the circle lies at XY plane => goto side view (NUMPAD 1 key) and go to editmode (TAB). All verts should be selected (select them, if they are not) and move the whole circle 2 units to the left. (this also works in object mode… the trick is that R should be equal of the distance from the closest point of the circle to the 3D-cursor. And the starting angle is the angle those 2 points make with the coordinating axis OX)
  3. Using the settings given (actually these are default settings of this panel), click on Spin button:

  1. TADAAAAAAA… You already have your pipe knee in the scene! :slight_smile: Now just extrude to the left the last circle of the knee and also extrude down the first one:


*** You’re done!!! ***

Should you like to have a knee also at the bottom end of the object shown upwards, just move the 3D-cursor at (-4,0,-4) and click Spin button again… This will produce another knee at the bottom. Virtually, you may “bend” your pipe in the form you like - just take care of where your end section is and where your 3D-cursor is… and the number of sections in the knee plus its angle. This will be slower that using a script, of course! :wink:

Hope this helps!


In 2.5, you have to change the Twist method (in the curve properties) from Z-up to Tangent or Minimum. In 2.4x, it’s the little auto toggle button in the curve settings.


One thing you can do is to simply use the built in feature of the curve itself.

Create a curve,
Disable the Front and Back buttons, activate the 3D button.
Increase the bevel depth and the curve becomes a tube.
With the bevel resolution of zero, the tube is a square, increase the resolution to go through polygon up to circle.

I may be wrong, but I don’t think the basic curve is affected by the z-twist bug. It’s only when you add a Bevel OB to the curve that this appears.

So it could work if all you really need is square, polygon or circle, like you mention in your original post.

I recently did an exhaustive search of the forum for a Blender solution to the 3DSMax feature of lofting. No luck.

sorry. completely wrong.
the built-in bevel feature is subject to the same bug.
left is with a bevel object, right is with built-in bevel.


2.5 OS X has the twist method option but it does not work.

Martin I do not know which Auto Toggle button you refer to in 2.49.2 ???

WE , not me, we looked everywhere for it. Any chance it is somewhere else?

Oh I see now.

The win 2.5 version works and also the win 2.49.2 works.

The OS X versions do not have those features working (2.5) or
even build in (2.49.2)


Python scripts: “tree from curves.”

It’s very helpful when doing twisting, twirling, graceful curves in any direction. It gets rid of that stupid twist problem you get with bev objects.

so you can do that as well for just simple pipes or square cross section bars?

Yay, another use for the spin duplicates tool… I try to use that bezier curve tool, but my pipes end up twisted, it drives me nuts. thats much neater and exact.

the windows version of 2.49b has a twist bug fix for working with curves.

I guess that is why I was not experiencing it in my suggestion of not using the bevOB. I am using that version. So I guess I am not totally wrong spaceTug.

I have Blender 2.5 build 23358 on Mac OSX and the twist method option appears to be working.

2.5 has in deed the twist fixed.

but because 2.5 is not really ready to be used I cannot expect my students
to work with it.