bpy.data.curves.new(name= "test" , type = 'SURFACE') does not create a surface
Closed, ResolvedPublic


import bpy
# create a nurb-surface with function class bpy.types.BlendDataCurves.new()
surf = bpy.data.curves.new(name= "test" , type = 'SURFACE')
# code for splines and control-points
obj = bpy.data.objects.new("test_obj", surf)

# the code will produce a curve, it shoud be a surface.
# the outliner-editor shows me a curve-symbol ,it shoud be a surface-symbol.
# the 3D-View-editor , in editmode, shows a menu for curve , it shoud be a menu for surface.
# documentation => class bpy.types.BlendDataCurves(bpy_struct), type (enum in [‘CURVE’, ‘SURFACE’, ‘FONT’])

# create a surface with primitive function to compare the results.

# tested with blender versions
# version 2.60 (sub 0), revision 41226. Release
# build date: 2011-10-24, 10:54:39
# platform: Windows:64bit
# and
# version 2.59 (sub 0), revision 39307. Release
# build date: 2011-08-13, 11:44:03
# platform: Windows:64bit



It's failure of code which tries to guess object type from Curve datablock. It's needed in cases when you're changing object datablock.
Probably it can be improved so it wouldn't change object's type when it's not obvious which type to use and when both of Curve and Surface types can be used.
Will look into this issue.

thanks, Sergey for the quick response.

Fixed in svn rev42126. Thanks for the report, closing it now.

Sergey Sharybin (sergey) closed this task as "Resolved".Nov 24 2011, 3:31 PM