I add curves from points using this function:
def curveFromPoints(coords,name):
# create the Curve Datablock
curveData = bpy.data.curves.new(name, type='CURVE')
curveData.dimensions = '3D'
curveData.resolution_u = 2
# map coords to spline
polyline = curveData.splines.new('NURBS')
polyline.points.add(len(coords))
for i, coord in enumerate(coords):
x,y,z = coord
polyline.points<i>.co = (x, y, z, 1)
# create Object
curveOB = bpy.data.objects.new(name, curveData)
curveOB.location = (0,0,0)
# attach to scene and validate context
scn = bpy.context.scene
scn.objects.link(curveOB)
when adding several curves, I can rightclick-select the curves individually, but when I try to translate, all curves translate together.
[I]
How can I translate each curve individually?
I’m a beginner in blender and think its a simple missunderstanding on my side, but could net solve this reading through the web.
Edit: When I rightclick in the right pane on the curve and use ‘select hierarchy’ on one curve indivudual transformation works. Is this the intended way of doing this?
I have another question: how would i need to adapt the above code in order to get a colsed curve(last point connected to the first one)?