I made a python script that tuns an edge into a curve thats full and assigns a material.
bpy.ops.object.convert(target='CURVE')bpy.context.object.data.fill_mode = 'FULL'
bpy.context.object.data.bevel_depth = 0.001
bpy.context.object.data.bevel_depth = 0.002
bpy.context.object.data.bevel_depth = 0.003
bpy.context.object.data.bevel_resolution = 1
bpy.ops.object.convert(target='MESH')
bpy.ops.object.shade_smooth()
bpy.ops.object.material_slot_add()
import bpy
ob = bpy.context.active_object
# Get material
mat = bpy.data.materials.get("bus_black_dull")
if mat is None:
# create material
mat = bpy.data.materials.new(name="bus_black_dull")
# Assign it to object
if ob.data.materials:
# assign to 1st material slot
ob.data.materials[0] = mat
else:
# no slots
ob.data.materials.append(mat)
shell.SendKeys("{ENTER}")
Instead of copy and pasting that code into blender python window eveytime, how do I create a button that Ican click and it executes that code? for example in the object add modifier section I can mirror an object at the push of a button even though all it is is python code being executed, How do I create a push button for my python code? (possibley with custom picture)