This study is to investigate how to plan the trajectory of machining the surface in redundant five-axis machine tool. And using C++ TCP/IP Socket to communicate G-code with Matlab/Simulink. Then design the control program and the user interface.At last, we execute the surface machining by five-axis machine tool with feedforward controller, disturbance observer and PD controller to remove the disturbance while machining in PC Based architecture.