[Closed] Edit mesh – get all edges
Hi,
Since there is no function for getting all the edges for edit mesh I need to create my own selection for all the edges. I used to use this:
actionMan.executeAction 0 "40021" -- Selection: Select All
which is just ctrl+alt. But this is not professional at all.
Since my script is a fx tool and does not need to have a good topology, I’ve been thinking to just triangulate the mesh, then convert to poly and use polyop.getNumEdges and then just double the number (for a trimesh).
However this method would need to convert to poly/mesh every time I get a new edge and might get a little slow when I add a lot of new vertices.
So how Can I do it the easier way? I mean to get the number of all the edges in the edit mesh?
For Editable_Poly and Editable_Mesh:
setEdgeSelection $ #{1..$.edges.count}
Also:
setEdgeSelection $ ($.edges as bitarray)
For meshes the number of edges is allways (number of faces * 3)
How could that be the case when triangles can share edges and on the other hand the mesh can have “border” or “outline” edges?
Thank you so much! I knew it should be something simple!
I went through almost all maxscript documentation and did’t find anywhere this. Sometimes I hate maxscript search engine
In Meshes, open edges are single, "shared" edges are double. Each face has allways 3 edges.
Technically there are no shared edges, as each of them are unique. When I mean shared I mean edges that uses the same two vertices.
In Meshes, if you pick one "shared" edge there is another edge build from the same vertices that belongs to the neighbor face. Those vertices are allways in reverse order, so these edges are called reverse edge.
(
node = plane lengthsegs:1 widthsegs:1
converttopoly node
format "poly numedges:%
" node.edges.count
converttomesh node
format "mesh numedges:%
" node.edges.count
openedges = meshop.getopenedges node
format "mesh open edges:%
" openedges
sharededges = (node.edges as bitarray) - openedges
format "mesh shared edges:%
" sharededges
)
-- poly numedges:[b]4[/b]
-- mesh numedges:[b]6[/b]
-- mesh open edges:#{1..2, 4..5}
-- mesh shared edges:#{3, 6}
Thanks for the detailed explanation. Did’nt know that.
Doing some geometry related scripting is well overdue for me …