import bpy import math # This will remove all the objects. Did we really need to? # It's handy if we're going to run this a bunch of times bpy.ops.object.select_all(action='SELECT') # Default action is TOGGLE bpy.ops.object.delete() def make_panel(c_level=2.0, res=1000, size=200): bpy.ops.mesh.primitive_grid_add(x_subdivisions=res, y_subdivisions=1, size=size) plane = bpy.context.active_object for i in range(len(plane.data.vertices)): plane.data.vertices[i].co.z += c_level * math.sin(plane.data.vertices[i].co.x) return plane p = make_panel(c_level = 3.0, res=500) p.rotation_euler[0] += math.pi/4