Main Content

stlFileChecker

Detect and list bad features of STL files

Since R2021b

Description

Use the stlFileChecker object to detect and list bad features in STL files. The bad features you can detect using the stlFileChecker object are:

  • Non-manifold edges

  • Non-manifold vertices

  • Slivers

  • Duplicate vertices

  • Normal transition edges

  • Free triangles

  • T-vertices

Creation

Description

obj = stlFileChecker(filename) detects bad features in the STL file specified by filename and lists the features in the stlFileChecker object.

example

obj = stlFileChecker(filename,Name=Value) detects bad features in the STL file using additional Input Properties specified as name-value arguments. Name is the property name and Value is the corresponding value. You can specify several name-value pair arguments in any order as Name1=Value1, ..., NameN=ValueN. Properties you do not specify retains their default values.

For example, stlFileChecker('sampleFile.stl',ShowLog=1) displays a log of the bad features in sampleFile.stl file.

example

Input Arguments

expand all

Name of the STL file, specified as a character vector or string scalar.

Example: S = stlFileChecker('sampleFile.stl')

Properties

expand all

Input Properties

Display or hide a log of the bad features in the STL file, specified as 1 or 0. Specify 1 to display the log of bad features. Specify 0 to hide the log of bad features.

Example: ShowLog=0

Data Types: logical

Minimum separation between two distinct vertices, specified as a positive scalar in meters. If the distance between two vertices is less than MinimumSeparation, then the object considers the vertices as duplicates. The smallest value that you can specify is 2.5e-7.

Example: MinimumSeparation=2e-6

Data Types: double

Minimum area of a triangle, specified as a positive scalar in square meters. If the area of a triangle is less than MinimumArea, then the object considers the triangle as a sliver. The smallest value that you can specify is 2.5e-12.

Example: MinimumArea=3e-10

Data Types: double

Derived Properties

Name of the input STL file, returned as a character vector.

Example: 'sampleFile.stl'

Data Types: char

Triangles connectivity list, returned as a n-by-3 matrix.

Example: [1450 1259 1261; 1402 1400 1209; 1274 1276 1080]

Data Types: double

This property is read-only.

Edges shared by more than two triangles, returned as a positive integer matrix.

Data Types: double

This property is read-only.

Vertex connected to two or more surfaces, returned as a positive integer matrix. A pair of triangles with a common edge belong to the same surface.

Data Types: double

This property is read-only.

Triangle with area less than MinimumArea, returned as a positive integer vector.

Data Types: double

This property is read-only.

Vertices with separation less than MinimumSeparation, returned as a positive integer vector.

Data Types: double

This property is read-only.

Edges shared by triangles with normals in opposite directions, returned as a positive integer vector.

Data Types: double

This property is read-only.

Triangles with no shared vertex, returned as a positive integer vector.

Data Types: double

This property is read-only.

Edge connected to any point other than the end point of a triangle, returned as a positive scalar.

Data Types: double

Object Functions

showDuplicateVerticesHighlight duplicate vertices in STL file or mesh
showFreeTrianglesHighlight free triangles in STL file or mesh
showNonManifoldEdgesHighlight non-manifold edges in STL file or mesh
showNonManifoldVerticesHighlight non-manifold vertices in STL file or mesh
showNormalTransitionEdgesHighlight normal transition edges in STL file or mesh
showSliversHighlight slivers in STL file or mesh
showTVerticesHighlight T-vertices in STL file or mesh

Examples

collapse all

Use the stlFileChecker object to detect and display bad features in a STL file.

stlFilename = 'sample_stl_file.stl';
s = stlFileChecker(stlFilename)
detected 8 Non Manifold Edges.
detected 3 Non Manifold Vertices.
detected 4 duplicate Vertices.
detected 0 Slivers.
detected 12 Normal Transition Edges.
detected 2 Free Triangles.
detected 9 T-Vertices.
s = 
  stlFileChecker with properties:

                 FileName: 'sample_stl_file.stl'
            Triangulation: [162x3 triangulation]
         NonManifoldEdges: [8x2 double]
      NonManifoldVertices: [3x1 double]
                  Slivers: [0x1 double]
        DuplicateVertices: [4x1 double]
    NormalTransitionEdges: [12x2 double]
            FreeTriangles: [2x1 double]
                TVertices: [9x1 double]
                  ShowLog: 1
        MinimumSeparation: 1.0000e-06
              MinimumArea: 1.0000e-11

Visualize the non-manifold edges in the STL file.

showNonManifoldEdges(s)

Figure contains an axes object. The axes object with title Mesh Showing Non-Manifold Edges contains 3 objects of type patch, line. One or more of the lines displays its values using only markers This object represents Non-Manifold Edges.

Visualize the non-manifold vertices in the STL file.

figure
showNonManifoldVertices(s)

Figure contains an axes object. The axes object with title Mesh Showing Non-Manifold Vertices contains 2 objects of type patch, line. One or more of the lines displays its values using only markers This object represents Non-Manifold Vertices.

Visualize duplicate vertices in the STL file.

figure
showDuplicateVertices(s)

Figure contains an axes object. The axes object with title Mesh Showing Duplicate Vertices contains 2 objects of type patch, line. One or more of the lines displays its values using only markers This object represents Duplicate Vertices.

Visualize the normal transition edges in the STL file.

figure
showNormalTransitionEdges(s)

Figure contains an axes object. The axes object with title Mesh Showing Normal Transition Edges contains 3 objects of type patch, line. One or more of the lines displays its values using only markers This object represents Normal Transition Edges.

Visualize the free triangles in the STL file.

figure
showFreeTriangles(s)

Figure contains an axes object. The axes object with title Mesh Showing Free Triangles contains 3 objects of type patch, line. One or more of the lines displays its values using only markers This object represents Free Triangles.

Visualize the T-vertices in the STL file.

figure
showTVertices(s)

Figure contains an axes object. The axes object with title Mesh Showing T-Vertices contains 2 objects of type patch, line. One or more of the lines displays its values using only markers This object represents T-Vertices.

Detect and visualize the T-vertices in an STL file.

s = stlFileChecker('sample_file.stl',ShowLog=0);

Visualize the T-vertices in the STL file.

showTVertices(s)

Figure contains an axes object. The axes object with title Mesh Showing T-Vertices contains 2 objects of type patch, line. One or more of the lines displays its values using only markers This object represents T-Vertices.

More About

expand all

Version History

Introduced in R2021b

See Also

Functions

Objects