1
$\begingroup$

I have 250 curves in my scene and I need to apply the same extrude and bevel geometry to all the them.

I am running this script

import bpy
for obj in bpy.context.selected_objects:
    if obj.type == 'CURVE':
        obj.data.extrude = 0.005
        obj.data.bevel_depth = -0.002
        obj.data.bevel_resolution = 4

but when I run it it results in a bevel of "0.197" and a depth of "-0.787" the bevel resolution works correctly.

Can anyone explain why this might be happening? Thanks!

bevel example

$\endgroup$
5
  • 2
    $\begingroup$ Look at the units. 0.005 m = 0.197 in, 0.002 m = 0.0787 in. $\endgroup$
    – scurest
    Commented Sep 16, 2020 at 13:20
  • $\begingroup$ ok .. but when I type in 0.005 and .002 into the fields it looks fine. does the scripting only work in metric? $\endgroup$
    – Chris
    Commented Sep 16, 2020 at 13:23
  • 2
    $\begingroup$ Lengths are stored in "Blender units". Multiply BUs by scene.unit_settings.scale_length to get meters. It will probably help if you just play around with the unit settings in the Scene Properties panel and see how that changes the displayed value. $\endgroup$
    – scurest
    Commented Sep 16, 2020 at 13:33
  • $\begingroup$ @scurest consider making this an answer. $\endgroup$
    – batFINGER
    Commented Sep 16, 2020 at 13:37
  • $\begingroup$ yeah. I did a inches to metric conversion and typed in those numbers and it worked perfectly. thank you. $\endgroup$
    – Chris
    Commented Sep 16, 2020 at 13:39

1 Answer 1

1
$\begingroup$

I am working in inches for this project and had to convert the numbers to meters. I had to use the following to get the desired amounts

import bpy
for obj in bpy.context.selected_objects:
    if obj.type == 'CURVE':
        obj.data.extrude = 0.000127
        obj.data.bevel_depth = -0.0000508
        obj.data.bevel_resolution = 4
$\endgroup$

You must log in to answer this question.

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