Now let’s walk through the script line by line:

import bpy = adds Blender’s python interpreter so that we get access to Blender’s code library

import bmesh = adds the bmesh library, this helps us edit the mesh in edit mode

bpy.ops.mesh.primitive_cube_add(size=2, view_align=False, enter_editmode=True, location=(0, 0, 0))= add the default cube primitive, give it a size of 2 Blender units, don’t align it to the view, take it to edit mode and set it’s location coordinates to 0, 0, 0

bpy.ops.mesh.select_all(action=’SELECT’) =select the entire mesh

bpy.ops.transform.resize(value=(0.5, 1, 1)) = scale the mesh to 0.5 (half of the original size) on the x-axis and leave y and z as is (1).

obj = bpy.context.edit_object= store a reference of the object we are currently editing to the “obj” variable (at least I think that’s what this line does)

me = obj.data= store the data of the current object to a variable called “me”

bm = bmesh.from_edit_mesh(me)= fill a bmesh object with the data from the current mesh

bm.faces.active = None= make sure there is no active face

for face in bm.faces: if face.calc_center_bounds()[0]== 0: face.select = True= loop through all the faces of the bmesh object and if the center point of a face equals zero on the x-axis (signified by [0]), select it

bpy.ops.mesh.delete(type=’FACE’)= delete the selected face

bpy.ops.object.modifier_add(type=’MIRROR’)= add the mirror modifier

bpy.context.object.modifiers[“Mirror”].use_clip = True= turn on clipping for the mirror modifier (to prevent vertices from crossing to the other side of the mirror boundary)

Write this script to a new text document in the Blender text editor and click on the “run” button to execute it! Happy modeling!