1
$\begingroup$

Using a modified version of the script found here:

Poly / Bezier curve from a list of coordinates

import bpy

# sample data
coords = [(0,0,0), (2,2,2), (3,3,7)]

# create the Curve Datablock
curveData = bpy.data.curves.new('myCurve', 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('myCurve', curveData)

# attach to scene and validate context
scn = bpy.context.scene
scn.objects.link(curveOB)
scn.objects.active = curveOB
curveOB.select = True   

bpy.context.object.data.splines[0].use_endpoint_u = True
bpy.context.object.data.fill_mode = 'FULL'
bpy.context.object.data.bevel_depth = 0.1
bpy.context.object.data.bevel_resolution = 5

I am able to create the following NURBS curve from a list of vertices. enter image description here

What I would like to do is get an x,y,z position along that curve at a known distance from the start. For example, starting at the first point, (0,0,0), what would be the x,y,z coordinates 3 units up, along the curve?

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.