Enclosure design kicks off from the preliminary sketches created to pin down specifications of the device, but without the luxury of approximations this time around. Most measurements are precisely set by components that the enclosure will hold. The enclosure is designed around mechanical components like bolts, security screws, springs, buttons, sealing rubber components, etc. so that these components perform optimally for the product's life cicle. Most changes requiring displacement of inner components result in PCB layout changes, and vice versa. This is the reason why the enclosure design is only considered done when the last iteration of the PCB design is tested and approved for production.
First realistic visual representations of the enclosure and it's internals are made in 3D CAD programs, where the design can be tested for simulated tensile strength, assembly problems, and can be prepared for plastic injection molding.