I’m working on a script to generante groups of pipes or cables, with randomly placed bands along the length. It’s meant to be used for quick background greebles for industrial, scifi or abstract scenes.
The script is based on Pipe Joints by Buerbaum Martin (Pontiac):
Also Ari Hayrinen’s tutorial ‘Custom objects with Python’:
Thanks to Atom and Lepes for helpful code and feedback.
Feel free to use the script or upgrade it for your own purposes. Please post your results if you come up with anything interesting.
*Currently only available for Blender 2.49 and earlier 2.4x
A minor update:
- Added Reset button. Select Reset and press OK to reset to default settings without creating pipes. Run script again to start from default values.
Keep settings button added. (Default: enabled) Unclick and run once to reset to defaults.
Pipes now created parented to different empty object for each run of the script.
Added Smooth option (default: enabled). Sets all vertical face sections smooth. Flat join rings between pipe and outer band segment are not smoothed. Uncheck for original shape angles.
Added default colors materials (gray and dark gray). Inner pipe color and outer band segments are different colors. Once generated, the colors and surface textures can easily be changed in the material settings, without having to manually select different sections.
Changed some default settings and slider option ranges.
Added new options:
Center Z : Enable to create pipes with center point at Z=0. Disable to create pipes starting from Z=0. Disable when creating variable length pipes to align bottom edge of all pipes.
Cap Ends : Caps Ends, same as Blender standard cylinder option
Uniform pipe : Create equal length pipe segments (between bands), rather than random. (default is random)
Uniform bands : Create equal length bands, rather than random. (default is random)
v.01 Initial Release
Questions from original post (now answered, thanks!):
I’m just starting out with scripts, so I have a few questions.
The objects are created with BPyAddMesh:
verts, faces = addPipe(pipeRadius, divInput.val, pipeLength, thickness, coverage, int(numBands), xOffset, yOffset) BPyAddMesh.add_mesh_simple('MultiPipes', verts, , faces)
How can I set Set Smooth on certain areas only (the long curved areas, but not the flat joins between segments)? Do I have to set that after BPyAddMesh.add_mesh_simple creates the object, or is there some way to set it or keep track of different faces while they are generated?
Similarly, how can I set two materials, one for every other segment, so the outer bands can easily be set to a different color and texture?
How can I create the set of pipe objects as one group, so each time the script is run, there is a new group set? Right now, the objects are all just created in a long list, so if the script is run twice, it’s hard to keep each set apart in the Outliner.
What are reasonable limits on input values? For example, the input range I have for the length is (0.01, 100). Can I go up to 1,000 or higher? What’s recommended? When will I run into limits?