Abstract:In HPGL file, the graphic elements are recorded according to the sequence made by the designers. A lot of useless journey is made by using the file and it is inefficient in drafting or machining process. In order to solve the problem, an algorithm based on the graphic elements whose start point and endpoint could be dynamically changed Along the drafting path was put forward. The sequence of the graphic elements and its reference points could be optimized by Using the algorithm, the question is converted to DXF, and the drafting or machining path could be reduced based on the optimized HPGL.