6
$\begingroup$

I have a curve object that includes several curves. I want to randomize the radius of each separate curve piece. Each point on the curve piece should have the same radius, but each piece has a different random radius.

Some control is necessary. I want to be able to set a minimum and maximum number for the radius.

Is there any existing methods or addons to do this? How about with python?

$\endgroup$

3 Answers 3

5
$\begingroup$

To do it manually, in edit mode use L to select linked points and adjust the radius property which will be applied to all selected points. The radius property can be found in the properties sidebar N.

enter image description here

Or you can automate it with python. A curve object can have multiple splines, each spline then has multiple points. Note that bezier curves and nurbs curves use different property names for the points. For bezier curves it is bezier_points while nurbs curves use points.

import bpy
import random

c_obj = bpy.data.objects['BezierCurve']

for s in c_obj.data.splines:
    spl_rad = random.random()
    # change to s.points for nurbs curves
    for p in s.bezier_points:
        p.radius = spl_rad
$\endgroup$
1
$\begingroup$

If you have a single curve object that includes several curves, changing the Bevel Depth in the Geometry panel will change the radius of all curves in your object...

One way to do what you want, is to create several curve objects and to join them in a same group named 'curve_group' (this name is used in the following script).

Running the following python script will change the depth randomly from 0.01 to 0.1 :

import bpy
from random import uniform
for obj in bpy.data.groups['curve_group'].objects:
    obj.data.bevel_depth=uniform(0.01, 0.1)
    obj.data.bevel_resolution=5
$\endgroup$
1
  • $\begingroup$ Thank you for the response! It looks like this sets the Bevel Radius for several curve objects. I need to set the radius of control points of multiple splines within the same curve object. $\endgroup$
    – Ascalon
    Commented Aug 23, 2017 at 15:34
1
$\begingroup$

If you like to do this procedurally, you can use Sverchok Add-On to quickly access those joined curves, get the points of each curve, regenerate them as NEW Curves all with random radius.

curve with random radius

If you want to keep the original single Curve object with multiple Spline, you can really use Python and directly targetting the Bezier Point Radius. Visually shown here using Sverchok:

visual node

Thanks to SV Dev Zeff also we have this way to do it: sverchok on the fly script node

$\endgroup$
1
  • $\begingroup$ Alternatively you can also use bpy I think: import bpy bpy.data.curves['BezierCurve'].splines[0].bezier_points[0].radius = 6 bpy.data.curves['BezierCurve'].splines[2].bezier_points[0].radius = 3 $\endgroup$ Commented Aug 24, 2017 at 10:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .