# Python: module skeinforge_tools.skeinforge_utilities.triangle_mesh

skeinforge_tools.skeinforge_utilities.triangle_mesh ($Date: 2008/02/05 $) | index /home/enrique/Desktop/backup/babbleold/script/reprap/pyRepRap/skeinforge_tools/skeinforge_utilities/triangle_mesh.py

`Triangle Mesh holds the faces and edges of a triangular mesh.
It can read from and write to a GNU Triangulated Surface (.gts) file.
The following examples carve the GNU Triangulated Surface file Screw Holder Bottom.stl. The examples are run in a terminal in the folder which
contains Screw Holder Bottom.stl and triangle_mesh.py.
>python
Python 2.5.1 (r251:54863, Sep 22 2007, 01:43:31)
[GCC 4.2.1 (SUSE Linux)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import carve
>>> carve.main()
File Screw Holder Bottom.stl is being carved.
The carved file is saved as Screw Holder Bottom_carve.gcode
It took 3 seconds to carve the file.
>>> carve.writeOutput()
File Screw Holder Bottom.gcode is being carved.
The carved file is saved as Screw Holder Bottom_carve.gcode
It took 3 seconds to carve the file.
>>> carve.getCarveGcode("
54 162 108 Number of Vertices,Number of Edges,Number of Faces
-5.800000000000001 5.341893939393939 4.017841892579603 Vertex Coordinates XYZ
5.800000000000001 5.341893939393939 4.017841892579603
..
many lines of GNU Triangulated Surface vertices, edges and faces
..
")`

Modules

``

__init__ cStringIO | cmath skeinforge_tools.skeinforge_utilities.euclidean | skeinforge_tools.skeinforge_utilities.gcodec skeinforge_tools.skeinforge_utilities.intercircle | math

Classes

``

Edge
EdgePair
Face
LoopArea
TriangleMesh

class Edge
`` | `An edge of a triangle mesh.`

Methods defined here:

__init__(self)
  `Set the face indexes to None.`

__repr__(self)
  `Get the string representation of this Edge.`

addFaceIndex(self, faceIndex)
  `Add first None face index to input face index.`

getFromVertexIndexes(self, edgeIndex, vertexIndexes)
  `Initialize from two vertex indices.`

getGNUTriangulatedSurfaceLine(self)
  `Get the GNU Triangulated Surface (.gts) line of text.`

class EdgePair

``

Methods defined here:

__init__(self)
  `Pair of edges on a face.`

__repr__(self)
  `Get the string representation of this EdgePair.`

getFromIndexesEdges(self, edgeIndexes, edges)
  `Initialize from edge indices.`

class Face
`` | `A face of a triangle mesh.`

Methods defined here:

__init__(self)
  `Set the edge indexes to None.`

__repr__(self)
  `Get the string representation of this Face.`

getFromEdgeIndexes(self, edgeIndexes, edges, faceIndex)
  `Initialize from edge indices.`

getGNUTriangulatedSurfaceLine(self)
  `Get the GNU Triangulated Surface (.gts) line of text.`

setEdgeIndexesToVertexIndexes(self, edges, edgeTable)
  `Set the edge indexes to the vertex indexes.`

class LoopArea
`` | `Complex loop with an area.`

Methods defined here:

__init__(self, loop)

__repr__(self)
  `Get the string representation of this flat path.`

class TriangleMesh
`` | `A triangle mesh.`

Methods defined here:

__init__(self)
  `Add empty lists.`

__repr__(self)
  `Get the string representation of this TriangleMesh.`

getCarveCornerMaximum(self)
  `Get the corner maximum of the vertices.`

getCarveCornerMinimum(self)
  `Get the corner minimum of the vertices.`

getCarveLayerThickness(self)
  `Get the layer thickness.`

getCarveRotatedBoundaryLayers(self)
  `Get the rotated boundary layers.`

getGNUTriangulatedSurfaceText(self)
  `Get this mesh in the GNU Triangulated Surface (.gts) format.`

getLoopsFromMesh(self, z)
  `Get loops from a carve of a mesh.`

getZAddExtruderPaths(self, z)
  `Get next z and add extruder loops.`

setCarveBridgeLayerThickness(self, bridgeLayerThickness)
  `Set the bridge layer thickness. If the infill is not in the direction of the bridge, the bridge layer thickness should be given as None or not set at all.`

setCarveImportRadius(self, importRadius)
  `Set the import radius.`

setCarveIsCorrectMesh(self, isCorrectMesh)
  `Set the is correct mesh flag.`

setCarveLayerThickness(self, layerThickness)
  `Set the layer thickness.`

setEdgesForAllFaces(self)
  `Set the face edges of all the faces.`

Functions

``

addEdgePair(edgePairTable, edges, faceEdgeIndex, remainingEdgeIndex, remainingEdgeTable)
  `Add edge pair to the edge pair table.`

addLoopToPointTable(loop, pointTable)
  `Add the points in the loop to the point table.`

addPointsAtZ(edgePair, points, radius, vertices, z)
  `Add point complexes on the segment between the edge intersections with z.`

addToZoneArray(point, z, zoneArray, zZoneInterval)
  `Add a height to the zone array.`

addWithLeastLength(loops, point, shortestAdditionalLength)
  `Insert a point into a loop, at the index at which the loop would be shortest.`

compareArea(loopArea, otherLoopArea)
  `Get comparison in order to sort loop areas in descending order of area.`

getAdditionalLoopLength(loop, point, pointIndex)
  `Get the additional length added by inserting a point into a loop.`

getBridgeDirection(belowLoops, layerLoops, layerThickness)
  `Get span direction for the majority of the overhanging extrusion perimeter, if any.`

getBridgeLoops(layerThickness, loop)
  `Get the inset bridge loops from the loop.`

getCarveIntersectionFromEdge(edge, vertices, z)
  `Get the complex where the carve intersects the edge.`

getCommonVertexIndex(edgeFirst, edgeSecond)
  `Get the vertex index that both edges have in common.`

getDoubledRoundZ(overhangingSegment, segmentRoundZ)
  `Get doubled plane angle around z of the overhanging segment.`

getInclusiveLoops(allPoints, corners, importRadius, isInteriorWanted)
  `Get loops which include most of the points.`

getLoopsFromCorrectMesh(edges, faces, vertices, z)
  `Get loops from a carve of a correct mesh.`

getLoopsFromUnprovenMesh(edges, faces, importRadius, vertices, z)
  `Get loops from a carve of an unproven mesh.`

getLoopsInDescendingOrderOfArea(loops)
  `Get the lowest zone index.`

getLoopsWithCorners(corners, importRadius, loops, pointTable)
  `Add corners to the loops.`

getLowestZoneIndex(zoneArray, z)
  `Get the lowest zone index.`

getNextEdgeIndexAroundZ(edge, faces, remainingEdgeTable)
  `Get the next edge index in the mesh carve.`

getOverhangDirection(belowOutsetLoops, segmentBegin, segmentEnd)
  `Add to span direction from the endpoint segments which overhang the layer below.`

getOverlapRatio(loop, pointTable)
  `Get the overlap ratio between the loop and the point table.`

getPath(edges, pathIndexes, loop, z)
  `Get the path from the edge intersections.`

getRemainingEdgeTable(edges, vertices, z)
  `Get the remaining edge hashtable.`

getSharedFace(firstEdge, faces, secondEdge)
  `Get the face which is shared by two edges.`

getTriangleMesh(fileName='')
  `Carve a GNU Triangulated Surface file. If no fileName is specified, carve the first GNU Triangulated Surface file in this folder.`

getZoneInterval(layerThickness)
  `Get the zone interval around the slice height.`

isInline(beginComplex, centerComplex, endComplex)
  `Determine if the three complex points form a line.`

isPathAdded(edges, faces, loops, remainingEdgeTable, vertices, z)
  `Get the path indexes around a triangle mesh carve and add the path to the flat loops.`

isZInEdge(edge, vertices, z)
  `Determine if z is inside the edge.`

Data
`` |  | __author__ = 'Enrique Perez (perez_enrique@yahoo.com)' __credits__ = 'Art of Illusion <http://www.artofillusion.org/>' __date__ = '$Date: 2008/02/05 $' __license__ = 'GPL 3.0' absolute_import = _Feature((2, 5, 0, 'alpha', 1), (2, 7, 0, 'alpha', 0), 16384)

Author
`` |  | Enrique Perez (perez_enrique@yahoo.com)

Credits
`` |  | Art of Illusion <http://www.artofillusion.org/>