PGR-Meandering-Paths - a script to make jumbled 3D-Paths

Hi Forum,

I needed some jumbled cables for a background and thought it might be a good reason to get to know the python-scripting-side of blender. So I started my first steps in python last week to build me a script, that can create “meandering paths”. Now the script does almost what I want it to do (a few things don’t work at all yet, and one thing does not work the way I want it to work), so I’d like to share that script with the blender-community. Maybe it will be useful for some purpose or some other …

Because I don’t know, how to publish python-scripts “the common way”, I just make it public with this thread, hope nobody minds.

You can find the script (and a short explanation in german, maybe I’ll switch that to english some day; the script itself is in english) here:
resp. here:
(had to append a .txt to the file because of the webserver)

If you’d like to, you may test it, use it, and if you even like it: … tellmeso. :eyebrowlift:

Short description (the complete description can be seen by pressing the help-button):

It creates a blender curve, type 3D, and also (when wanted) one of three kinds of objects (circle, ractangle, hexagon), that it uses as bevel-object for the created paths. It creates the paths within the bounding-box-area of a selected mesh (which you got to create beforehand). There are several different types of random “meandering” (and two types of spring-functions; wanted to try some of the math-stuff, I learned long time ago at school :slight_smile: ). You can set the amount (number? count?) of paths it will create, you can set the diameter of the bevelobject, you can set the type of “startpoint-distribution”, you can let the last point of the curve sit opposite of the startpoint, you can let it unlink the preselected bounding-box-mesh, you can let it unlink everything it created during one session and you can even let it create just the 3D-curves.

It’s V0.0.1 (and my first contact with python at all), and the main annoying disadvantage is, that it doesn’t automatically assign a material to the created 3D-Curves. It seems as if one cannot set a material to a curve with an assigned bevelobject from the script-api?

Also I’d initially planned to let it optionally make paths that don’t intersect. The button is still there, but it’s out of function at the moment; the math needed for that is a bit too far for my brain yet. I quarried the sourcecode of linux’s “pipes-screensaver”, but I can’t use their way, because I just create curves, they create gl-meshes and let gl find out if there are intersections. I don’t know how to port that to my curve-method …

Two other thing that need to be changed are the “startpoint distribution #2” (I had several ways for that, but neither one quite satisfied me), and also it might be a good idea to make all the created objects child to each other recursively, or create an empty which’ll be parent to them or something like that. I’m not sure, what’ll be the best way. At the moment it just creates it’s objects, which kind of stuffs the outliner-view, when it made many curves.

But it creates some nice stuff anyhow, so give it a try … :eyebrowlift:

Regards …


hi, that’s a wonderful script, very interesting results.
well done.

Worked for me!
I thought it was odd that my geometry was “inside” the cube I selected. At first I thought the script did nothing until I moved the cube to another layer.
I like the fact that you can still edit the handles and reshape the curves. I don’t mind intersections, I can always move them out of the way.

What I would like to see is some kind of animation in the form of empties “hooked” into the curves and set into motion.
Also automatic material assignment would be nice as well. I have been looking for python code, myself, that would generate an image mapped material.

> I thought it was odd that my geometry was “inside” the cube I selected. At first I
> thought the script did nothing until I moved the cube to another layer.

Ups, you’re right. Good to hear that, that needs to be changed. I’ll probably set the drawing mode of the preselected mesh to wire in the next version.

[update] I changed that quickly. so the version is now 0.0.2 and the pre-selected mesh’s drawingType is set to wire

> What I would like to see is some kind of animation in the form of empties “hooked” into
> the curves and set into motion.

Sounds kind of complicated to me … but i had an animation-functionality in mind. I have to get deeper in the Blender-API for finding out, how that works so it will probably take some time until I can struggle with that.

> Also automatic material assignment would be nice as well.

Yeah that no-material-assigning is really annoying. But it seems, as if there is no way of assigning material to curves from the script-api? In fact my script does assing the selected material (if any is selected) to the curves, and it does that without any errors, but the result is bare of any material. I searched the API-Doku and other scripts for that, but it seems as if everybody is just assigning material to meshes, not to curves with an bevelobject assigned to it.

But I’ll try to find a solution for that problem …

regards Paddy

Nice script!! Loads of fun to be had here!
Is the bevel object available for further manipulation? (circle,square,hex is a bit limiting)
I’d love to see non-intersecting paths… (pretty hard to pull off though…)
Keep up the good work!! I’m awaiting the new and improved v0.0.2! Oops… v0.0.3
Can’t really think about other whishlist items that are relatively easy to pull off right now…

> Is the bevel object available for further manipulation? (circle,square,hex is a bit limiting)

Yes. After the script has done it’s job, the bevelobject sits 0.5 blenderunits to the left of the whole created stuff (on 0.5 bu less than the bounding-box’s minimum x-value and in the center of the y- and-z values) and can be edited like any other normal blender-curve. That’ll change the appearance of the meandering objects.

Version 0.0.3 is now the newest. You can set the DefResolU for the curves beforehand now and I also splitted the erasing function into two buttons, one erasing all created objects and the other erasing just the last created objects.



About materials…

You could simply convert the curves to meshes, then material assignment via code may be possible?
If you just want the curves, you could leave the Assign Material button unselected.

This reminds me of the Neil Blevins “Wires” MaxScript for 3DSMax.

> […]
> You could simply convert the curves to meshes, then material assignment
> via code may be possible?
> […]

Yes, it would be no problem then, but when the script converts the Curves to meshes, one could not quickly edit the result by just dragging around the curve-points and -handles (named CurNurbs within Blender). That’s the reason why I wrote the script, because I wanted the result to be editable without deforming the extrusion-profile. Or better said: I want both to be editable separately.

OK, the actual version is now 0.0.4.
The material assignment finally works and all created objects are now parented to an empty the script creates (what keeps the outliner a bit tidyer).

Location is the same as before:

Have fun and goodnight …


I tried deforming the Bevel CurveCircle, but all it did was deform that very circle, NOT the tubes… Am I missing something?

Maybe you got to select the “tubes”, enter edit-mode once and leave it again?
Have you tried rendering your scene after deforming the bevel-object?
Technically the bevelObject is assigned to each 3D-Path as (you guess it) “BevOb” which stands short for bevel-object. That’s to be seen under blenders editing-window (F9).

Maybe it has something to do with your graphics-card that the screen is not updated? But at least after some time blender should update it’s view and also render the scene with the changed bevelObject.

Regards Paddy

Ok the script skipped some version-steps but I hope that’s OK. Now we got optionally animated 3D-Paths, yeah! gg Version is V0.1.0. It seems to me, as if the GUI need’s some tidying up … :frowning:

Anyway: regards and have fun with the script … :wink:


V0.1.2 now:

  • origins of the 3D-Curves are at the center of the bounding box now.
  • animation-method is changed now, so that the Paths don’t tangle up near the center of the bounding-box
  • also the animation-dampening system is kind of improved …
  • also fixed the chaotic deformation of the bevelled 3D-curves when the bounding-box was not located at the scenes center (did that in V0.1.1).



WOW! Thank you soooo much. This is just what I needed (doing it by hand was taking waaay too long). I hope this gets included in the regular blender distribution.

This is also the perfect partner for the Discombobulator… greeble here I come!


Hi KevinW,

thanks for the compliments :slight_smile:

> […] (doing it by hand was taking waaay too long) […]

That’s the reason, why I wrote the script g

Feel free to post results. I’d like to see things that were made with it …



the link turns up blank…firefox says it can’t find the page???

Site is up, link should work:

thanx a lot just download the script…will have fun!!!

Very nice script I just tried it on the default cube and it worked without incident. I will do some detailed work with it later and let you know how it goes