Mesh Edge Methods

The following methods provide basic access to the mesh edges.

For more edge-related methods, see also

Edge Methods (meshop struct)

 

For more mesh-related methods, see

Editable Mesh - Topics Index

Editable_Mesh : GeometryClass and TriMesh : Value

 

Methods:

getEdgeVis <mesh> <face_index_integer> <edge_index_integer>

Returns the edge visibility for given edge (1,2,3) on indexed face as a boolean.

setEdgeVis <mesh> <face_index_integer> <edge_index_integer> <boolean>

Sets the edge visibility for given edge (1,2,3) on indexed face.

getEdgeSelection <node> [ <modifier_or_index> ] [ name:<name> ]

 

getEdgeSelection <mesh>

Retrieves the edge selection set, or the specified named selection set if the optional name: parameter is specified, as a BitArray. See the getVertSelection() method for more information.

setEdgeSelection <node> [ <modifier_or_index> ] ( <sel_bitarray> | <sel_array> ) [ name:<name> ] [ keep:<boolean> ]

 

setEdgeSelection <mesh> ( <sel_bitarray> | <sel_array> ) [ keep:<boolean> ]

Sets the edge selections in an Editable Mesh base object, Mesh Select modifier, Edit Mesh Modifier, or TriMesh. This mirrors the selection getting method above. See the setVertSelection() method for more information.

deselectHiddenEdges <mesh>

Deselects the hidden edges in the mesh. This method is not applicable to TriMeshes.

Notes

3ds Max defines an edge as the edge of a face. In any mesh object, the number of edges is 3 times the number of faces. A face has 3 vertices, and the face edges connect these vertices. Edges 1, 2, and 3 are the edges between vertices 1 and 2, 2 and 3, and 3 and 1, respectively. The first edge in a mesh is edge 1 on face 1, and the last edge is edge 3 on the last face. The following script selects all of the visible edges in the specified mesh:

Example:

obj = convertToMesh (Sphere()) -- Create a Sphere, turn to EMesh

obj.allEdges = true -- Show all edges

select obj -- Select the mesh

max modify mode -- Switch to Modify panel

subObjectLevel = 2 -- Set Sub-Object level to Edge

edgeSelSet=#() -- Init. an Array

for face = 1 to obj.numfaces do -- Go through all faces

for edge = 1 to 3 do -- And for every of the 3 edges

if (getedgevis obj face edge) do -- If the visibility is true,

append edgeSelSet (((face-1)*3)+edge) --collect the edge

setedgeselection obj edgeSelSet -- Select all visible edges

 

emesh_Edges_All.gif emesh_Edges_Visible.gif

 

The following function returns the indices of the 2 vertices that define an edge as a Point2 value. The two arguments to the function are an editable mesh node or TriMesh value and the edge index. A value of undefined is returned if the first argument isn't an editable mesh node or TriMesh value, or if the edge index is out of range.

Function:

fn edgeVerts theObj theEdge =

(

if not (classof theObj == Editable_mesh or classof theObj == triMesh) do

return undefined

if theEdge < 1 or theEdge > (theObj.numfaces*3) do

return undefined

local theFace = ((theEdge-1)/3)+1

local theVerts = getFace theObj theFace

case ((mod (theEdge-1) 3) as integer) of

(

0: point2 theVerts.x theVerts.y

1: point2 theVerts.y theVerts.z

2: point2 theVerts.z theVerts.x

)

)

See also:

Edge Methods (meshop struct)

 

For more mesh-related methods, see

Editable Mesh - Topics Index

Editable_Mesh : GeometryClass and TriMesh : Value