I’m trying to make a script that will align all selected mesh components to grid X center. Usually I would do this by scaling with the orgin set to world center but the script will always scale by the Median Point no matter what I do. Any help would be appreciated
import bpy, bmesh
obj = bpy.context.active_object
bm = bmesh.from_edit_mesh(obj.data)
selected_verts = [v for v in bm.verts if v.select]
for v in selected_verts:
v.co = (0, v.co[1], v.co[2])
bmesh.update_edit_mesh(obj.data)
Because I don’t know what I’m doing I haven’t figure out the difference between bpy.ops and bmesh.
Thank you but, the code you wrote scale the verts to the objects center. If I transform the object it will no longer snap the verts to world center. Do you know how I can always scale to world origin?