This is accomplished by forcing machined parts into direct contact with a solid, liquid or gas, which chemically contains large amounts of carbon or nitrogen. Because of the direct contact, the chemical is transferred to the outside of the parts. The parts are heated and quenched to achieve a hardened state. This process gives the parts a hard outer surface, while keeping the softer, more ductile inner material. This is an ideal solution for parts that need a tough, outer film and a flexible core.
All heat treat methods have one major drawback - distortion.
Heating and cooling of stock and parts alters the chemical composition as well as the physical dimensions of the material. Distortion is both growth and shrinkage of parts. The trick is to know which will occur. Physical alteration depends on the chemical composition of the part or stock, the maximum heating temperature, the length of heating time, the method of cooling, the length of cooling time, other chemicals involved in the alteration, the size and shape of the material and many more properties. There is a whole science, metallurgy, devoted to the study of these properties and the interaction between them.