#----------------------------------------------------------# File hello.py http://wiki.blender.org/index.php/Dev:2.5/Py/Scripts/Cookbook/Code_snippets/Interface#----------------------------------------------------------import bpy ## Menu in tools region#class ToolsPanel(bpy.types.Panel): bl_label = "Hello from Tools" bl_space_type = "VIEW_3D" bl_region_type = "TOOLS" def draw(self, context): self.layout.operator("hello.hello") ## Menu in toolprops region#class ToolPropsPanel(bpy.types.Panel): bl_label = "Hello from Tool props" bl_space_type = "VIEW_3D" bl_region_type = "TOOL_PROPS" def draw(self, context): self.layout.operator("hello.hello", text='Hej').country = "Sweden" ## Menu in UI region#class UIPanel(bpy.types.Panel): bl_label = "Hello from UI panel" bl_space_type = "VIEW_3D" bl_region_type = "UI" def draw(self, context): self.layout.operator("hello.hello", text='Servus (VIEW3D UI)').country="The Netherlands" ## Menu in window region, object context#class ObjectPanel(bpy.types.Panel): bl_label = "Hello from Object context" bl_space_type = "PROPERTIES" bl_region_type = "WINDOW" bl_context = "object" def draw(self, context): self.layout.operator("hello.hello", text='Bonjour').country = "France (PROPERTiES)" ## Menu in window region, material context#class MaterialPanel(bpy.types.Panel): bl_label = "Hello from Material context" bl_space_type = "PROPERTIES" bl_region_type = "WINDOW" bl_context = "material" def draw(self, context): self.layout.operator("hello.hello", text='Ciao').country = "Italy" ## The Hello button prints a message in the console#class OBJECT_OT_HelloButton(bpy.types.Operator): bl_idname = "hello.hello" bl_label = "Say Hello" country = bpy.props.StringProperty() def execute(self, context): if self.country == '': print("Hello world!") else: print("Hello world from %s!" % self.country) return{'FINISHED'} ## Registration# All panels and operators must be registered with Blender; otherwise# they do not show up. The simplest way to register everything in the# file is with a call to bpy.utils.register_module(__name__).# bpy.utils.register_module(__name__)
import bpyimport bmesh#bm = bmesh.new()obj = bpy.context.scene.objects.active #bpy.data.objects['Plane.002']bpy.ops.object.mode_set(mode='EDIT')bm = bmesh.from_edit_mesh(obj.data) #print(bm.faces[:], bm.verts[:])#strak Object bpy.ops.object.mode_set(mode='EDIT')result = bmesh.ops.poke(bm, faces= bm.faces[:], offset =1 , center_mode = 1, use_relative_offset = True)#print(result)bpy.ops.object.mode_set(mode='OBJECT')bm.free() [code]Het komt van bmesh willen bgrijpen, wat het inmiddels alles zo kan!