Nearly all problems solved behalves of making the bezier curve cyclic
Who knows the API for that!???
it is curve.py from the snippets adjusted …
#----------------------------------------------------------
# File makebezierCircle.py
#----------------------------------------------------------
import bpy
def createCurveObject():
# Create curve and object
cu = bpy.data.curves.new('MyCurve', 'CURVE')
ob = bpy.data.objects.new('MyCurveObjectCirclePKHG', cu)
bpy.context.scene.objects.link(ob)
ob.location = (0,1,0) #?neede?
print(dir(ob))
# Set some attributes
cu.dimensions = '3D'
cu.use_fill_back = True
cu.use_fill_front = True
ob.show_name = True
beziers = [
((1, 0 , 0 ),( 1, 0.5 , 0 ), (1 , -0.5 , 0 )),
((0, -1 , 0 ),( 0.5, -1, 0 ), (-0.5 , -1 , 0 )),
((-1, 0 , 0 ),( -1, -0.5 , 0 ), (-1 , 0.5 , 0 )),
]
# Create spline and set Bezier control points
spline = cu.splines.new('BEZIER')
nPointsU = len(beziers)
spline.bezier_points.add(nPointsU)
for n in range(nPointsU):
bpt = spline.bezier_points[n]
(bpt.co, bpt.handle_left, bpt.handle_right) = beziers[n]
print(dir(spline))
startPoint = spline.bezier_points[-1] #NOTE this is created by a new action above!!!!
startPoint.co = (0,1,0)
startPoint.handle_left = (-0.5,1,0)
startPoint.handle_right = (0.5,1,0)
#>>> b0.handle_left=[-0.5,1,0]
#>>> b0.handle_right=[0.5,1,0]
# bpy.context.area.type="VIEW_3D"
# bpy.ops.object.editmode_toggle()
# bpy.ops.curve.select_all(action='SELECT')
# bpy.ops.curve.cyclic_toggle(direction='CYCLIC_U')
# print(spline.bezier_points[-1].co)
return ob
def run(origin):
curveob = createCurveObject()
curveob.location = origin
curveob.select = True
# bpy.ops.transform.translate(value=(2,0,0))
return
if __name__ == "__main__":
run((0,0,0))
Now it is a 3/4 circle only