Notifications
Clear all

[Closed] Select vertical edges

If i have a c shape like this(a simple edited box), with no bottom

is it possible to select via script just the open vertical edges (highlighted in red)?

3 Replies

for a poly mesh something like this will do it

fn edgedir m ed =
(
	v = (polyop.getvertsusingedge m ed) as array;
	normalize ((polyop.getvert m v[2]) - (polyop.getvert m v[1]));
)	

fn GetVerticalEdges pObj vtol =
(
	vedges = #{};
	for i in pObj.edges do
	(
		if abs (dot (edgedir pObj i.index) [0,0,1]) > vtol then
			vedges[i.index] = true;
	)
	vedges;
)	
	
$.selectededges = (GetVerticalEdges $ 0.99) * (polyop.getOpenEdges $)

Thanks!

Let me ask for some clarification

1- can you explain how abs and dot relate, in the Getvertical edge function?

2- why do you multiply the edges, in the selectedge?

the theory is if 2 vectors are in the same direction the dot product of them should equal 1, and if perpedicular 0 and -1 if opposite directions but parallel. When I compute the edge direction I’ve no guarantee the computed direction is straight up or straight down so the dot product in theory could produce 1 or -1 (which in our case are both correct) so we use abs to make sure the result is always positive.

as for the "multiply" it's not, both  GetVerticalEdges and polyop.getOpenEdges  return bitarrays (a list of logical bits 1 to numedges) the "*" operand does a logical AND operation on all the bits returning a bit array where edges that are both vertical [b]AND[/b] open. This can then be used to set the edge selection in the mesh.