Skip to content

Instantly share code, notes, and snippets.

@ocadaruma
Created November 15, 2017 13:23
Show Gist options
  • Save ocadaruma/fef25b6fc96b0c98e35a832ade1867fe to your computer and use it in GitHub Desktop.
Save ocadaruma/fef25b6fc96b0c98e35a832ade1867fe to your computer and use it in GitHub Desktop.
import bpy
import math
def delete_all():
for item in bpy.context.scene.objects:
bpy.context.scene.objects.unlink(item)
for item in bpy.data.objects:
bpy.data.objects.remove(item)
for item in bpy.data.meshes:
bpy.data.meshes.remove(item)
for item in bpy.data.materials:
bpy.data.materials.remove(item)
delete_all()
# bpy.ops.import_curve.svg(filepath = "/Users/hokada/Desktop/trebleclef_big.svg")
bpy.ops.import_curve.svg(filepath = "/path/to/svg")
curve = bpy.data.objects["Curve"]
bpy.context.scene.objects.active = curve
bpy.ops.object.modifier_add(type = "SOLIDIFY")
bpy.context.object.modifiers["Solidify"].thickness = 0.1
curve.select = True
bpy.ops.object.convert(target = "MESH")
curve.rotation_euler[0] = math.radians(-90)
curve.rotation_euler[1] = math.radians(-90)
bpy.ops.object.transform_apply(rotation = True)
bpy.ops.export_scene.fbx(filepath = "/path/to/fbx")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment