Search This Blog

Thursday, 29 October 2020

BPY SCRIPT TO ADD A CUBE AND A MATERIAL TO IT

The following script can be used  to add  a cube and a material to it:

 

import bpy

bpy.ops.mesh.primitive_cube_add(location=(0,0,0))
obj_matl=bpy.data.materials.new("obj_clr")
obj_matl.diffuse_color=(1,0,0)
mesh=bpy.context.object.data
mesh.materials.append(obj_matl)

No comments:

Post a Comment

Please send your comment as to what extent these topics are explained clearly. If you want any new topic explained, just put up a message in the comment, we shall address it.

TO SET UNIT OF MEASUREMENT - METRIC/IMPERIAL

Instruction as applicable to Blender Version  3.00 and above.  In Blender, we can set the dimensions of Rotation, Length, Mass, Time and Tem...