# How to deform object using script

I am writing a script to deform a Plane gradually and save files each time of the deformation. I could do it manually, using edit mode as below.

Then, I wrote code to see how works as below.

import bpy
import bmesh
context = bpy.context
obj = context.edit_object
mesh = obj.data

# get a bmesh
bm = bmesh.from_edit_mesh(mesh)
print(bm)
for v in bm.verts:
if not v.select:
continue
print(v.co.xyz)
v.co.z+= 3


However,as might be expected, it translates the only selected vertex like below.

Since I am a beginner,this might be a fool question but if you know how to do this deformation(like "connected"&"Smooth" deformation in edit mode), please help me out.

• Depending on your requirements you may achieve your goal without Python. Is your final goal an animation in Blender or exporting data? Is your project [save files] a (Blender to Blender) format or (Blender to Other Software) format? What is the file type of the saved file, Blender or Not? Have you ever placed a keyframe? Blender has the (empty) and ( armature and bone) to control mesh deformation. Will you accept a non python solution or is using python a requirement. If you choose to explain .. please place your responses in the original question ... not as a comment. – atomicbezierslinger Dec 24 '17 at 19:17
• Here is an example using bones. No Python. blender.stackexchange.com/questions/85084/… . There are always many ways to achieve deformations in Blender. You stated [I am a beginner]. It may take reasonable experimentation time to know about methods that suit your current tastes. – atomicbezierslinger Dec 24 '17 at 19:22
• Blender has data exporting tools. I assume you want an efficient flow that achieves some animation goal. Picking single vertices by Python presents it self as unnecessary work. If the data can be picked mathematical tests you have a better chance. A suggestion is 3 steps. S01 Achieve the desired animation by the easiest means without Python. S02. Export only if you must. S03. If your requirements allow, stay within Blender. – atomicbezierslinger Dec 24 '17 at 19:33
• Consider the displacement modifier or the warp modifier. Warp Modifier blender.stackexchange.com/questions/39195/… – atomicbezierslinger Dec 24 '17 at 19:37