HOW TO SELECT VERTICAL EDGE IN POLY ?

I have a building , i tried to select vertical edge but i can not , can you help me ? Thank you very much

Comments

Comment viewing options

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

and How to select horizontal

and How to select horizontal edges?

alexnguyen's picture

:)

actionMan.executeAction 0 "40044" -- Selection: Select Invert

miauu's picture

.

What is "vertical" edge?

You can try this:
1- get the edges one by one
2- get the verts of this edge
3- check if the Z position of one verts is higher than the Z position of the other vert. If the X and Y position of both verts are the same then this is "vertical" edge.

alexnguyen's picture

thank

but how can i do in maxscript ? can you give me the function ?

miauu's picture

.

Select only one Editable Poly object.

(
	if selection.count == 1 and classOf selection[1] == Editable_Poly do
	(
		threshold = 1.0
 
		curO = selection[1]		
		curOEdgesBA = #{1..(polyop.getNumedges curO)}
		vertEdgesBA = #{}
 
		for eIdx in curOEdgesBA do
		(
			edgeVertsArr = polyop.getEdgeVerts curO eIdx
			v01pos = polyop.getVert curO edgeVertsArr[1]
			v02pos = polyop.getVert curO edgeVertsArr[2]
 
			if v01pos.z != v02pos.z do
			(
				if abs (v01pos.x - v02pos.x) <= threshold and abs (v01pos.y - v02pos.y) <= threshold do
					vertEdgesBA += #{eIdx}
			)
		)
 
		if vertEdgesBA.numberset != 0 then
		(
			subobjectlevel = 2
			polyop.setEdgeSelection curO vertEdgesBA
		)
		else
			messagebox "No vertical edges" title:""
	)
)
alexnguyen's picture

thank u very much

when i wait you , i do one for my self :)

mangcanh =#()
sPoly=$
subObjectLevel = 2
actionMan.executeAction 0 "40021" -- Selection: Select All
idcanh = sPoly.getSelection #Edge as array
k = idcanh.count
for i = 1 to k do
(
polyop.setEdgeSelection sPoly i
redrawViews()
sPoly.convertSelection #Edge #Vertex
aVerts = sPoly.getSelection #Vertex as array
diema = aVerts[1]
diemb = aVerts[2]
toadoa = polyOp.getVert sPoly diema
toadob = polyOp.getVert sPoly diemb
if ( toadoa.x == toadob.x and toadoa.y == toadob.y ) then append mangcanh i
)
sort mangcanh
mangcanhmoi = mangcanh as bitarray
sPoly.EditablePoly.SetSelection #Edge mangcanhmoi

but i think your code is better , thank u alot

Comment viewing options

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