How to set multiple vertices y coordinates at once

hello, I’m new to this forum …
I have a question:
I am trying to model different hexagonal tiles for a terrain
that should be modular,
To do this, I have to change the y position of all vertices of the slopes edges to a given position…
but , manually, this takes a very long time…
there is some way to do that automatically, or with a script?
knowing that I have saved the y position i need for each vertex in a text file?
Each selected vertice in the screenshot need to be at one precise position…


thank you for your help
Fred

Select vertices and scale on the y axis by zero (S Y 0), then input the Y value in the transform panel
or
Position the 3d cursor at the Y location, set the pivot point to the 3d cursor (. period key) then scale by zero on the y axis (S Y 0)
or
Position one vertex to the correct y position, select all the vertices, ensuring the last one selected (active vertex) is the one you originally moved. Set the pivot point to Active Element then scale by zero on the Y axis (S Y 0)

And to add to what Richard said, (going by your screenshot) before scaling, to select all the vertices along an edge like you’ve done, hold down Alt and click somewhere along one of the connecting lines. It’ll select the entire edge loop.

Thank you for your answers,
but I can not do that as suggested,
I probably misspoke … sorry for my English,
I speak french…

because each selected vertice should have a different y position ,
not the same, I seek a way of selecting all vertices
and using a script that read my text file, and change the y position of each vertice, one after the other.
for example, at vertice 0 : 2.5 vertice 1 : 2.42 vertice 2 : 2.34, and so on …
I hope I am clear …
Thank you
Fred

You’ll have to use a script to move a vertex with a particular vertex ID to a specified location in an automated way.

yes, that’s exactly what I need
:)if anyone can direct me to such a script …
thank you very much

And…
ctrl + click selects the shortest path. (another tip)

1 Like

ok,
I got some progress,
I made a little script,
with in a first list the different y positions of the vertices i need,
Then in a second list, I note the different Selected vertices ,

and finally, I travel the second list and changing the y position of each vertice there …
but while my lists have the right information (I checked with a print), I get a result not consistent with my expectations …
it seems that the script does not keep the same order for Selected vertices …
I’m lost …
some screenshots :
before:



After :

The script:

[QUOTE][import bpy
import bmesh

Get the active mesh

obj = bpy.context.edit_object
me = obj.data

Get a BMesh representation

bm = bmesh.from_edit_mesh(me)
bm.faces.active = None

Modify the BMesh, can do anything here…

MyList = []
listv = []
MyList.append(2.5000)
MyList.append(2.49322)
MyList.append(2.47348)
MyList.append(2.44166)
MyList.append(2.39864)
MyList.append(2.3453)
MyList.append(2.2825)
MyList.append(2.21115)
MyList.append(2.13217)
MyList.append(2.0465)
MyList.append(1.95514)
MyList.append(1.85907)
MyList.append(1.75932)
MyList.append(1.65693)
MyList.append(1.55296)
MyList.append(1.44848)
MyList.append(1.34457)
MyList.append(1.24227)
MyList.append(1.14266)
MyList.append(1.04676)
MyList.append(0.95561)
MyList.append(0.87019)
MyList.append(0.79146)
MyList.append(0.72039)
MyList.append(0.65788)
MyList.append(0.60482)
MyList.append(0.56207)
MyList.append(0.53053)
MyList.append(0.51044)
MyList.append(0.50063)
MyList.append(0.5)
MyList.append(0.5)
MyList.append(0.5)

for v in bm.verts:
if v.select :
listv.append(v)

a = 0
for vert in listv:
vert.co.z = MyList[a]

print(vert.index)
print(vert.co.z)
print("******")

a+=1

Show the updates in the viewport

and recalculate n-gon tessellation.

bmesh.update_edit_mesh(me, True)
/QUOTE]

Can someone help me?
thank you
Fred

Had no idea this was a thing, and man what a huge time saver.