In this paper, we present a virtual surgery of total knee replacement based on a mechanical CAD software. The virtual surgery is implemented using basic functions of the CAD software such as shape modeling, assembly, automation, database access, and so on. By simulating the surgical processes in advance, the system allows a surgeon to determine the amount and the angle of bone resection and choose the artificial knee joint which fits the patient's knee accurately before the real operation. In addition, a surgeon can reduce time and mistakes to choose artificial knee joints and perform the operation effectively. In the future, the system can be applied for a knee joint navigation system and a surgery training/evaluation system.