I have a building , i tried to select vertical edge but i can not , can you help me ? Thank you very much
Forum topic · General Scripting
HOW TO SELECT VERTICAL EDGE IN POLY ?
By alexnguyen · 2016-04-11
Description
Comments (6)
johnim · 2016-09-12
and How to select horizontal edges?
:)
alexnguyen · 2016-09-19
actionMan.executeAction 0 "40044" -- Selection: Select Invert
.
miauu · 2016-04-11
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.
thank
alexnguyen · 2016-04-12
but how can i do in maxscript ? can you give me the function ?
.
miauu · 2016-04-12
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:""
)
)
thank u very much
alexnguyen · 2016-04-13
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