Skill and measuring in huge quantities!
First the scientists and technologists would decide exactly what was needed, and what shape and material the part should be, then huge ranks of highly skilled draughtspeople would prepare technical drawings and blueprints, then the engineers, foundry men and machinists would make parts as per the drawings, each one with huge quantities of skill and measurement!
You should never under-estimate human skills, but conversely you should never loose admiration for the incredible work done by previous generations, without modern facilities. In my opinion there is no better example of this than the Antikythera Mechanism.