[Closed] Editable Mesh edge X visibility?
I have an editable mesh and I want to know visibility of edge X. How do I get this in mesh?
I guess I’d have to use getEdgeVis <mesh> <face_index_integer> <edge_index_integer>. The face_index_integer I get from meshop.getFacesUsingEdge <Mesh mesh> <edgelist> but where do I get the edge_index_integer? How do I know which edge (1,2,3) of that face my edge (X) is?
fn isEdgeVisible emesh edge_index = if (iskindof emesh Editable_Mesh or iskindof emesh TriMesh) do
(
if (face_index = edge_index/3) < emesh.numFaces do
(
edge_index_in_face = (mod edge_index 3) + 1
getEdgeVis emesh face_index edge_index_in_face
)
)
Each face has three edges so just test 1 through 3 till you find it. Does that work for you?
Test them how? I can’t find any function to map 1,2,3 to actual edge numbers.
There seems to be a strict relation between edges and faces indexes in Editable Mesh:
face 1 has edges 1,2,3
face 2 has edges 4,5,6
face 3 has edges 7,8,9
...
face n has edges (n*3)-2, (n*3)-1, (n*3)
I tried it on a messed Editable Poly converted to Editable Mesh, on a new messed Editable Mesh, and it was still true.
- Enrico
Thanks guys. However the script above doens’t seem to work for me :-/
Here is a working script I wrote to select all visible edges:
myObj = selection[1]
mySel = #()
for i in 1 to myObj.numFaces*3 do (
if getEdgeVis myObj ((i+2)/3) ((mod (i+2) 3) + 1) then (
append mySel i
)
)
setEdgeSelection myObj mySel
my bad …
It’s fixed now:
Selects all invisible edges for all selected meshes
fn isEdgeVisible emesh edge_index = if (iskindof emesh Editable_Mesh or iskindof emesh TriMesh) do
(
edge_index -= 1
if (face_index = edge_index/3 + 1) <= emesh.numFaces do
(
edge_index_in_face = (mod edge_index 3) + 1
getEdgeVis emesh face_index edge_index_in_face
)
)
for emesh in selection as array where iskindof emesh Editable_Mesh do
(
emesh.selectededges = for edge_index=1 to emesh.edges.count where not isEdgeVisible emesh edge_index collect edge_index
)