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:
(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 ). 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: