The invention relates to a method for calculating the offset of a coordinate
system in
numerical control machining, which comprises the following steps of: acquiring
machine tool data, operating a developed
macro program, automatically writing offset values of a required workpiece zero point under different angles of a B axis by a
machine tool, and establishing a workpiece coordinate
system; through automatic conversion of the
macro program, the debugging time can be shortened, the theoretical calculation has no error, the debugging
rejection rate can be reduced, and the cost is saved; and the precision and reliability of shell part
machining are improved. According to the invention, the coordinate origin can be automatically offset during multi-directional
processing without clamping the reference point of the workpiece at the rotation center of the
workbench. After the
workbench rotates, a workpiece coordinate
system is automatically compensated, manual operation errors can be avoided,
machining original points of all faces can be accurately set, and the debugging
rejection rate is reduced. The efficiency can be improved, and the new product debugging time is shortened. In addition, the user
macro program is clear in logic, clear at a glance, easy to modify and high in universality.