Notifications
Clear all

[Closed] Edge position

Hi!

How can i get the position of selected edge(s)?

Lets say that i have a selected editable poly/- mesh with selected edges and i want to print the position of each selected edge:

function printEdgePositions = (

i = 1
while i <= $.selectedEdges.count do (
– This doesn´t work
print $.selectedEdges[i].pos

i = i + 1

)
)

Thank You!

3 Replies

What position do you expect to be returned? An edge has posibly an infinite amount of points that could be returned.

Im not sure what you need this for (quite puzzled actually) but I suppose you could get the edge positions by getting the vertices used by the selected edge and getting the midpoint of these vertices which would correspondent to the position of the middle of the edge.

Im talking about the pivot pos that you can change from the coordinate display – the three (X, Y, Z) box on the bottom of the screen. You can change the position if your selection contains only 1 edge.

Im trying to do little script that can be used to set the position of several selected edges.

The function you are talking about actually moves the vertices connected to the edge because without the vertices, the edge would not exists. If you check it, you will find that the position it displays is the exact middle of the 2 connecting vertices.
Therefor the only way to get what you want is by the following routine.

– put selected edges in array
currentedge = $.selectedEdges
edge_center_array = #()

–loop through the edge array
for n = 1 to currentedge.count do
(
[color=white][size=3][font=Times New Roman]–pick the edges from the array and get the vertices that define it[/font][/size][/color]
edge_verts = meshop.getVertsUsingEdge $ currentedge[n] as array
[color=white][size=3][font=Times New Roman]–edge vertex 1 + edge vertex 2 /2 gets the exact center of the edge[/font][/size][/color]
edge_center = ((getvert $ edge_verts[1]) + (getvert $ edge_verts[2])) /2
–load a new array with each calculated center point
edge_center_array[edge_center_array.count +1] = edge_center
)

print edge_center_array