I am trying to convert an SVG file to a mesh and then extrude it, using Python, with the later goal of converting SVG paths directly (i.e.: without going through a file)
I get as far as converting the closed path to a curve like this - but fail when trying to create an object (last line):
import bmesh
bpy.ops.import_curve.svg(filepath='test.svg')
print('path is ', bpy.data.objects['path38'].type)
path = bpy.data.objects['path38']
dg = bpy.context.evaluated_depsgraph_get()
path = path.evaluated_get(dg)
mesh = path.to_mesh()
print(mesh);
# this fails:
o = bpy.data.objects.new("myMesh_object", mesh)
which fails with message:
RuntimeError: Error: Can not create object in main database with an evaluated data data-block
So, what's the right way to go from SVG to path to mesh to extruded object?