In this paper we shall discuss how to treat the automatic selection of appropriate lathe tools in a computer-aided production planning (CAPP) application as a constraint satisfaction problem (CSP) over hierarchically structured finite domains. Conceptually it is straightforward to formulate lathe-tool selection in terms of a CSP, however the choice of constraint and domain representations and of the order in which the constraints are applied is nontrivial if a computationally tractable system design is to be achieved. Since the domains appearing in technical applications often can be modeled as a hierarchy, we investigate how constraint satisfaction algorithms can make use of this hierarchical structure. Moreover, many real-life problems are formulated in a way that no optimal solution can be found which satisfies all the given constraints. Therefore, in order to bring AI technology into real-world applications, it becomes very important to be able to cope with conflicting constraints and to relax the given CSP until a (suboptimal) solution can be found. For these reasons, the constraint system CONTAX has been developed, which incorporates an extended hierarchical arc-consistency algorithm together with discrete constraint relaxation and has been used to implement the lathe-tool selection module of the ARC-TEC planning system.