import bpy import math import datetime bpy.ops.object.select_pattern(pattern='Text*') bpy.ops.object.select_pattern(pattern='*zeiger') bpy.ops.object.select_pattern(pattern='Plane') bpy.ops.object.delete() stunde = datetime.datetime.now().hour minute = datetime.datetime.now().minute stundenwinkel = 360 / 12 * (stunde + minute/60) minutenwinkel = 360 / 60 * minute fromCenter = 3 angleInc = 30 * math.pi/180 bpy.ops.mesh.primitive_plane_add(size=9, enter_editmode=False, align='WORLD', location=(0, 0, 0), scale=(1, 1, 1)) i = 1 while i <= 12: x=fromCenter * math.sin(angleInc * i) y=fromCenter * math.cos(angleInc * i) z=0.2 bpy.ops.object.text_add(location=(x,y,z)) ob=bpy.context.object ob.data.body = str(i) ob.modifiers.new("SOLIDIFIED TEXT","SOLIDIFY").thickness=0.2 bpy.ops.object.origin_set(type='GEOMETRY_ORIGIN', center='MEDIAN') i+=1 bpy.ops.mesh.primitive_cube_add(size=2, enter_editmode=False, align='WORLD', location=(0, 0, 0.05), rotation=(0, 0, 0), scale=(1, 1, 1)) bpy.context.selected_objects[0].name="Stundenzeiger" bpy.context.selected_objects[0].dimensions=( 0.2, 2, 0.1) bpy.ops.transform.translate(value=(0, 1, 0)) bpy.context.scene.tool_settings.use_transform_data_origin = True bpy.ops.transform.translate(value=(0, -1, 0)) bpy.context.scene.tool_settings.use_transform_data_origin = False bpy.ops.transform.rotate(value= stundenwinkel * math.pi/180) bpy.context.object.lock_location[0] = True bpy.context.object.lock_location[1] = True bpy.context.object.lock_location[2] = True bpy.context.object.lock_rotation[0] = True bpy.context.object.lock_rotation[1] = True bpy.ops.mesh.primitive_cube_add(size=2, enter_editmode=False, align='WORLD', location=(0, 0, 0.1), rotation=(0, 0, 0), scale=(1, 1, 1)) bpy.context.selected_objects[0].name="Minutenzeiger" bpy.context.selected_objects[0].dimensions=( 0.2, 2.6, 0.1) bpy.ops.transform.translate(value=(0, 1.3, 0)) bpy.context.scene.tool_settings.use_transform_data_origin = True bpy.ops.transform.translate(value=(0, -1.3, 0)) bpy.context.scene.tool_settings.use_transform_data_origin = False bpy.ops.transform.rotate(value= minutenwinkel * math.pi/180) bpy.context.object.lock_location[0] = True bpy.context.object.lock_location[1] = True bpy.context.object.lock_location[2] = True bpy.context.object.lock_rotation[0] = True bpy.context.object.lock_rotation[1] = True