STEP Tolerance Sample Program
The TOLERANCE sample program demonstrates how to create STEP GD&T dimensions, datums, and tolerances. This program reads a simple file with geometry for a block and hole, then applies dimensions, datums, and tolerances to the faces.
To simplify this demonstration, the faces are found using previously assigned representation item names. A more sophisticated program would probably get the faces by having the user pick them from a 3D display.
The functions defined by the program are as follows. These can be pasted into other applications as needed. The make_callout() function defines a shape_aspect callout to identify a particular face on the part. You can also build a callout with many faces if needed.
The make dimension functions associate callouts with a dimension value and plus/minus tolerance. We provide a functions for distance between two callouts and diameter size dimensions. Other size dimensions are also possible.
The make tol functions apply flatness, position, and perpendicularity tolerances to callouts, with datums as needed. You can extend these functions to define tolerances for angularity, circular runout, coaxiality, concentricity, cylindricity, line profile, parallelism, roundness, straightness, surface profile, symmetry, and total runout.
make_flatness_tol() make_position_tol() make_perpendicularity_tol()
The datums functions define a datum from a face and then add them to tolerances where appropriate.
The sample data set is AP214, but the program reads any kind of STEP data (AP203, AP214, etc) and saves as the AP schema that it is linked with. If the input file has any data not supported by the AP schema, it will be ignored.
In the list above, select your Visual Studio version or platform, then right click on the link to save the zipped project files to your local disk. Unpack the zipfile.
On Windows, open the enclosed project file with Visual Studio and compile the program by selecting "Build All". The project creates a Console application that you can run from the command line. When using the 64bit version of ST-Developer, change the platform from "win32" to "X64" in the Visual Studio Configuration Manager before building.
On MacOS, Linux, and other Unix systems, the project directory contains a makefile that builds the sample program. The makefile uses the ROSE, ROSE_INCLUDE, and ROSE_LIB environment variables described in the ST-Developer installation notes. Compile the program by typing "make".
The Windows projects also include a makefile that you can use by typing "nmake", but you must run vcvars32.bat (found in the Visual Studio C++ bin directory) to make sure that the C++ compiler is in the command line search path.