How to select vertices on the left side of a plane using python? I would like to select only the vertices on the left side of my plane using Python (like on the screeenshot), does anybody have an idea how to do it ?

I try the following to get all vertices but i'm unable to isolate those on the left.



My actual code to get all the vertices:

bpy.ops.import_image.to_plane(
  files=[{'name': os.path.basename(file)}],
  directory=os.path.dirname(file)
)
obj = bpy.context.object
group = obj.vertex_groups.new(name = 'Group' + str(number))
index = 0
verts = []
for v in obj.data.vertices:
    verts += [index]
    index = index + 1
    print(v.co)
group.add(verts, 1.0, 'REPLACE')
You need to somehow define what is 'on the left side'. Is it global space, is it local, which way you are looking from?.. Anyway, you can compare the coordinates to something. Let's say you are looking from the top as in the screenshot and left is the most negative X point of the object in global space plus 0.5 units:

import bpy

obj = bpy.context.object
data = obj.data

the_matrix = obj.matrix_world

on_the_left_side = (the_matrix @ obj.data.vertices[0].co).x # have to start somewhere

for v in data.vertices:
    co = the_matrix @ v.co #Let's say "on the left" is in global space
    if co.x &lt; on_the_left_side:
        on_the_left_side = co.x

offset = 0.5

#Element selection is a bit weird in bpy - you can select faces, 
#but not vertices for example like user cannot, so let's deselect
for e in data.edges:
    e.select = False
for f in data.polygons:
    f.select = False    

for v in data.vertices:
    co = the_matrix @ v.co
    if co.x &lt; on_the_left_side + offset:
        v.select = True
    else:
        v.select = False