1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
|
<!doctype html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: module skeinforge_tools.skeinforge_utilities.triangle_mesh</title>
</head><body bgcolor="#f0f0f8">
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"> <br><big><big><strong><a href="skeinforge_tools.html"><font color="#ffffff">skeinforge_tools</font></a>.<a href="skeinforge_tools.skeinforge_utilities.html"><font color="#ffffff">skeinforge_utilities</font></a>.triangle_mesh</strong></big></big> ($Date: 2008/02/05 $)</font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/home/enrique/Desktop/backup/babbleold/script/reprap/pyRepRap/skeinforge_tools/skeinforge_utilities/triangle_mesh.py">/home/enrique/Desktop/backup/babbleold/script/reprap/pyRepRap/skeinforge_tools/skeinforge_utilities/triangle_mesh.py</a></font></td></tr></table>
<p><tt>Triangle Mesh holds the faces and edges of a triangular mesh.<br>
<br>
It can read from and write to a GNU Triangulated Surface (.gts) file.<br>
<br>
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.<br>
<br>
<br>
>python<br>
Python 2.5.1 (r251:54863, Sep 22 2007, 01:43:31)<br>
[GCC 4.2.1 (SUSE Linux)] on linux2<br>
Type "help", "copyright", "credits" or "license" for more information.<br>
>>> import carve<br>
>>> carve.main()<br>
File Screw Holder Bottom.stl is being carved.<br>
The carved file is saved as Screw Holder Bottom_carve.gcode<br>
It took 3 seconds to carve the file.<br>
<br>
<br>
>>> carve.writeOutput( 'Screw Holder Bottom.stl' )<br>
File Screw Holder Bottom.gcode is being carved.<br>
The carved file is saved as Screw Holder Bottom_carve.gcode<br>
It took 3 seconds to carve the file.<br>
<br>
<br>
>>> carve.getGcode("<br>
54 162 108 Number of Vertices,Number of Edges,Number of Faces<br>
-5.800000000000001 5.341893939393939 4.017841892579603 Vertex Coordinates XYZ<br>
5.800000000000001 5.341893939393939 4.017841892579603<br>
..<br>
many lines of GNU Triangulated Surface vertices, edges and faces<br>
..<br>
")</tt></p>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#aa55cc">
<td colspan=3 valign=bottom> <br>
<font color="#fffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr>
<tr><td bgcolor="#aa55cc"><tt> </tt></td><td> </td>
<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="__init__.html">__init__</a><br>
<a href="cStringIO.html">cStringIO</a><br>
</td><td width="25%" valign=top><a href="cmath.html">cmath</a><br>
<a href="skeinforge_tools.skeinforge_utilities.euclidean.html">skeinforge_tools.skeinforge_utilities.euclidean</a><br>
</td><td width="25%" valign=top><a href="skeinforge_tools.skeinforge_utilities.gcodec.html">skeinforge_tools.skeinforge_utilities.gcodec</a><br>
<a href="skeinforge_tools.skeinforge_utilities.intercircle.html">skeinforge_tools.skeinforge_utilities.intercircle</a><br>
</td><td width="25%" valign=top><a href="math.html">math</a><br>
</td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ee77aa">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
<tr><td bgcolor="#ee77aa"><tt> </tt></td><td> </td>
<td width="100%"><dl>
<dt><font face="helvetica, arial"><a href="skeinforge_tools.skeinforge_utilities.triangle_mesh.html#Edge">Edge</a>
</font></dt><dt><font face="helvetica, arial"><a href="skeinforge_tools.skeinforge_utilities.triangle_mesh.html#EdgePair">EdgePair</a>
</font></dt><dt><font face="helvetica, arial"><a href="skeinforge_tools.skeinforge_utilities.triangle_mesh.html#Face">Face</a>
</font></dt><dt><font face="helvetica, arial"><a href="skeinforge_tools.skeinforge_utilities.triangle_mesh.html#LoopArea">LoopArea</a>
</font></dt><dt><font face="helvetica, arial"><a href="skeinforge_tools.skeinforge_utilities.triangle_mesh.html#TriangleMesh">TriangleMesh</a>
</font></dt></dl>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom> <br>
<font color="#000000" face="helvetica, arial"><a name="Edge">class <strong>Edge</strong></a></font></td></tr>
<tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td>
<td colspan=2><tt>An edge of a triangle mesh.<br> </tt></td></tr>
<tr><td> </td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="Edge-__init__"><strong>__init__</strong></a>(self)</dt><dd><tt>Set the face indexes to None.</tt></dd></dl>
<dl><dt><a name="Edge-__repr__"><strong>__repr__</strong></a>(self)</dt><dd><tt>Get the string representation of this <a href="#Edge">Edge</a>.</tt></dd></dl>
<dl><dt><a name="Edge-addFaceIndex"><strong>addFaceIndex</strong></a>(self, faceIndex)</dt><dd><tt>Add first None face index to input face index.</tt></dd></dl>
<dl><dt><a name="Edge-getFromVertexIndexes"><strong>getFromVertexIndexes</strong></a>(self, edgeIndex, vertexIndexes)</dt><dd><tt>Initialize from two vertex indices.</tt></dd></dl>
<dl><dt><a name="Edge-getGNUTriangulatedSurfaceLine"><strong>getGNUTriangulatedSurfaceLine</strong></a>(self)</dt><dd><tt>Get the GNU Triangulated Surface (.gts) line of text.</tt></dd></dl>
</td></tr></table> <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom> <br>
<font color="#000000" face="helvetica, arial"><a name="EdgePair">class <strong>EdgePair</strong></a></font></td></tr>
<tr><td bgcolor="#ffc8d8"><tt> </tt></td><td> </td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="EdgePair-__init__"><strong>__init__</strong></a>(self)</dt><dd><tt>Pair of edges on a face.</tt></dd></dl>
<dl><dt><a name="EdgePair-__repr__"><strong>__repr__</strong></a>(self)</dt><dd><tt>Get the string representation of this <a href="#EdgePair">EdgePair</a>.</tt></dd></dl>
<dl><dt><a name="EdgePair-getFromIndexesEdges"><strong>getFromIndexesEdges</strong></a>(self, edgeIndexes, edges)</dt><dd><tt>Initialize from edge indices.</tt></dd></dl>
</td></tr></table> <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom> <br>
<font color="#000000" face="helvetica, arial"><a name="Face">class <strong>Face</strong></a></font></td></tr>
<tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td>
<td colspan=2><tt>A face of a triangle mesh.<br> </tt></td></tr>
<tr><td> </td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="Face-__init__"><strong>__init__</strong></a>(self)</dt><dd><tt>Set the edge indexes to None.</tt></dd></dl>
<dl><dt><a name="Face-__repr__"><strong>__repr__</strong></a>(self)</dt><dd><tt>Get the string representation of this <a href="#Face">Face</a>.</tt></dd></dl>
<dl><dt><a name="Face-getFromEdgeIndexes"><strong>getFromEdgeIndexes</strong></a>(self, edgeIndexes, edges, faceIndex)</dt><dd><tt>Initialize from edge indices.</tt></dd></dl>
<dl><dt><a name="Face-getGNUTriangulatedSurfaceLine"><strong>getGNUTriangulatedSurfaceLine</strong></a>(self)</dt><dd><tt>Get the GNU Triangulated Surface (.gts) line of text.</tt></dd></dl>
<dl><dt><a name="Face-setEdgeIndexesToVertexIndexes"><strong>setEdgeIndexesToVertexIndexes</strong></a>(self, edges, edgeTable)</dt><dd><tt>Set the edge indexes to the vertex indexes.</tt></dd></dl>
</td></tr></table> <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom> <br>
<font color="#000000" face="helvetica, arial"><a name="LoopArea">class <strong>LoopArea</strong></a></font></td></tr>
<tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td>
<td colspan=2><tt>Complex loop with an area.<br> </tt></td></tr>
<tr><td> </td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="LoopArea-__init__"><strong>__init__</strong></a>(self, loop)</dt></dl>
<dl><dt><a name="LoopArea-__repr__"><strong>__repr__</strong></a>(self)</dt><dd><tt>Get the string representation of this flat path.</tt></dd></dl>
</td></tr></table> <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom> <br>
<font color="#000000" face="helvetica, arial"><a name="TriangleMesh">class <strong>TriangleMesh</strong></a></font></td></tr>
<tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td>
<td colspan=2><tt>A triangle mesh.<br> </tt></td></tr>
<tr><td> </td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="TriangleMesh-__init__"><strong>__init__</strong></a>(self)</dt><dd><tt>Add empty lists.</tt></dd></dl>
<dl><dt><a name="TriangleMesh-__repr__"><strong>__repr__</strong></a>(self)</dt><dd><tt>Get the string representation of this <a href="#TriangleMesh">TriangleMesh</a>.</tt></dd></dl>
<dl><dt><a name="TriangleMesh-getCarveCornerMaximum"><strong>getCarveCornerMaximum</strong></a>(self)</dt><dd><tt>Get the corner maximum of the vertices.</tt></dd></dl>
<dl><dt><a name="TriangleMesh-getCarveCornerMinimum"><strong>getCarveCornerMinimum</strong></a>(self)</dt><dd><tt>Get the corner minimum of the vertices.</tt></dd></dl>
<dl><dt><a name="TriangleMesh-getCarveLayerThickness"><strong>getCarveLayerThickness</strong></a>(self)</dt><dd><tt>Get the layer thickness.</tt></dd></dl>
<dl><dt><a name="TriangleMesh-getCarveRotatedBoundaryLayers"><strong>getCarveRotatedBoundaryLayers</strong></a>(self)</dt><dd><tt>Get the rotated boundary layers.</tt></dd></dl>
<dl><dt><a name="TriangleMesh-getGNUTriangulatedSurfaceText"><strong>getGNUTriangulatedSurfaceText</strong></a>(self)</dt><dd><tt>Get this mesh in the GNU Triangulated Surface (.gts) format.</tt></dd></dl>
<dl><dt><a name="TriangleMesh-getLoopsFromMesh"><strong>getLoopsFromMesh</strong></a>(self, z)</dt><dd><tt>Get loops from a carve of a mesh.</tt></dd></dl>
<dl><dt><a name="TriangleMesh-getZAddExtruderPaths"><strong>getZAddExtruderPaths</strong></a>(self, z)</dt><dd><tt>Get next z and add extruder loops.</tt></dd></dl>
<dl><dt><a name="TriangleMesh-setCarveBridgeLayerThickness"><strong>setCarveBridgeLayerThickness</strong></a>(self, bridgeLayerThickness)</dt><dd><tt>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.</tt></dd></dl>
<dl><dt><a name="TriangleMesh-setCarveImportRadius"><strong>setCarveImportRadius</strong></a>(self, importRadius)</dt><dd><tt>Set the import radius.</tt></dd></dl>
<dl><dt><a name="TriangleMesh-setCarveIsCorrectMesh"><strong>setCarveIsCorrectMesh</strong></a>(self, isCorrectMesh)</dt><dd><tt>Set the is correct mesh flag.</tt></dd></dl>
<dl><dt><a name="TriangleMesh-setCarveLayerThickness"><strong>setCarveLayerThickness</strong></a>(self, layerThickness)</dt><dd><tt>Set the layer thickness.</tt></dd></dl>
<dl><dt><a name="TriangleMesh-setEdgesForAllFaces"><strong>setEdgesForAllFaces</strong></a>(self)</dt><dd><tt>Set the face edges of all the faces.</tt></dd></dl>
</td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#eeaa77">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr>
<tr><td bgcolor="#eeaa77"><tt> </tt></td><td> </td>
<td width="100%"><dl><dt><a name="-addEdgePair"><strong>addEdgePair</strong></a>(edgePairTable, edges, faceEdgeIndex, remainingEdgeIndex, remainingEdgeTable)</dt><dd><tt>Add edge pair to the edge pair table.</tt></dd></dl>
<dl><dt><a name="-addLoopToPointTable"><strong>addLoopToPointTable</strong></a>(loop, pointTable)</dt><dd><tt>Add the points in the loop to the point table.</tt></dd></dl>
<dl><dt><a name="-addPointsAtZ"><strong>addPointsAtZ</strong></a>(edgePair, points, radius, vertices, z)</dt><dd><tt>Add point complexes on the segment between the edge intersections with z.</tt></dd></dl>
<dl><dt><a name="-addToZoneArray"><strong>addToZoneArray</strong></a>(point, z, zoneArray, zZoneInterval)</dt><dd><tt>Add a height to the zone array.</tt></dd></dl>
<dl><dt><a name="-addWithLeastLength"><strong>addWithLeastLength</strong></a>(loops, point, shortestAdditionalLength)</dt><dd><tt>Insert a point into a loop, at the index at which the loop would be shortest.</tt></dd></dl>
<dl><dt><a name="-compareAreaAscending"><strong>compareAreaAscending</strong></a>(loopArea, otherLoopArea)</dt><dd><tt>Get comparison in order to sort loop areas in ascending order of area.</tt></dd></dl>
<dl><dt><a name="-compareAreaDescending"><strong>compareAreaDescending</strong></a>(loopArea, otherLoopArea)</dt><dd><tt>Get comparison in order to sort loop areas in descending order of area.</tt></dd></dl>
<dl><dt><a name="-getAdditionalLoopLength"><strong>getAdditionalLoopLength</strong></a>(loop, point, pointIndex)</dt><dd><tt>Get the additional length added by inserting a point into a loop.</tt></dd></dl>
<dl><dt><a name="-getBridgeDirection"><strong>getBridgeDirection</strong></a>(belowLoops, layerLoops, layerThickness)</dt><dd><tt>Get span direction for the majority of the overhanging extrusion perimeter, if any.</tt></dd></dl>
<dl><dt><a name="-getBridgeLoops"><strong>getBridgeLoops</strong></a>(layerThickness, loop)</dt><dd><tt>Get the inset bridge loops from the loop.</tt></dd></dl>
<dl><dt><a name="-getCarveIntersectionFromEdge"><strong>getCarveIntersectionFromEdge</strong></a>(edge, vertices, z)</dt><dd><tt>Get the complex where the carve intersects the edge.</tt></dd></dl>
<dl><dt><a name="-getCommonVertexIndex"><strong>getCommonVertexIndex</strong></a>(edgeFirst, edgeSecond)</dt><dd><tt>Get the vertex index that both edges have in common.</tt></dd></dl>
<dl><dt><a name="-getDoubledRoundZ"><strong>getDoubledRoundZ</strong></a>(overhangingSegment, segmentRoundZ)</dt><dd><tt>Get doubled plane angle around z of the overhanging segment.</tt></dd></dl>
<dl><dt><a name="-getInclusiveLoops"><strong>getInclusiveLoops</strong></a>(allPoints, corners, importRadius, isInteriorWanted<font color="#909090">=True</font>)</dt><dd><tt>Get loops which include most of the points.</tt></dd></dl>
<dl><dt><a name="-getInsetPoint"><strong>getInsetPoint</strong></a>(loop, tinyRadius)</dt><dd><tt>Get the inset vertex.</tt></dd></dl>
<dl><dt><a name="-getLoopsFromCorrectMesh"><strong>getLoopsFromCorrectMesh</strong></a>(edges, faces, vertices, z)</dt><dd><tt>Get loops from a carve of a correct mesh.</tt></dd></dl>
<dl><dt><a name="-getLoopsFromUnprovenMesh"><strong>getLoopsFromUnprovenMesh</strong></a>(edges, faces, importRadius, vertices, z)</dt><dd><tt>Get loops from a carve of an unproven mesh.</tt></dd></dl>
<dl><dt><a name="-getLoopsInOrderOfArea"><strong>getLoopsInOrderOfArea</strong></a>(compareAreaFunction, loops)</dt><dd><tt>Get the loops in the order of area according to the compare function.</tt></dd></dl>
<dl><dt><a name="-getLoopsWithCorners"><strong>getLoopsWithCorners</strong></a>(corners, importRadius, loops, pointTable)</dt><dd><tt>Add corners to the loops.</tt></dd></dl>
<dl><dt><a name="-getLowestZoneIndex"><strong>getLowestZoneIndex</strong></a>(zoneArray, z)</dt><dd><tt>Get the lowest zone index.</tt></dd></dl>
<dl><dt><a name="-getNextEdgeIndexAroundZ"><strong>getNextEdgeIndexAroundZ</strong></a>(edge, faces, remainingEdgeTable)</dt><dd><tt>Get the next edge index in the mesh carve.</tt></dd></dl>
<dl><dt><a name="-getNumberOfOddIntersectionsFromLoops"><strong>getNumberOfOddIntersectionsFromLoops</strong></a>(leftPoint, loops)</dt><dd><tt>Get the number of odd intersections with the loops.</tt></dd></dl>
<dl><dt><a name="-getOverhangDirection"><strong>getOverhangDirection</strong></a>(belowOutsetLoops, segmentBegin, segmentEnd)</dt><dd><tt>Add to span direction from the endpoint segments which overhang the layer below.</tt></dd></dl>
<dl><dt><a name="-getOverlapRatio"><strong>getOverlapRatio</strong></a>(loop, pointTable)</dt><dd><tt>Get the overlap ratio between the loop and the point table.</tt></dd></dl>
<dl><dt><a name="-getPath"><strong>getPath</strong></a>(edges, pathIndexes, loop, z)</dt><dd><tt>Get the path from the edge intersections.</tt></dd></dl>
<dl><dt><a name="-getRemainingEdgeTable"><strong>getRemainingEdgeTable</strong></a>(edges, vertices, z)</dt><dd><tt>Get the remaining edge hashtable.</tt></dd></dl>
<dl><dt><a name="-getSharedFace"><strong>getSharedFace</strong></a>(firstEdge, faces, secondEdge)</dt><dd><tt>Get the face which is shared by two edges.</tt></dd></dl>
<dl><dt><a name="-getTriangleMesh"><strong>getTriangleMesh</strong></a>(fileName<font color="#909090">=''</font>)</dt><dd><tt>Carve a GNU Triangulated Surface file. If no fileName is specified, carve the first GNU Triangulated Surface file in this folder.</tt></dd></dl>
<dl><dt><a name="-getWideAnglePointIndex"><strong>getWideAnglePointIndex</strong></a>(loop)</dt><dd><tt>Get a point index which has a wide enough angle, most point indexes have a wide enough angle, this is just to make sure.</tt></dd></dl>
<dl><dt><a name="-getZoneInterval"><strong>getZoneInterval</strong></a>(layerThickness)</dt><dd><tt>Get the zone interval around the slice height.</tt></dd></dl>
<dl><dt><a name="-isInline"><strong>isInline</strong></a>(beginComplex, centerComplex, endComplex)</dt><dd><tt>Determine if the three complex points form a line.</tt></dd></dl>
<dl><dt><a name="-isPathAdded"><strong>isPathAdded</strong></a>(edges, faces, loops, remainingEdgeTable, vertices, z)</dt><dd><tt>Get the path indexes around a triangle mesh carve and add the path to the flat loops.</tt></dd></dl>
</td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#55aa55">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr>
<tr><td bgcolor="#55aa55"><tt> </tt></td><td> </td>
<td width="100%"><strong>__author__</strong> = 'Enrique Perez (perez_enrique@yahoo.com)'<br>
<strong>__credits__</strong> = 'Art of Illusion <http://www.artofillusion.org/>'<br>
<strong>__date__</strong> = '$Date: 2008/02/05 $'<br>
<strong>__license__</strong> = 'GPL 3.0'<br>
<strong>absolute_import</strong> = _Feature((2, 5, 0, 'alpha', 1), (2, 7, 0, 'alpha', 0), 16384)</td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#7799ee">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Author</strong></big></font></td></tr>
<tr><td bgcolor="#7799ee"><tt> </tt></td><td> </td>
<td width="100%">Enrique Perez (perez_enrique@yahoo.com)</td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#7799ee">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Credits</strong></big></font></td></tr>
<tr><td bgcolor="#7799ee"><tt> </tt></td><td> </td>
<td width="100%">Art of Illusion <<a href="http://www.artofillusion.org/">http://www.artofillusion.org/</a>></td></tr></table>
</body></html>
|