ScriptSpot

Forum topic · General Scripting

print vertex positions for selected vertices only

By bensharpe · 2014-05-30

Description

Hi

I am wanting to make a script where I can automatically sew up the edges of terrain meshes. To do this I am wanting to have the two meshes with the edge vertices selected in an edit mesh.

Then I am wanting to cycle through one mesh's selected vertices and position them at the closest vertex of the other meshes selected vertices.

The trouble I am having is being able to access the positions of the selected vertices only.

How can I print a list of the positions of the selected vertices only. Anyone know?

Cheers

Ben

Comments (1)

brttd · 2014-05-30

If the objects you are dealing with are Editable_Polys, then you can use


temp=polyop.getVertSelection object as array
polyop.getVert object temp[1]

The top bit will give you all the selected vertices in object, it gives you a bitArray by default, so if you want it as an array you will need to convert it.
The second bit will give you the position of any vertice in object, I put the first vertice in the list of selected vertice.
You will need to replace the object with a node, so you could use $, or set a variable as a node beforehand, and use it there.