PDF-3 SRT - Files - PKJ
PDF-3 SRT - Files - PKJ
PDPM
INDIAN INSTITUTE OF INFORMATION TECHNOLOGY,
DESIGN AND MANUFACTURING JABALPUR
(An Institute of National Importance (INI) established by MHRD, Govt. of INDIA) 9-Sep-24 Dr. P. K. Jain IIITDM Jabalpur 2
80
format was developed in 1987 for moving 3D CAD models to its
60
stereolithography apparatus (SLA) machines.
40
20 The STL file format has become the Rapid Prototyping industry's
20 40 60 80 100 120 140 160 180 200
20
200 100 slices. Ultimately these machines require a series of closed 2D
0
100
80 100
150
80 contours that are filled in with solidified material as the layers are
Y Axis (mm)
60
Y Axis (mm)
40
20
50
X Axis (mm)
60
fused together.
40
20
The natural file format for such a machine would be a series of
closed polygons corresponding to different Z-values.
External contours
40
Z Axis (mm)
0
20
0
200 20 40 60 80 100 120
X Axis (mm)
140 160 180 200 STL file format are capable of creating those 2D layers.
150
100
80 100
60
40 50
20
9-Sep-24 Y Axis (mm) Dr. P. K. Jain IIITDM Jabalpur
X Axis (mm) 4 September 9, 2024 Dr. Prashant K. Jain (IIITDM Jabalpur) 6
counterclockwise order representing the Second, the vertices are listed in counter clockwise order when looking
vertices of the triangle. at the object from the outside (right-hand rule).
While the ASCII form is more descriptive, the binary form is far
more common due to the very large resulting size of the CAD
data when saved in the ASCII format.
9-Sep-24 Dr. P. K. Jain IIITDM Jabalpur 11 September 9, 2024 Dr. Prashant K. Jain (IIITDM Jabalpur) 12
solid EXAMPLE_PART
facet normal 0.000000e+00 0.000000e+00 -1.000000e+00
GIVE N PART
outer loop
15
vertex 5.000000e+00 3.000000e+00 0.000000e+00
vertex 5.000000e+00 0.000000e+00 0.000000e+00 10
vertex 0.000000e+00 0.000000e+00 0.000000e+00 STL File export from various software
Z AXIS
5
endloop 0
endloop
endfacet
facet normal 0.000000e+00 0.000000e+00 1.000000e+00
outer loop 10 5
vertex 5.000000e+00 0.000000e+00 2.000000e+00
vertex 0.000000e+00 3.000000e+00 2.000000e+00
vertex 0.000000e+00 0.000000e+00 2.000000e+00
Y A X IS
Y AXIS
endloop 5 0
endfacet
facet normal 0.000000e+00 0.000000e+00 1.000000e+00
outer loop 0
vertex 5.000000e+00 0.000000e+00 2.000000e+00
-5
Common
Edge
Common
Vertices
9-Sep-24 Dr. P. K. Jain IIITDM Jabalpur 17 September 9, 2024 Dr. Prashant K. Jain (IIITDM Jabalpur) 18
9-Sep-24 Dr. P. K. Jain IIITDM Jabalpur 26 9-Sep-24 Dr. P. K. Jain IIITDM Jabalpur 27
September 9, 2024 Dr. Prashant K. Jain (IIITDM Jabalpur) 28 September 9, 2024 Dr. Prashant K. Jain (IIITDM Jabalpur) 29
Non-Manifold Conditions
Overlapping Facets There are 3 types of non-manifold conditions:
Due to numerical round-off errors occurring during 1. A valid model would be one whose facets have only one
tessellation. adjacent facet each, that is, one edge shares two facets only.
The vertices are represented in 3D space as floating-point Hence the non-manifold edges must be resolved such that each
numbers instead of integers. Thus the numerical round- facet has only one neighbouring facet along each edge, which
off can cause facets to overlap if tolerances are set too reconstructs a topologically manifold surface.
liberally.
9-Sep-24 Dr. P. K. Jain IIITDM Jabalpur 30 9-Sep-24 Dr. P. K. Jain IIITDM Jabalpur 31
2. A non-manifold point:
STL file repairing methods
3. A non-manifold face:
All vendors of RP systems accept this format and practically A Valid Model: A tessellated model is said to be valid if there
all major suppliers of CAD/CAM systems today provide an are no missing facets, degenerate facets, overlapping facets
interface between their CAD model and the STL file. The STL or any other abnormalities.
file (a collection of coordinate values of triangles) however, Valid tessellated model will first be sliced into 2D layers
not ideal and has inherent problems in this format. Each layer would be converted into unidirectional (or 1D) scan lines for
the laser or other RP techniques to commence building the model
New formats such as LEAF (layer exchange ASCII format),
The scan lines would act as on/off points for the laser beam controller
contour files which are slice formats and cubital facet list
so that the part model can be built accordingly without any problems.
(CFL). However, none of these has been accepted yet as a
replacement of STL.
Users of RP systems have to contend with existing STL file
problems and solutions have to be found to repair errors in
them.
9-Sep-24 Dr. P. K. Jain IIITDM Jabalpur 43 9-Sep-24 Dr. P. K. Jain IIITDM Jabalpur 44
An Invalid Model
The solid model is tessellated non-robustly which results in a gap
If this error is not corrected and the model is subsequently sliced
No predefined stopping boundary on the particular slice, thus the building
process would continue right to the physical limit of the RP machine,
creating a stray physical solid line and ruining the part being produced Generic Solution
(a) (b) (c)
9-Sep-24 Dr. P. K. Jain IIITDM Jabalpur 45 9-Sep-24 Dr. P. K. Jain IIITDM Jabalpur 46
Insight to the Basic Approach of the Generic Solution The algorithm for solving the ‘‘Missing Facet’’ problem
The main problem of repairing the invalid tessellated model is Detect and identify the boundaries of all the gaps in the
that of matching the solution to the designer's intent when model.
the intent may have been lost in the overall process. Without Suitable facets would then be generated to repair and "patch
the knowledge of the designer's intent, it would indeed be up" the gaps.
difficult to determine what the "right" solution should be. The size of the generated facets would be restricted by the
Hence, an "educated" guess is usually made when faced with gap's boundaries while the orientation of its normal would be
the ambiguities of the invalid model. controlled by comparing it with the rest of the shell. This is to
The algorithm aims to match, if not exceed, the quality of ensure that the generated facet orientation is correct and
repair done manually by a skilled technician when consistent throughout the gap closure process.
information of the designer's intent is not available.
9-Sep-24 Dr. P. K. Jain IIITDM Jabalpur 47 9-Sep-24 Dr. P. K. Jain IIITDM Jabalpur 48
The orientation of the shell's facets can be obtained from the STL
file which lists its vertices in an ordered manner following the Solving the "Missing Facets" Problem
Mobius rule. The following procedure illustrates the detection of gaps in the
Mobius rule: For every facet edge, there must be another facet and tessellated model and its subsequent repair. It is carried out in four
only that facet sharing the same edge. Since the vertices of a facet steps.
are ordered, the direction on one facet’s edge is exactly opposite to Step 1: Checking for Approved Edges with Adjacent Facets
another facet sharing the same edge.
The algorithm exploits this feature so that the repair carried out on
A representation of a portion of a
the invalid model, using suitably created facets, has the correct tessellated surface without any gaps.
orientation.
9-Sep-24 Dr. P. K. Jain IIITDM Jabalpur 49 9-Sep-24 Dr. P. K. Jain IIITDM Jabalpur 50
The checking routine is executed as follows for facet A as seen in figure: Step 2: Detection of Gaps in the Tessellated Model
1. (i) Read in first edge (vertex 1-2) from the STL file. The detection routine executes as follows:
(ii) Search file for a similar edge in the opposite direction (vertex 2-1). For Facet A
(iii) If edge exists, store this under a temporary file (file B) for approved edges. 1. (i) Read in edge {vertex 2-3} from the STL file.
2.(i) Read in second edge (vertex 2-3) from the STL file. (ii) Search file for a similar edge in the opposite direction { vertex 3-2}.
(ii) Search file for a similar edge in the opposite direction (vertex 3-2}. (iii) If edge does not exist, store edge (vertex 3-2) in another temporary file
(e.g. file C) for suspected gap's bounding edges and store vertex 2-3 in file B1
(iii) If edge exists, store this under a temporary file (file B) for approved edges.
for existing edges without adjacent facets. (this will be used later for checking
3. (i) Read in third (vertex 3-1) from the STL file.
the orientation of the generated facet).
(ii) Search file for a similar edge in the opposite direction (vertex 1-3).
(iii) If edge exists, store this under a temporary file (file B) for approved edges.
9-Sep-24 Dr. P. K. Jain IIITDM Jabalpur 51 9-Sep-24 Dr. P. K. Jain IIITDM Jabalpur 52
(iii) If it does not exist, store edge (vertex 2-5) in another temporary file C. Edge
Vertex 1st 2nd 3rd 4th 5th 6th 7th 8th 9th
3. (i) Repeat for edges: 5-2; 7-5; 9-7; 11-9; 3-11.
1st 3 5 * 11 2 7 * 9 *
(ii) Search for edges: 2-5; 5-7; 7-9; 9-11; 11-3.
2nd 2 7 * 3 5 9 * 11 *
(iii) Store all the edges in temporary file B1 for edges without any adjacent *represent all the other edges that would form the boundaries of
other gaps.
facet and store all the suspected bounding edges of the gap in temporary file C.
Step 3: Sorting of Erroneous
File B1 can appear as in Table 1. Edges into a Closed Loop
Table 2: all the edges are
Table 1. File B1 contains existing edges without adjacent facets.
unordered. Hence, the Table 3. File D containing sorted edges
Edge
edges have been sorted to Edge
Vertex 1st 2nd 3rd 4th 5th 6th
get a closed loop, it would Vertex 1st 2nd 3rd 4th 5th 6th
1st 2 7 3 5 9 11
then be stored in a 1st 3 2 5 7 9 11
2nd 3 5 11 2 7 9
temporary file, say file D. 2nd 2 5 7 9 11 3
9-Sep-24 Dr. P. K. Jain IIITDM Jabalpur 53 9-Sep-24 Dr. P. K. Jain IIITDM Jabalpur 54
Step 4: Generation of Facets for the Repair of the Gaps Step 4: Generation of Facets for the Repair of the Gaps
With reference to File D. With reference to File D.
Generating the first facet: Generating the second facet:
the first two vertices (V3 and V2) in the first two edges of file D will be Remaining vertices in file D, the previous second vertex (V2) will become
connected to the first vertex in the last edge (V11) in file D and the facet is the first vertex of file D. The second facet is formed by connecting the first
stored in a temporary file E (Table 5). vertex (V2) of the first edge with that of the last two vertices in file D (V9,
The facet is then checked for its orientation using the information stored in V11) and facet is stored in temporary file E. It is then checked to confirm if
file B1. Once its orientation is determined to be correct, the first vertex (V3) its orientation is correct.
from file D is temporarily removed. If it is correct, the vertex (V11) of the last edge in file D is then temporarily
removed.
Table 4. Process of facet generation.
Table 4. Process of facet generation.
V3 V2 V5 V7 V9 V11 V3 V2 V5 V7 V9 V11
F1 1 2 - - - 3 F1 1 2 - - - 3
F2 E 1 - - 2 3 F2 E 1 - - 2 3
Generation
Generation
of facets F3 E 1 2 - 3 E of facets F3 E 1 2 - 3 E
F4 E E 1 2 3 E F4 E E 1 2 3 E
V = vertex, F = facet, E = eliminated from the process of V = vertex, F = facet, E = eliminated from the process of
facet generation. facet generation.
9-Sep-24 Dr. P. K. Jain IIITDM Jabalpur 55 9-Sep-24 Dr. P. K. Jain IIITDM Jabalpur 56
The first vertex of the first two edges (V2, V5) is connected to the first
40
vertex of the last edge (V9) and the facet is stored in temporary file E. Once
its orientation is confirmed, the first vertex of the first edge (V2) will be 20
60 60
removed from file D temporarily. 0
50 40
60
50
40 40
30 20
20
30 10
0 0 60
20 60
50
10 40
40
0
20
60 30
50 40 30
20 10 0
20 0
60
10
40
0
60 20
50
40
30
20
10 0
0
9-Sep-24 Dr. P. K. Jain IIITDM Jabalpur 57 September 9, 2024 Dr. Prashant K. Jain (IIITDM Jabalpur) 58
9-Sep-24 Dr. P. K. Jain IIITDM Jabalpur 61 9-Sep-24 Dr. P. K. Jain IIITDM Jabalpur 62
Solving the "Wrong Orientation of Facets" Illustration showing how file D is manipulated to solve orientation problems
Edge
It can be seen that facet Z (vertices 1, 2, 11) is orientated in a clockwise Vertex First Second third Fourth Fifth Sixth Seventh Eighth Ninth Tenth Eleventh
direction and this contradicts the right hand rule adopted by the STL format. First 1 2 3 4 5 6 7 8 9 10 11
Thus, this is not acceptable and needs correction. This can be done by Second 2 3 4 5 6 7 8 9 10 11 1
shifting the last record in file D .
All the edges, including the initial one will be shifted one position to the
right (assuming that the records are stored in the left to right structure).
Once this is done, step 4 of facet generation can be implemented.
Facet Z, is again generated
(vertices 1, 2, 11) and
checked for orientation.
When its orientation is
correct, it is saved and
stored in temporary file E. After the shift:
Illustration showing the result of the shift to correct the facet orientation
If any subsequently
generated facet has an Edge
incorrect orientation, the Vertex First Second third Fourth Fifth Sixth Seventh Eighth Ninth Tenth Eleventh
whole process would be First 11 1 2 3 4 5 6 7 8 9 10
restarted. Second 1 2 3 4 5 6 7 8 9 10 11
9-Sep-24 Dr. P. K. Jain IIITDM Jabalpur 63 9-Sep-24 Dr. P. K. Jain IIITDM Jabalpur 64
The Need for an Expanded Algorithm Two or more gaps are formed from a Coincidental Vertex
In Previous, the algorithm presented could cater only for gaps The first special case deals with problems where two or more gaps are
(whether simple or complex) that are isolated from one another. formed from a coincidental vertex.
However, should any of the gaps meet at a common vertex, the
algorithm may not be able to work properly. The algorithm is
expanded to include solving some of these special cases:
1. Two or more gaps formed from a coincidental vertex
2. Degenerate facets
3. Overlapping facets File C containing “Erroneous” edges that would
form the boundaries of gaps
Edge
Vertex 1st 2nd 3rd 4th 5th 6th 7th
First V3 V5 V4 V1 V6 V2 V1
Second V4 V6 V1 V5 V1 V3 V2
9-Sep-24 Dr. P. K. Jain IIITDM Jabalpur 66 9-Sep-24 Dr. P. K. Jain IIITDM Jabalpur 68
9-Sep-24 Dr. P. K. Jain IIITDM Jabalpur 69 9-Sep-24 Dr. P. K. Jain IIITDM Jabalpur 70
Step 2: To Detect More Than One Gap For the first count, reading from file C, all the edges that would form
The second vertex of the second edge (V1) in file C1 is searched for an the first alternative closed loop are sorted. These first alternatives in file
equivalent first vertex of subsequent edges in file C (refer to Table). Once it C2 are then saved. A closed loop is established once the second vertex
is found (V1, first vertex of fourth edge), a count of one is registered. of the last edge (V3) is the same as the first vertex of the first edge (V3).
The search for the same vertex is continued. If there is an additional edge First alternative closed loop that may represent the boundary of the gap
sharing the same vertex 1, (seventh edge), another count is registered, File C2
making a total of two counts. Particular record in which it happens is also Edge
recorded. Vertex First Second Third Fourth Fifth Sixth Seventh
The search is continued until there are no further edges sharing the same First V3 V4 V1 V5 V6 V1 V2
Second V4 V1 V5 V6 V1 V2 V3
vertex.
Representation on how file C and C1 would look like during the normal search
File C: Count 1 Count 2 Representation on how file C would look like during the normal search
9-Sep-24 Dr. P. K. Jain IIITDM Jabalpur 71 9-Sep-24 Dr. P. K. Jain IIITDM Jabalpur 72
Representation on how file C would look like during the normal search
9-Sep-24 Dr. P. K. Jain IIITDM Jabalpur 73 9-Sep-24 Dr. P. K. Jain IIITDM Jabalpur 74
Illustrations on How the Algorithm Works How file C may appear given three gaps sharing the same two vertices
Edge
The algorithm can cater for more than two gaps sharing the same vertex, Vertex 1st 2nd 3rd 4th 5th 6th 7th 8th 9th 10th
1st V3 V5 V4 V1 V6 V2 V1 V2 V8 V7
2nd V4 V6 V1 V5 V1 V3 V2 V7 V2 V8
Step 2. Detection:
For V1, there are 2 counts
For V2, there are 2 counts
9-Sep-24 Dr. P. K. Jain IIITDM Jabalpur 75 9-Sep-24 Dr. P. K. Jain IIITDM Jabalpur 76
First Alternative: Count 1 for V1 and Count 1 for V2 Second Alternative: Count 1 for V1 and Count 2 for V2
Thus from file C the first alternative closed loop can be generated and
the file is shown in Table The second alternative of a closed loop can be sorted and is shown in Table
Edge
Edge
Vertex 1st 2nd 3rd 4th 5th 6th 7th 8th 9th 10th
Vertex 1st 2nd 3rd 4th 5th 6th 7th 8th 9th 10th
1st V3 V4 V1 V5 V6 V1 V2 - - -
1st V3 V4 V1 V5 V6 V1 V2 V7 V8 V2
2nd V4 V1 V5 V6 V1 V2 V3 - - -
2nd V4 V1 V5 V6 V1 V2 V7 V8 V2 V3
How file C may appear given three gaps sharing the same two vertices How file C may appear given three gaps sharing the same two vertices
Edge Edge
Vertex 1st 2nd 3rd 4th 5th 6th 7th 8th 9th 10th Vertex 1st 2nd 3rd 4th 5th 6th 7th 8th 9th 10th
1st V3 V5 V4 V1 V6 V2 V1 V2 V8 V7 1st V3 V5 V4 V1 V6 V2 V1 V2 V8 V7
2nd V4 V6 V1 V5 V1 V3 V2 V7 V2 V8 2nd V4 V6 V1 V5 V1 V3 V2 V7 V2 V8
9-Sep-24 Dr. P. K. Jain IIITDM Jabalpur 77 9-Sep-24 Dr. P. K. Jain IIITDM Jabalpur 78
Third Alternative: Count 2 for V1 and Count 1 for V2 Fourth Alternative: Count 2 for V1 and Count 2 for V2
The third alternative of a closed loop can again be sorted and is The fourth alternative of a closed loop can also be sorted and is shown
shown in Table in Table
Edge Edge
Vertex 1st 2nd 3rd 4th 5th 6th 7th 8th 9th 10th Vertex 1st 2nd 3rd 4th 5th 6th 7th 8th 9th 10th
1st V3 V4 V1 V1 - - - - - - 1st V3 V4 V1 V2 V7 V8 V2 - - -
2nd V4 V1 V2 V3 - - - - - - 2nd V4 V1 V2 V7 V8 V2 V3 - - -
How file C may appear given three gaps sharing the same two vertices How file C may appear given three gaps sharing the same two vertices
Edge Edge
Vertex 1st 2nd 3rd 4th 5th 6th 7th 8th 9th 10th Vertex 1st 2nd 3rd 4th 5th 6th 7th 8th 9th 10th
1st V3 V5 V4 V1 V6 V2 V1 V2 V8 V7 1st V3 V5 V4 V1 V6 V2 V1 V2 V8 V7
2nd V4 V6 V1 V5 V1 V3 V2 V7 V2 V8 2nd V4 V6 V1 V5 V1 V3 V2 V7 V2 V8
9-Sep-24 Dr. P. K. Jain IIITDM Jabalpur 79 9-Sep-24 Dr. P. K. Jain IIITDM Jabalpur 80
(ii) Mathematically, the two vectors x and y are said to be collinear if (ii) The orientation is checked.
there exist scalars s and t, which are both non-zero, such that: (iii) New facets are stored in a temporary
sx + ty = 0 (4) file.
But when applied in a computer, it is only necessary to have: 5. Search and delete facet A from original file.
9-Sep-24 Dr. P. K. Jain IIITDM Jabalpur 84 9-Sep-24 Dr. P. K. Jain IIITDM Jabalpur 85
Overlapping Facets
Vertex to vertex rule
The condition of overlapping facets can be caused by errors introduced by
The most common error in an STL file is non compliance with the vertex-to- inconsistent numerical round-off.
vertex rule. The STL specifications require that all adjacent triangles share This problem can be resolved through vertex merging where vertices within
two common vertices. a predetermined numerical round-off tolerance of one another can be
Each vertex of a triangle should be shared by 2 adjacent triangle. merged into one vertex.
It is recommended that this merging of vertices be done before the
searching of the model for gaps. This will eliminate unnecessary
detection of erroneous edges and save substantial computational time in
checking whether the edges can be used to generate another facet.
The figure on the left shows a top triangle containing a total of 4 vertex points. The
outer vertices of the top triangle are not shared with and one other single triangle. The
lower 2 triangles each contain one of the points as well as the fourth invalid vertex
point. To make this valid under the vertex to vertex rule the top triangle must be
subdivided as in the example on the right.
9-Sep-24 Dr. P. K. Jain IIITDM Jabalpur 86 9-Sep-24 Dr. P. K. Jain IIITDM Jabalpur 87
mergin
g
mergin
g
9-Sep-24 Dr. P. K. Jain IIITDM Jabalpur 88 September 9, 2024 Dr. Prashant K. Jain (IIITDMJ) 90