Select longest edges in unwrap

Hi, is there any chance you could help me with script problem?

I have long strip of polygons of varying length, kinda like long ladder, and i need to select 2 longest edges of side rail, not the rung. While i need to get selection in unwrap editor, it needs to be based on edit poly edge's length not UV edges.

Basically i have long list of these ladder like meshes and need to match it to certain places in UV space. So, i plan to select longest_edge[1], run loop and slide it to correct position, then repeat the process with longest_edge[2]
I can do looping and moving, just can't get the selection part.

Can anyone help me with this?

Thanks
T.

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
tahir1983's picture

GREAT SCRIPT! is it possible

GREAT SCRIPT! is it possible to make same with simultionesly selected group of elements ...

miauu's picture

.

Can you explain how exactly the script should works?

miauu's picture

.

This will select the longest edge of selected edges of an Editable Poly object. Select some edges and run the script. It will select the longest edge from the selected edges. Then you have to select the coresponging UV edge and continue with the loop and slice.

(
	curO = selection[1]
	if classOf curO == Editable_Poly then
	(
		if subobjectlevel == 2 do
		(
			selEdgesBA = polyop.getEdgeSelection curO
			if selEdgesBA.numberset != 0 then
			(
				longestEdge = undefined
				minLength = 0
				for ed in selEdgesBA do
				(
					edgeVertsArr = polyop.getEdgeVerts curO ed
					edgeLength = distance (polyop.getVert curO edgeVertsArr[1]) (polyop.getVert curO edgeVertsArr[2])
					if edgeLength > minLength do
					(
						minLength = edgeLength
						longestEdge = ed
					)
				)
				polyop.SetEdgeSelection curO longestEdge
			)
			else
				messagebox "Select some edges" title:"Empty Selection"
		)
	)
	else
		messagebox "Select Editable Poly object" title:"Wrong Selection"
)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.