I'm trying to visualize assembly of flat pack furniture, out of 2D SVG curves. I can successfully import and extrude the separate SVG paths in Python, conveniently using the path's id to reference the bpy.data.curves[id]:

bpy.data.curves["left"].dimensions = "2D"
bpy.data.curves["left"].extrude = 0.003
bpy.data.curves["centert"].dimensions = "2D"
bpy.data.curves["centert"].extrude = 0.003
bpy.data.curves["right"].dimensions = "2D"
bpy.data.curves["right"].extrude = 0.003

(You can find the example SVG at stretchsketch)

I was hoping I could transform (rotate, move) the curves via the rotate_euler properties but these are only present at bpy.data.objects which are not as nice and intuitive reference-able as curves:

>>> bpy.data.objects[3].rotation_euler=(radians(90),0,radians(90))
>>> bpy.data.objects[3].name

What is the best approach to rotate a curve in blender 2.77 with Python?

  • 1
    $\begingroup$ I am not much into programming at all, but rotating curves in object mode would be the correct way to do it. Not only is it impossible to rotate 2D curves in three dimensions in edit mode (because well they are 2D) it is also not desirable, since they will lose they 2D properties like being closed and capped and cleanly extrudable. Also maintaining them as actual curve objects as long as possible and not converting them to mesh is also preferable because converting to mesh is a destructive one way process. $\endgroup$ Jul 25, 2016 at 20:07
  • $\begingroup$ Actually this should work, alternatively you can try: bpy.data.objects['BezierCurveName'].rotation_euler. $\endgroup$
    – p2or
    Jul 26, 2016 at 8:30

1 Answer 1


Test script to import the blender.svg file. As pointed out here the newly added curves are not selected after the import. For convenience added an empty parent.

import bpy
context = bpy.context
scene = context.scene
bpy.ops.import_curve.svg(filepath = bpy.app.binary_path.replace(".exe", "") + ".svg")
newcurves = [c for c in context.scene.objects if not c.select]
# deselect all
# create an empty make it the active  object
empty = bpy.data.objects.new("Holder", None) # use filename maybe
scene.objects.active = empty
empty.select = True
# loop thru the curve objects
for c in newcurves:
    print("Curve: %s", c.name)
    # make it selected
    c.select = True
    # make the parent the empty if not already set
    if not c.parent:
        c.parent = empty
    # change some curve details
    curve = c.data
    curve.dimensions = '2D'
    curve.extrude = 0.003
    # sane object names
    c.name = curve.name
    # location
    #c.location.x += 0.332

empty.scale *= 200

Test on svg enter image description here

If you are going to move and rotate append a call to geometry to origin operator.

bpy.ops.object.origin_set(type='GEOMETRY_ORIGIN', center='BOUNDS')
  • $\begingroup$ Thanks a lot! Now I can proceed with animation. You're very welcome to answer possible future questions on that as well :-) $\endgroup$
    – dr jerry
    Jul 31, 2016 at 19:29

You must log in to answer this question.

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