Meshop Edge Methods
 
 
 
 

   

Editable Mesh - Quick Navigation

The following methods exposed by the meshOp Struct provide advanced access to the mesh edges.

Topic Navigation:  

Chamfer Extrude Collapse Edges

Clone and Delete Edges

Divide Edge

Get A Using B

AutoEdge Visibility

Methods:

Chamfer, Extrude, Collapse Edges

meshop.chamferEdges <Mesh mesh> <edgelist> <float amount> 
Chamfers the specified edges by the specified amount.

EXAMPLE

obj = Box()
convertToMesh obj
meshop.chamferEdges obj #{7,8,11,14,17} 5
update obj
 

meshop.extrudeEdges<Mesh mesh> <edgelist> <float height> dir:<{<point3 dir> | #independent | #common}=#independent> node:<node=unsupplied> 	 

Creates new edges corresponding to the specified edges, and then moves the new edges by <height>.

The direction the edges are moved is determined by <dir>. If <dir> is a point3 value, the edges will be moved in that direction. (If <mesh> is a node, or if <mesh> is an Editable Mesh or a Mesh value and node: is specified, the direction is in the current coordinate system context. If <mesh> is an Editable Mesh or a Mesh value and node: is not specified, the direction is in the mesh's local coordinate system.)

If dir:#independent is specified, the edges are moved based on the normals of the faces using the edge. If dir:#common is specified, the edges are moved based on the normals of the face clusters using the edge.

EXAMPLE

obj = Box() --create a Box
convertToMesh obj --collapse to EMesh
meshop.extrudeEdges obj #{5,7,14,17} 10.0 --extrude edges
update obj --update the mesh
addmodifier obj (normalmodifier unify:true) --unify normals
addmodifier obj (smooth auto:true) --auto-smooth
convertToMesh obj --collapse to EMesh
 

meshop.collapseEdges <Mesh mesh> <edgelist> 

Collapses the specified edges.

EXAMPLE

obj = Box()
convertToMesh obj
meshop.collapseEdges obj #{14,17}
update obj
 

Clone and Delete Edges

meshop.cloneEdges <Mesh mesh> <edgelist> 

Clones the specified edges.

   

meshop.deleteEdges <Mesh mesh> <edgelist> delIsoVerts:<boolean=true> 

Deletes the specified edges.

If delIsoVerts: is true, any isolated vertices are deleted.

Divide Edges

meshop.divideEdge <Mesh mesh> <int edgeIndex> <float edgef> visDiag1:<boolean=false> visDiag2:<boolean=false> fixNeighbors:<boolean=true> split:<boolean=false> 

Divides the specified edge at a fractional distance of <edgef> along its length.

visDiag1: and visDiag2: specify whether each of the two new edges will be visible.

If fixNeighbors: is true, the face on the other side of this edge, that is, the "reverse face", should be divided as well to prevent the introduction of a seam.

If split: is true, separate vertices for the two halves of the edge will be created, splitting the mesh open along the diagonal(s).

EXAMPLE

obj = Box() --create a Box
convertToMesh obj --collapse to EMesh
meshop.divideEdge obj 5 0.33 --divide bottom edge at 1/3
meshop.divideEdge obj 5 0.5 --divide remaining 2/3 at half -> 2 * 1/3
update obj --update the mesh
obj.vertexTicks = True --show the vertices
obj.allEdges=True --show all edges
 

meshop.divideEdges <Mesh mesh> <edgelist> 

Divides all the specified edges in half, creating new points and subdividing faces.

EXAMPLE

obj = Box() --create a Box
convertToMesh obj --collapse to EMesh
meshop.divideEdges obj #{5,7,14,17} --divide edges
update obj --update the mesh
obj.vertexTicks = True --show the vertices
obj.allEdges=True --show all edges
 

meshop.edgeTessellate <Mesh mesh> <facelist> <float tension> 

Tessellates the specified edges. This algorithm is exactly the one used in the Tessellate modifier, when operating on Faces and Edge SO elements.

<tension> specifies the tension for the edge tessellation. This value should be fairly small, between 0 and .5, and corresponds to the value in the Tessellate, Edit Mesh, or Editable Mesh UI's divided by 400.

EXAMPLE

obj = Box() --create a Box
convertToMesh obj --collapse to EMesh
meshop.EdgeTessellate obj #{5,6} 0.0 --tessellate faces based on edges
update obj --update the mesh
 

meshop.turnEdge <Mesh mesh> <int edgeIndex> 

Turns the specified edge. Only works on edges that have a face on both sides. These two faces are considered as a quad, where this edge is the diagonal, and remapped so that the diagonal flows the other way, between the vertices that were opposite this edge on each face.

   

Get A Using B...

meshop.getVertsUsingEdge <Mesh mesh> <edgelist> 

Returns a bitarray of size=(#vertices in mesh) with bits set for all vertices that are used by the specified edges.

SCRIPT

macroScript Edge2VertSel category:"MXS Help"
(
--make sure a single EMesh object is selected
on isEnabled return
selection.count == 1 and classof selection[1] == Editable_Mesh
on execute do
(
obj = selection[1]--get selected object
edgeSel = getEdgeSelection obj --get selected Edges
--get Verts of selected Edges:
vertsSel = meshop.getVertsUsingEdge obj edgeSel
setVertSelection obj vertsSel --select the Verts
max modify mode --switch to Modify panel
subObjectLevel =1--set Vertex SO level
) --end on
) --end macro
 

meshop.getFacesUsingEdge <Mesh mesh> <edgelist> 

Returns a bitarray of size=(#faces in mesh) with bits set for all faces that use the specified edges.

SCRIPT

macroScript Edge2FaceSel category:"MXS Help"
(
--make sure a single EMesh object is selected
on isEnabled return
selection.count == 1 and classof selection[1] == Editable_Mesh
on execute do
(
obj = selection[1] --get selected object
edgeSel = getEdgeSelection obj --get selected Edges
--get Faces of selected Edges:
faceSel = meshop.getFacesUsingEdge obj edgeSel
setFaceSelection obj faceSel --select the Faces
maxmodify mode --switch to Modify panel
subObjectLevel =3 --set Face SO level
) --end on
) --end macro
 

meshop.getPolysUsingEdge <Mesh mesh> <edgelist> ignoreVisEdges:<boolean=false> threshhold:<float=45.> 

Returns a bitarray of size equal to the number of faces in mesh with bits set for all faces that are in 'polygons' containing the specified edges.

The definition of a polygon is all faces sharing invisible edges with edge angles below the threshhold angle. The default threshhold angle is 45 degrees.

If ignoreVisEdges: is set to true, the edge visibility is ignored but the threshhold is still relevant.

SCRIPT

macroScript Edge2PolySel category:"MXS Help"
(
--make sure a single EMesh object is selected
on isEnabled return
selection.count == 1 and classof selection[1] == Editable_Mesh
on execute do
(
obj = selection[1] --get selected object
edgeSel = getEdgeSelection obj --get selected Edges
--get Polygons of selected Edges:
faceSel = meshop.getPolysUsingEdge obj edgeSel
setFaceSelection obj faceSel --select the Faces
max modify mode --switch to Modify panel
subObjectLevel =4 --set Polygon SO level
) --end on
) --end macro
 

meshop.getEdgesUsingVert <Mesh mesh> <vertlist> 

Returns a bitarray of size=(#edges in mesh) with bits set for all edges that use the specified vertices.

SCRIPT

macroScript Vert2EdgeSel category:"MXS Help"
(
--make sure a single EMesh object is selected
on isEnabled return
selection.count == 1 and classof selection[1] == Editable_Mesh
on execute do
(
obj = selection[1] --get selected object
vertsSel = getVertSelection obj --get selected Verts
--get Edges of selected Verts:
edgeSel = meshop.getEdgesUsingVert obj vertsSel
setEdgeSelection obj edgeSel --select the edges
max modify mode --switch to Modify panel
subObjectLevel =2 --set Edge SO level
)
) --end macro
 

meshop.getEdgesReverseEdge <Mesh mesh> <edgelist> 

Returns a bitarray of size=(#edges in mesh) with bits set for all additional edges that use the same vertices as the specified edges. These are edges on the adjacent faces.

EXAMPLE

Plane length:100 width:100 isSelected:on
convertTo $ TriMeshGeometry
max modify mode
subobjectLevel = 1
select $.verts[13]
--get edges that use vertex 13
edges = meshop.getEdgesUsingVert $ (getVertSelection $)
--select the vertices used by those edges
$.selectedVerts = meshop.getVertsUsingEdge $ edges
update $
--not what we wanted, really want all vertices
-- "surrounding" vertex 13
faces = meshop.getPolysUsingVert $ 13
$.selectedVerts = meshop.getVertsUsingFace $ faces
update $
--or ...
faces = meshop.getFacesUsingVert $ #(13)
edges = meshop.getEdgesUsingFace $ faces
--turn off all visible edges
for e in edges do edges[e]=not (getEdgeVis $ (1+(e-1)/3)(1+mod (e-1) 3))
--get the edges on the adjacent faces that are the "reverse" of these edges
--"OR" that bitarray with the initial edges bitarray
edges = (meshop.getEdgesReverseEdge $ edges) + edges
--get the faces that use the edges, and "OR" that bitarray with the initial
--face bitarray
faces = (meshop.getFacesUsingEdge $ edges) + faces
$.selectedVerts = meshop.getVertsUsingFace $ faces
update $

meshop.getOpenEdges <Mesh mesh> 

Returns a bitarray of size=(#edges in mesh) with bits set for all edges that are used by a single face.

SCRIPT

macroScript SelOpenEdges category:"MXS Help"
(
--make sure a single EMesh object is selected
on isEnabled return
selection.count == 1 and classof selection[1] == Editable_Mesh
on execute do
(
obj = selection[1] --get selected object
max modify mode --switch to Modify panel
subObjectLevel =2 --set Edge SO level
openEdges = meshop.getOpenEdges obj --get open edges
setEdgeSelection obj openEdges --select the open edges
)
) --end macro
 

AutoEdge Visibility

meshop.autoEdge <Mesh mesh> <edgelist> <float threshold> type:<{#SetClear| #Set| #Clear}=#SetClear>

Sets/clears the edge visibility for the specified edges based on the threshold angle.

Note

For an edge to be autoEdged, both it and the "reverse" edge on the face sharing the same vertices must be specified in the edge specification.

   

For more mesh-related methods, see

Editable Mesh - Topics Index

Editable_Mesh : GeometryClass and TriMesh : Value

See Also