This tutorial explains what a stackup is and how to calculate it. Parts within a machine are manufactured according to part's features falling into an allowable tolerance range. Based on these tolerances, running clearances can be used up causing parts to intefere with each other and fail. This program can ensure that this problem doesn't occur.
The gearbox above will be used as an example for explaining how to implement this program.
In addition to calulating based on the values of dimension's tolerances being at their extremes, this program will also calculate based on the more likely value that a part's feature will be machined to (i.e., towards the nominal value of a dimension).