Search This Blog

Showing posts with label add mesh. Show all posts
Showing posts with label add mesh. Show all posts

Thursday 30 December 2021

SINE WAVES-RED,YELLOW AND BLUE SCRIPT

#THIS SCRIPT WORKS WITH BLENDER 2.8 AND ABOVE.

 import bpy
from math import sin,cos,pi

radius=100
deg=2*pi

#TO DELETE ALL EXISTING OBJECTS
bpy.ops.object.mode_set(mode='OBJECT')
bpy.ops.object.select_by_type(type='MESH')
bpy.ops.object.delete(use_global=False)


for t in range (0,360):
    
    #RED
    z=radius*sin(t*deg/360)
    x=t
    y=0
    bpy.ops.mesh.primitive_cube_add(location=(x,y,z))
    bpy.ops.transform.resize(value=(0.9,0.9,0.9))
    obj_matl=bpy.data.materials.new("obj_clr")
    obj_matl.diffuse_color=(1,0,0,1)
    mesh=bpy.context.object.data
    mesh.materials.clear()
    mesh.materials.append(obj_matl)
    #YELLOW
    z=radius*sin(t*deg/360)
    x=t+120
    y=0
    bpy.ops.mesh.primitive_cube_add(location=(x,y,z))
    bpy.ops.transform.resize(value=(0.9,0.9,0.9))
    obj_matl=bpy.data.materials.new("obj_clr")
    obj_matl.diffuse_color=(1,0.6,0,1)
    mesh=bpy.context.object.data
    mesh.materials.clear()
    mesh.materials.append(obj_matl)
    #BLUE
    z=radius*sin(t*deg/360)
    x=t+240
    y=0
    bpy.ops.mesh.primitive_cube_add(location=(x,y,z))
    bpy.ops.transform.resize(value=(0.9,0.9,0.9))
    obj_matl=bpy.data.materials.new("obj_clr")
    obj_matl.diffuse_color=(0,0,1,1)
    mesh=bpy.context.object.data
    mesh.materials.clear()
    mesh.materials.append(obj_matl)

The wave form generated by the script can be seen by clicking on the link given  below:

SINE WAVE LINK 

 


   


    
   

TO MIRROR ARMATURE BONES ON X AXIS 1. Assume that we are making a human rig in standing position. 2. Set the view to front view. 3. Create t...