Source and output

Project Files

(Right-click on projects to save)
How to Compile and Run

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.

	make_callout()

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.

	make_linear_dimension()
	make_diameter_dimension()

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.

	add_datum() 
	make_datum()

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.