nurbs surface creation

hi,

considering the following code snippet found at


import bpy
from mathutils import Vector
 
scene = bpy.context.scene
 
surface_data = bpy.data.curves.new('wook', 'SURFACE')
surface_data.dimensions = '3D'
 
# 16 coordinates, set points per segments (U * V)
points = [
    Vector((-1.5, -1.5, 0.0, 1.0)), Vector((-1.5, -0.5, 0.0, 1.0)),
    Vector((-1.5, 0.5, 0.0, 1.0)), Vector((-1.5, 1.5, 0.0, 1.0)),
    Vector((-0.5, -1.5, 0.0, 1.0)), Vector((-0.5, -0.5, 1.0, 1.0)),
    Vector((-0.5, 0.5, 1.0, 1.0)), Vector((-0.5, 1.5, 0.0, 1.0)),
    Vector((0.5, -1.5, 0.0, 1.0)), Vector((0.5, -0.5, 1.0, 1.0)),
    Vector((0.5, 0.5, 1.0, 1.0)), Vector((0.5, 1.5, 0.0, 1.0)),
    Vector((1.5, -1.5, 0.0, 1.0)), Vector((1.5, -0.5, 0.0, 1.0)),
    Vector((1.5, 0.5, 0.0, 1.0)), Vector((1.5, 1.5, 0.0, 1.0))
]
 
for i in range(0, 16, 4):
    spline = surface_data.splines.new(type='NURBS')
    spline.points.add(3)  # already has a default zero vector
 
    for p, new_co in zip(spline.points, points[i:i+4]):
        p.co = new_co
 
surface_object = bpy.data.objects.new('NURBS_OBJ', surface_data)
scene.objects.link(surface_object)
 
splines = surface_object.data.splines
for s in splines:
    for p in s.points:
        p.select = True
 
bpy.context.scene.objects.active = surface_object
bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.curve.make_segment()


this code does what it supposed to do in the latest
blender 2.75a downloaded from blender.org

but if i run it in the latest build from source
( just updated through git )
then this code does not what it’s supposed to do

did things change recently ?

anybody a clue ?

thanks
regards
sc3

It runs on 2.73, but just remember as each new version of blender comes out changes can be made to their API. It’s blender API hell in my opinion :wink:

thanks

as i said
it even runs in 2.75a which got released a week ago

so i wonder what the new way is :slight_smile: