mgear.core.meshNavigation module
Functions to help navigate the mesh topology
- mgear.core.meshNavigation.bBoxData(obj=None, yZero=False, *args)
Get bounding box data of a mesh object
- Parameters:
obj (dagNode) – Mesh object
yZero (bool) – If True, sets the Y axis value to 0 in world space
args
- Returns:
center, radio, bounding box full data
- Return type:
list
- mgear.core.meshNavigation.bboxCenter(obj, radius=False)
Get bounding box center of mesh object
- Parameters:
obj (dagNode) – mesh object
radius (bool) – If True return a list the center + the radius
- Returns:
the bounding box center in world space
- Return type:
list of float
>>> center = mnav.bboxCenter(source, radius=False)
- mgear.core.meshNavigation.edgeLoopBetweenVertices(startPos, endPos)
Computes edge loop between two vertices.
- Parameters:
startPos (vertex) – Start of edge loop
endPos (vertex) – End of edge loop
- Returns:
Edge loop, if one exists. Otherwise None.
- mgear.core.meshNavigation.edgeRangeInLoopFromMid(edgeList, midPos, endA, endB)
Return a range of edges in the same loop from a mid position
- Parameters:
edgeList (list) – selection edge loop
midPos (vertex) – mid vertex
endA (vertex) – endA vertex
endB (vertex) – endB vertex
- Returns:
loop range
- Return type:
list
- mgear.core.meshNavigation.find_mirror_edge(obj, edgeIndx)
Return the mirror edge of an edge
- Parameters:
obj (PyNode or str) – Mesh object to get the mirror edge
edge (int) – Index of the edge to find the mirror
- Returns:
Mirror edge as a pynode
- Return type:
PyNode
- mgear.core.meshNavigation.getClosestPolygonFromTransform(geo, loc)
Get closest polygon from transform
- Parameters:
geo (dagNode) – Mesh object
loc (matrix) – location transform
- Returns:
Closest Polygon
- mgear.core.meshNavigation.getClosestVertexFromTransform(geo, loc)
Get closest vertex from transform
- Parameters:
geo (dagNode or str) – Mesh object
loc (matrix) – location transform
- Returns:
Closest Vertex
>>> v = mn.getClosestVertexFromTransform(geometry, joint)
- mgear.core.meshNavigation.getConcentricVertexLoop(loop, nbLoops)
Get concentric vertex loops
- Parameters:
loop (list) – Vertex loop list
nbLoops (int) – Number of loops to search
- Returns:
the loop list
- Return type:
list
- mgear.core.meshNavigation.getExtremeVertexFromLoop(edgeList=None, sideRange=False, z_up=False)
Get extreme vertex X and Y
min and max positions from edge loop
- Parameters:
edgeList (list) – Edge list
sideRange (bool) – If True will calculate the extreme position of Z instead of X
- Returns:
upPos, lowPos, inPos, outPos, edgeList, vertexList
- Return type:
list
- mgear.core.meshNavigation.getVertexRowsFromLoops(loopList)
Get vertex rows from edge loops
- Parameters:
loopList (list) – Edge loop list
- Returns:
vertex rows
- Return type:
list
- mgear.core.meshNavigation.get_closes_edge_index(sourceGeo, targetGeo, edgeIndx)
Get the closes edge index from 2 diferent object.
In some situation even with same topology and vertez index order. The edge index may change.
- Parameters:
sourceGeo (str) – Name of the source object
targetGeo (str) – Name of the target object
edgeIndx (int) – Edge Index
- Returns:
Description
- Return type:
PyNode
- mgear.core.meshNavigation.get_edge_center(mesh_dag_path, edge_indices)
Summary
- Parameters:
mesh_dag_path (dag paht) – mesh dag path
edge_indices (TYPE) – edge index tuple
- Returns:
position
- Return type:
vector
- Usage example:
mesh_dag_path = get_selected_mesh() edge_indices = [40, 60] # Replace with your desired edge indices center_position = get_edge_center(mesh_dag_path, edge_indices)
- mgear.core.meshNavigation.get_mesh_dag_path(node)
Get the mesh dag path from a given node.
- Parameters:
node (str or PyNode) – The name of the node or the PyNode itself
- Returns:
The dag path to the mesh
- Return type:
mesh_dag_path
- Raises:
ValueError – If the node does not exist or is not a mesh
- mgear.core.meshNavigation.get_selected_mesh()
Get the selected mesh dag path.
- Returns:
selected mesh dag path
- Return type:
seleted mesh
- Raises:
ValueError – Non selected object