JP2009075727A - Numerical controller, numerical control program, and storage medium storing numerical control program - Google Patents

Numerical controller, numerical control program, and storage medium storing numerical control program Download PDF

Info

Publication number
JP2009075727A
JP2009075727A JP2007242312A JP2007242312A JP2009075727A JP 2009075727 A JP2009075727 A JP 2009075727A JP 2007242312 A JP2007242312 A JP 2007242312A JP 2007242312 A JP2007242312 A JP 2007242312A JP 2009075727 A JP2009075727 A JP 2009075727A
Authority
JP
Japan
Prior art keywords
movement
offset amount
program
cutting
tool
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
JP2007242312A
Other languages
Japanese (ja)
Other versions
JP4867876B2 (en
Inventor
Tatsumi Sugihara
辰実 杉原
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Brother Industries Ltd
Original Assignee
Brother Industries Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Brother Industries Ltd filed Critical Brother Industries Ltd
Priority to JP2007242312A priority Critical patent/JP4867876B2/en
Publication of JP2009075727A publication Critical patent/JP2009075727A/en
Application granted granted Critical
Publication of JP4867876B2 publication Critical patent/JP4867876B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Numerical Control (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To provide a numerical controller and a numerical control program, preventing work damage in operation for confirming a machining program. <P>SOLUTION: In this numerical controller, dry-run operation is turned on, and an offset amount is determined in time of the first execution of the NC program. Zmax is set to "0", a pre-movement position is set to "0", and the NC program is interpreted from the first line of the NC program (S11, S12). When there is an instruction to move in a Z-axis direction (S13: YES) and when there is a cut movement instruction of a Z-axis (S14: YES), a movement amount of cut movement "the pre-movement position-coordinates of a movement destination of the cut movement instruction" is stored in Zmv (S15). When Zmv>Zmax (S16: YES), Zmv is stored in Zmax (S17). The coordinates of the movement destination are stored in the pre-movement position (S19), and a block of an interpretation target is advanced (S21). It is returned to S12, S12-S21 are repeated until an instruction of a program end, and a maximum movement amount of the cut movement is stored in Zmax. A value of Zmax is stored in the offset amount (S22). <P>COPYRIGHT: (C)2009,JPO&INPIT

Description

本発明は、数値制御装置、数値制御プログラム及び数値制御プログラムを記憶した記憶媒体に関するものであり、詳細には、加工プログラムの確認のための作動におけるワーク損傷を防止する数値制御装置、数値制御プログラム及び数値制御プログラムを記憶した記憶媒体に関するものである。   The present invention relates to a numerical control device, a numerical control program, and a storage medium storing the numerical control program, and more specifically, a numerical control device and a numerical control program for preventing workpiece damage in an operation for checking a machining program. And a storage medium storing a numerical control program.

従来、加工プログラムが正しいかを確認するために空運転するドライラン動作が利用されている。例えば、特許文献1に記載の発明のNC装置におけるドライラン制御装置では、ドライランモードでは、工具の移動の立ち上がり時間と立下り時間とを制御している。また、特許文献2に記載の発明の工作機械における運転制御装置では、ドライランにおいてクーラントを供給せずに動作を行わせている。また、従来、加工プログラムの指示よりも、工具とワークとの距離を予め定められた距離(オフセット量)だけ離した距離で動作するドライランも行われている。このようなオフセットは装置ごとに1つ記憶されているが、加工プログラムにより使用する工具の長さ、ワークの高さが異なるため、操作者が適当なオフセット量を入力する必要がある。
特開平03−144807号公報 特開平02−100853号公報
Conventionally, a dry run operation in which the machining program is idle is used to check whether the machining program is correct. For example, in the dry run control device in the NC device of the invention described in Patent Document 1, the rise time and the fall time of the movement of the tool are controlled in the dry run mode. Moreover, in the operation control apparatus in the machine tool of the invention described in Patent Document 2, the operation is performed without supplying the coolant in the dry run. Conventionally, dry running is also performed in which the distance between the tool and the workpiece is separated by a predetermined distance (offset amount) rather than the instruction of the machining program. One such offset is stored for each apparatus. However, since the length of the tool used and the height of the workpiece differ depending on the machining program, it is necessary for the operator to input an appropriate offset amount.
Japanese Patent Laid-Open No. 03-144807 Japanese Patent Laid-Open No. 02-1000085

しかしながら、操作者が入力した数値が適当なのもでなかった場合、操作者が入力を間違えた場合、操作者がオフセット量の入力を忘れた場合には、入力された値又は記憶されていた値によっては、工具がワークに接触してしまい、ワークを傷つけてしまうという問題があった。   However, if the value entered by the operator is not appropriate, if the operator makes a mistake, or if the operator forgets to enter the offset amount, the entered value or stored value Depending on the case, there is a problem that the tool comes into contact with the workpiece and damages the workpiece.

本発明は、上述の問題点を解決するためになされたものであり、加工プログラムの確認のための作動におけるワーク損傷を防止する数値制御装置、数値制御プログラム及び数値制御プログラムを記憶した記憶媒体を提供することを目的とする。   The present invention has been made to solve the above-described problems, and a numerical control device, a numerical control program, and a storage medium storing the numerical control program for preventing workpiece damage in an operation for checking a machining program are provided. The purpose is to provide.

上記課題を解決するため、請求項1に係る発明の数値制御装置では、主軸により保持された工具を動作させ、冶具に固定されたワークを加工する工作機械を加工プログラムに基づいて数値制御する数値制御装置であって、前記工具と前記ワークとの距離を、前記加工プログラムの指定する距離よりも、所定量であるオフセット量だけ離した状態で前記加工プログラムに基づいて前記工具を動作させるドライラン動作を実施するドライラン動作手段と、前記工具又は前記ワークを前記工具と前記ワークとが近づく方向に移動させると共に、前記工具を動作させて前記ワークを切削する切削動作を指示する前記加工プログラムの切削指示における移動開始位置及び移動終了位置に基づいて前記オフセット量を決定するオフセット量決定手段とを備えている。   In order to solve the above-described problem, in the numerical control device according to the first aspect of the present invention, a numerical value for numerically controlling a machine tool that operates a tool held by a spindle and processes a workpiece fixed to a jig based on a processing program. A dry run operation for controlling the tool based on the machining program in a state in which the distance between the tool and the workpiece is separated from the distance specified by the machining program by an offset amount that is a predetermined amount. And a cutting instruction of the machining program for moving the tool or the workpiece in a direction in which the tool and the workpiece approach each other and instructing a cutting operation for cutting the workpiece by operating the tool. Offset amount determining means for determining the offset amount based on a movement start position and a movement end position in To have.

また、請求項2に係る発明の数値制御装置では、請求項1に記載の発明の構成に加えて、前記オフセット量決定手段は、前記切削指示のうち前記移動開始位置と前記移動終了位置との差のうち、最も大きい差を前記オフセット量に決定することを特徴とする。   Further, in the numerical control device according to the second aspect of the present invention, in addition to the configuration of the first aspect, the offset amount determining means is configured to determine whether the movement start position and the movement end position are included in the cutting instruction. Among the differences, the largest difference is determined as the offset amount.

また、請求項3に係る発明の数値制御装置では、請求項1に記載の発明の構成に加えて、前記オフセット量決定手段は、前記切削指示の前記移動開始位置のうち前記工具と前記ワークとが最も離れた方向の位置である最遠移動開始位置と、前記切削指示の前記移動終了位置のうち前記工具と前記ワークとが最も近づいた位置である最近移動終了位置との差を前記オフセット量に決定することを特徴とする。   In addition, in the numerical control device according to the invention of claim 3, in addition to the configuration of the invention of claim 1, the offset amount determination means includes the tool and the workpiece among the movement start positions of the cutting instruction. Is the difference between the farthest movement start position, which is the position in the farthest direction, and the most recent movement end position, which is the position at which the tool and the workpiece are closest to each other among the movement end positions of the cutting instruction. It is characterized by determining to.

また、請求項4に係る発明の数値制御装置では、請求項1に記載の発明の構成に加えて、前記加工プログラムを実行する際に実行する指示が前記切削指示である場合に、実行する切削指示の次に実行される前記切削指示を前記加工プログラムから探索する次切削指示探索手段を備え、前記オフセット量決定手段は、前記次切削指示探索手段により探索された切削指示の前記移動開始位置と前記移動終了位置との差をオフセット量に決定することを特徴とする。   Further, in the numerical control device according to the fourth aspect of the invention, in addition to the configuration of the first aspect of the invention, the cutting to be executed when the instruction to be executed when executing the machining program is the cutting instruction. A next cutting instruction searching unit that searches the cutting program for the cutting instruction to be executed next to the instruction, and the offset amount determining unit includes the movement start position of the cutting instruction searched by the next cutting instruction searching unit; The difference from the movement end position is determined as an offset amount.

また、請求項5に係る発明の数値制御プログラムでは、コンピュータを請求項1乃至4のいずれかに記載の数値制御装置の各種処理手段として動作させる。   In the numerical control program according to the fifth aspect of the present invention, the computer is operated as various processing means of the numerical control apparatus according to any one of the first to fourth aspects.

また、請求項6に係る発明のコンピュータ読み取り可能な記憶媒体では、請求項5に記載の数値制御プログラムを記憶している。   The computer-readable storage medium of the invention according to claim 6 stores the numerical control program according to claim 5.

請求項1に係る発明の数値制御装置では、工具とワークとの距離を、加工プログラムの指定する距離よりも、所定量であるオフセット量だけ離した状態で、加工プログラムに基づいて工具を動作させるドライラン動作を実施する際に、オフセット量を加工プログラム中の切削指示に併せて自動で決定することができる。よって、オフセット量を操作者が入力する場合に発生しうる、操作者によるオフセット量の計算誤り、オフセット量の入力誤り、オフセット量の入力忘れが発生しない。したがって、人為的ミスにより工具とワークとが接触して、ワークを損傷させてしまうことがない。   In the numerical control device according to the first aspect of the present invention, the tool is operated based on the machining program in a state in which the distance between the tool and the workpiece is separated from the distance specified by the machining program by a predetermined offset amount. When performing the dry run operation, the offset amount can be automatically determined in accordance with the cutting instruction in the machining program. Therefore, the calculation error of the offset amount, the input error of the offset amount, and the forgetting to input the offset amount, which may occur when the operator inputs the offset amount, do not occur. Therefore, the tool and the work do not come into contact with each other due to human error, and the work is not damaged.

また、請求項2に係る発明の数値制御装置では、請求項1に記載の発明の効果に加えて、オフセット量決定手段は、切削指示のうち移動開始位置と移動終了位置との差のうち、最も大きい差をオフセット量に決定することができる。よって、切削動作の中で最も大きい移動量がオフセット量とされるので、加工プログラムに対して一律でオフセット量を決定する場合で、安全な量のうち最も少ない量をオフセット量に設定することができる。よって、ワークと工具との距離は、安全な距離のうち最も少ない距離となる。したがって、操作者が加工プログラムの動作を確認する際に、ワークと工具を目視する場合に、工具がワークのどの位置を切削するのかが分かりやすい。   In addition, in the numerical control device according to the second aspect of the invention, in addition to the effect of the first aspect, the offset amount determining means includes the difference between the movement start position and the movement end position in the cutting instruction, The largest difference can be determined as the offset amount. Therefore, since the largest movement amount in the cutting operation is set as the offset amount, when the offset amount is uniformly determined for the machining program, the smallest amount among the safe amounts can be set as the offset amount. it can. Therefore, the distance between the workpiece and the tool is the smallest distance among the safe distances. Therefore, when the operator checks the operation of the machining program, when the workpiece and the tool are visually checked, it is easy to understand which position of the workpiece the tool cuts.

また、請求項3に係る発明の数値制御装置では、請求項1に記載の発明の効果に加えて、オフセット量決定手段は、切削指示の移動開始位置のうち工具とワークとが最も離れた方向の位置である最遠移動開始位置と、切削指示の移動終了位置のうち工具とワークとが最も近づいた位置である最近移動終了位置との差をオフセット量に決定することができる。よって、切削動作の中で最も工具とワークとが離れた位置と、最も工具とワークとが近づいた位置との差がオフセット量とされるので、余裕を持っているが大きな無駄はないオフセット量を設定することができる。   In addition, in the numerical control device according to the third aspect of the invention, in addition to the effect of the first aspect, the offset amount determining means is a direction in which the tool and the workpiece are farthest from each other in the movement start position of the cutting instruction. The difference between the farthest movement start position that is the position of the most recent movement and the most recent movement end position that is the position at which the tool and the workpiece are closest to each other among the movement end positions of the cutting instruction can be determined as the offset amount. Therefore, the difference between the position where the tool and the workpiece are farthest in the cutting operation and the position where the tool and the workpiece are closest is the offset amount. Can be set.

また、請求項4に係る発明の数値制御装置では、請求項1に記載の発明の効果に加えて、加工プログラムを実行する際に実行する指示が切削指示である場合に、実行する切削指示の次に実行される切削指示を加工プログラムから探索することができ、オフセット量決定手段は、探索された切削指示の移動開始位置と移動終了位置との差をオフセット量に決定することができる。よって、加工プログラムを実行する最中にオフセット量が決定されるので、加工プログラム全体を解析してオフセット量を決定するよりも時間のロスが少なくてすむ。   In the numerical control device according to the fourth aspect of the present invention, in addition to the effect of the first aspect of the invention, when the instruction to be executed when executing the machining program is a cutting instruction, the cutting instruction to be executed is executed. The cutting instruction to be executed next can be searched from the machining program, and the offset amount determination means can determine the difference between the movement start position and the movement end position of the searched cutting instruction as the offset amount. Therefore, since the offset amount is determined during execution of the machining program, the time loss can be reduced compared with the case where the offset amount is determined by analyzing the entire machining program.

また、請求項5に係る発明の数値制御プログラムでは、コンピュータに実行させることにより、請求項1乃至4のいずれかと同様の効果を奏することができる。   The numerical control program of the invention according to claim 5 can achieve the same effect as any one of claims 1 to 4 by being executed by a computer.

また、請求項6に係る発明のコンピュータ読み取り可能な記憶媒体では、記憶されている数値制御プログラムをコンピュータに実行させることにより、請求項5と同様の効果、すなわち、請求項1乃至4のいずれかと同様の効果を奏することができる。   Further, in the computer-readable storage medium of the invention according to claim 6, by causing the computer to execute the stored numerical control program, the same effect as that of claim 5, ie, any one of claims 1 to 4 is obtained. Similar effects can be achieved.

以下、本発明の第一の実施の形態乃至第三の実施の形態を図面を参照して説明する。第一の実施の形態乃至第三の実施の形態の数値制御装置1は、被加工物(ワーク)を工具を用いて加工する装置である。数値制御装置1はワークを固定し、工具を移動させ、作動させることによりワークを加工する。この工具の移動の指令はNCプログラム(図2参照)に記述されており、NCプログラムを1行ずつ解釈して、工具を移動、作動させる。数値制御装置1では、「ドライラン動作」でNCプログラムを実行させ、このNCプログラムが正しい動きをするかを確認する。つまり、「ドライラン動作」は、NCプログラムのテスト動作である。このドライラン動作では、実際にワークを加工するのではなく、工具とワークとの距離を離して動作させる。この工具とワークとを離す距離が「オフセット量」である。これにより、実際にワークを加工することなく、NCプログラムの指示による工具の動きを確認することができる。本発明の数値制御装置では、この「オフセット量」をNCプログラムに基づいて自動で設定する。   Hereinafter, a first embodiment to a third embodiment of the present invention will be described with reference to the drawings. The numerical control device 1 according to the first to third embodiments is a device that processes a workpiece (workpiece) using a tool. The numerical control device 1 fixes the workpiece, moves the tool, and processes the workpiece by operating it. The command for moving the tool is described in the NC program (see FIG. 2), and the tool is moved and operated by interpreting the NC program line by line. In the numerical controller 1, the NC program is executed by the “dry run operation”, and it is confirmed whether or not the NC program operates correctly. That is, the “dry run operation” is an NC program test operation. In this dry run operation, the work is not actually machined, but the tool is moved away from the work. The distance separating the tool and the workpiece is the “offset amount”. Thereby, the movement of the tool according to the instruction of the NC program can be confirmed without actually machining the workpiece. In the numerical control apparatus of the present invention, this “offset amount” is automatically set based on the NC program.

ここで、図1を参照して、数値制御装置1の電気的構成について説明する。図1は、数値制御装置1の電気的構成を示すブロック図である。この構成は、第一の実施の形態乃至第三の実施の形態の数値制御装置1に共通である。   Here, the electrical configuration of the numerical controller 1 will be described with reference to FIG. FIG. 1 is a block diagram showing an electrical configuration of the numerical controller 1. This configuration is common to the numerical controller 1 of the first to third embodiments.

図1に示すように、数値制御装置1には、数値制御装置1の制御を行うCPU10が設けられている。このCPU10は、数値制御装置1全体の制御の中心となるプロセッサであり、バス18を介して、ROM11,入力インターフェース12,出力インターフェース13,RAM14に接続されている。そして、ROM11には、数値制御装置1の制御を行う制御プログラムが記憶されており、CPU10はROM11から制御プログラムを読み出し、この制御プログラムがRAM14に記憶されたNCプログラムを読み出してワークの加工を実行する。RAM14には一時的な計算データ、表示データなども格納される。   As shown in FIG. 1, the numerical control device 1 is provided with a CPU 10 that controls the numerical control device 1. The CPU 10 is a processor that is the center of control of the entire numerical controller 1, and is connected to the ROM 11, the input interface 12, the output interface 13, and the RAM 14 via the bus 18. The ROM 11 stores a control program for controlling the numerical control device 1. The CPU 10 reads the control program from the ROM 11, and the control program reads the NC program stored in the RAM 14 to execute machining of the workpiece. To do. The RAM 14 also stores temporary calculation data, display data, and the like.

そして、入力インターフェース12には、キーボード15、ドライランスイッチ16、起動スイッチ17が接続されている。キーボード15は、数値制御装置1に種々の情報を入力することができる。ドライランスイッチ16は、「ドライラン動作」で数値制御装置1を動作させるか否かの指示が入力される。ドライランスイッチ16がONであれば、「ドライラン動作」で数値制御装置1を動作させ、OFFであれば、ドライラン動作でない
「通常動作」で動作させる。つまり、OFFであれば、NCプログラムどおりの工具とワークとの位置関係で動作する。起動スイッチ17は、NCプログラムの実行を指示するスイッチである。ONされると、NCプログラムが読み出され、1行ごとに指令が実行される。また、出力インターフェース13には、工具2(図3、図6、図8参照)をX軸方向へ移動させるためのX軸モータ31を駆動する駆動回路21、工具2をY軸方向へ移動させるためのY軸モータ32を駆動する駆動回路22、工具2をZ軸方向へ移動させるためのZ軸モータ33を駆動するための駆動回路23、工具2の主軸を回転させる主軸モータ34を駆動する駆動回路24、表示装置35の制御を行う制御回路25を接続している。
A keyboard 15, a dry run switch 16, and a start switch 17 are connected to the input interface 12. The keyboard 15 can input various information to the numerical controller 1. The dry run switch 16 receives an instruction as to whether or not to operate the numerical control apparatus 1 in the “dry run operation”. If the dry run switch 16 is ON, the numerical controller 1 is operated in “dry run operation”, and if it is OFF, it is operated in “normal operation” that is not dry run operation. That is, if it is OFF, it will operate according to the positional relationship between the tool and the workpiece according to the NC program. The start switch 17 is a switch for instructing execution of the NC program. When turned ON, the NC program is read and a command is executed for each line. The output interface 13 also has a drive circuit 21 for driving the X-axis motor 31 for moving the tool 2 (see FIGS. 3, 6, and 8) in the X-axis direction, and the tool 2 is moved in the Y-axis direction. A drive circuit 22 for driving the Y-axis motor 32 for driving, a drive circuit 23 for driving the Z-axis motor 33 for moving the tool 2 in the Z-axis direction, and a spindle motor 34 for rotating the spindle of the tool 2. A control circuit 25 for controlling the drive circuit 24 and the display device 35 is connected.

次に、図2を参照して、NCプログラムについて説明する。図2は、NCプログラムの模式図である。図2に示すように、NCプログラムは1行を1ブロックとして、工具2の動作が定義されている。そして、各行の先頭に「N」と数字で表されているブロック番号が記載されている。図2に示す例では、「N1」,「N2」,「N3」・・・,「N6」の6つのブロックが記載されている。そして、「N1」の「Z250」,「N3」の「Z200」、「N4」の「Z230」、「N5」の「Z198」は工具をZ軸のどの位置まで移動させるかを示す指令である。本実施の形態では、ワークから離れる方向に数値が大きくなるように座標系が設定されている。なお、図3に示す例では、図3における上下方向がZ軸方向となり、図3における下から上に向かって座標値が大きくなる。   Next, the NC program will be described with reference to FIG. FIG. 2 is a schematic diagram of the NC program. As shown in FIG. 2, the NC program defines the operation of the tool 2 with one line as one block. In addition, a block number represented by “N” and a number is written at the top of each line. In the example illustrated in FIG. 2, six blocks “N1”, “N2”, “N3”..., “N6” are described. “N1” “Z250”, “N3” “Z200”, “N4” “Z230”, “N5” “Z198” are commands indicating to which position on the Z-axis the tool should be moved. . In the present embodiment, the coordinate system is set so that the numerical value increases in the direction away from the workpiece. In the example shown in FIG. 3, the vertical direction in FIG. 3 is the Z-axis direction, and the coordinate value increases from the bottom to the top in FIG.

また、「N1」,「N4」の「G0」は工具2を移動させて位置を決める指令である。よって、「N4」の「G0Z230」は、工具2をZ軸の230まで移動させる指令で(移動指令)ある。また、「N3」,「N5」の「G1」は、工具2を動作させながら指定の方向へ移動させる指令(切削移動指令)である。そして、「G90」は、座標指示が絶対値指定方式であることを指定しており、「M8」は切削油を供給する指令であり、「M30」はプログラムの終了の指令である。   Further, “G0” of “N1” and “N4” is a command for determining the position by moving the tool 2. Therefore, “G0Z230” of “N4” is a command to move the tool 2 to the Z axis 230 (movement command). “G1” of “N3” and “N5” is a command (cutting movement command) for moving the tool 2 in a specified direction while operating. “G90” designates that the coordinate instruction is an absolute value designation method, “M8” is a command to supply cutting oil, and “M30” is a command to end the program.

なお、切削移動指令は「G1」だけでなく、例えば、「G2」,「G3」,「G102」,「G103」,「G202」,「G203」,「G12」,「G13」がある。「G2」は、時計回りで円を描きながら切削を行う円弧補間指令又はヘリカル補間指令である。「G3」は、反時計回りで円を描きながら切削を行う円弧補間指令又はヘリカル補間指令である。円弧補間指令とヘリカル補間指令との違いは、ヘリカル補間指令にはZ軸方向の移動を伴いながら切削をすることである。円弧補間指令ではZ軸方向の移動は伴わない。「G102」は、時計回りで、X軸及びZ軸方向の円弧で切削を行うXZ円弧補間指令である。「G103」は、反時計回りで、X軸及びZ軸方向の円弧で切削を行うXZ円弧補間指令である。「G202」は、時計回りで、Y軸及びZ軸方向の円弧で切削を行うYZ円弧補間指令である。「G203」は、反時計回りで、Y軸及びZ軸方向の円弧で切削を行うYZ円弧補間指令である。「G12」は、時計回りで円の切削を行う円切削指令である。「G13」は、反時計回りで円の切削を行う円切削指令である。オフセット量の決定の際に利用されるものは、Z軸方向への移動を伴うものである。したがって、これらの切削移動指令において、「G1」,「G2」,「G3」でZ軸方向への移動の指令があるもの、「G102」,「G103」,「G202」,「G203」である。   The cutting movement command is not limited to “G1”, but includes, for example, “G2”, “G3”, “G102”, “G103”, “G202”, “G203”, “G12”, and “G13”. “G2” is a circular interpolation command or a helical interpolation command for performing cutting while drawing a circle in a clockwise direction. “G3” is a circular interpolation command or a helical interpolation command for performing cutting while drawing a circle counterclockwise. The difference between the circular interpolation command and the helical interpolation command is that the helical interpolation command is cut while moving in the Z-axis direction. The circular interpolation command does not involve movement in the Z-axis direction. “G102” is an XZ circular interpolation command for cutting in a clockwise direction with circular arcs in the X-axis and Z-axis directions. “G103” is an XZ circular interpolation command for cutting in a counterclockwise direction with circular arcs in the X-axis and Z-axis directions. “G202” is a YZ circular interpolation command for cutting in a clockwise direction with circular arcs in the Y-axis and Z-axis directions. “G203” is a YZ circular interpolation command for cutting in a counterclockwise direction with circular arcs in the Y-axis and Z-axis directions. “G12” is a circle cutting command for cutting a circle clockwise. “G13” is a circle cutting command for cutting a circle counterclockwise. What is used in determining the offset amount involves movement in the Z-axis direction. Therefore, in these cutting movement commands, “G1”, “G2”, “G3” are commands for movement in the Z-axis direction, “G102”, “G103”, “G202”, “G203”. .

次に、図3を参照して、第一の実施の形態における「オフセット量」について説明する。図3は、オフセット量の決定方法の説明図である。図3に示す点線の矢印は、Z軸の移動指令(G0)による工具2の先端の移動軌跡を示しており、実線の矢印は、Z軸の切削移動指令(G1)による工具2の先端の移動軌跡を示している。図3に示す例では、3箇所で切削動作が行われている。左の切削移動の開始点がSS1、終了点がSE1であり、中央の切削移動の開始点がSS2、終了点がSE2であり、右の切削移動の開始点がSS3、終了点がSE3である。それぞれの移動量の大小関係は、中央の切削移動の移動量(SS2−SE2)<右の切削移動の移動量(SS3−SE3)<左の切削移動の移動量(SS1−SE1)である。第一の実施の形態では、ドライラン動作がONとされて、最初のNCプログラムの実行時に、全てのNCプログラムを解析し、Z軸の切削移動指令におけるZ軸方向の移動量(切削距離)のうち、最も長い距離を「オフセット量」とする。よって、図3に示す例では、左の切削移動の移動量「SS1−SE1」がオフセット量となる。   Next, the “offset amount” in the first embodiment will be described with reference to FIG. FIG. 3 is an explanatory diagram of a method for determining the offset amount. 3 indicates the movement trajectory of the tip of the tool 2 by the Z-axis movement command (G0), and the solid-line arrow indicates the tip of the tool 2 by the Z-axis cutting movement command (G1). The movement trajectory is shown. In the example shown in FIG. 3, the cutting operation is performed at three locations. The start point of the left cutting movement is SS1 and the end point is SE1, the start point of the center cutting movement is SS2, the end point is SE2, the start point of the right cutting movement is SS3, and the end point is SE3. . The magnitude relationship of the respective movement amounts is the movement amount of the central cutting movement (SS2-SE2) <the movement amount of the right cutting movement (SS3-SE3) <the movement amount of the left cutting movement (SS1-SE1). In the first embodiment, the dry run operation is turned on, and when the first NC program is executed, all NC programs are analyzed, and the amount of movement (cutting distance) in the Z-axis direction in the Z-axis cutting movement command is calculated. Of these, the longest distance is defined as an “offset amount”. Therefore, in the example illustrated in FIG. 3, the movement amount “SS1-SE1” of the left cutting movement is the offset amount.

次に、図4及び図5のフローチャートを参照して、第一の実施の形態における数値制御装置1の動作について説明する。図4は、メモリ運転モードのフローチャートであり、図5は、メモリ運転モードの中で行われるオフセット量自動設定処理のフローチャートである。メモリ運転モード処理は、数値制御装置1の電源が投入され、メモリ運転モードに設定されているとCPU10が実行する処理である。なお、メモリ運転モードとは、NCプログラムを読み込み、NCプログラムの指令にしたがって、工具2を動作させるモードである。また、メモリ運転モード以外では、手動運転モードがあり工具を手動の指示により動作させる。これらのモードの切替は図示外のモード切替スイッチにより行うことができる。   Next, the operation of the numerical controller 1 in the first embodiment will be described with reference to the flowcharts of FIGS. 4 and 5. FIG. 4 is a flowchart of the memory operation mode, and FIG. 5 is a flowchart of the offset amount automatic setting process performed in the memory operation mode. The memory operation mode process is a process executed by the CPU 10 when the numerical controller 1 is turned on and set to the memory operation mode. The memory operation mode is a mode in which the NC program is read and the tool 2 is operated in accordance with the NC program command. In addition to the memory operation mode, there is a manual operation mode in which the tool is operated by a manual instruction. These modes can be switched by a mode switch not shown.

メモリ運転モード処理では、まず、起動スイッチ17の操作が待機され、起動スイッチ17が操作されると、NCプログラムをRAM14から読み出し、1つ目のブロックを解釈対象のブロックとする(S1)。次いで、ドライランスイッチ16がONとされた後の最初の起動スイッチ17の操作であるか否かの判断を行う(S2)。この判断には、RAM14に設けられているドライラン起動フラグ記憶エリア(図示外)を用いる。このドライラン起動フラグは、ドライランスイッチ16がONとされると「1(ON)」が記憶される。そして、ドライランスイッチ16がOFFされるか、又は、ドライランスイッチ16がONである状態で起動スイッチ17が操作されると「0(OFF)」が記憶される。そこで、ドライラン起動フラグがONであれば、ドライランスイッチ16がONとされた後の最初の起動スイッチ17の操作であると判断される(S2:YES)。そして、オフセット量自動設定処理を行う(S3、図5参照)。このオフセット量自動設定処理では、NCプログラムに基づいてオフセット量が決定される。オフセット量自動設定処理については、図5を参照して後述する。なお、ドライラン起動フラグがOFFであり、ドライランスイッチ16がONとされた後の最初の起動スイッチ17の操作でないと判断された場合には(S2:NO)、既にオフセット量は決定されているので、そのままS4へ進む。   In the memory operation mode process, first, the operation of the start switch 17 is waited. When the start switch 17 is operated, the NC program is read from the RAM 14 and the first block is set as a block to be interpreted (S1). Next, it is determined whether or not the operation is the first start switch 17 after the dry run switch 16 is turned on (S2). For this determination, a dry run activation flag storage area (not shown) provided in the RAM 14 is used. As the dry run activation flag, “1 (ON)” is stored when the dry run switch 16 is turned on. Then, when the dry run switch 16 is turned off or when the start switch 17 is operated in a state where the dry run switch 16 is on, “0 (OFF)” is stored. Therefore, if the dry run start flag is ON, it is determined that the operation is the first start switch 17 after the dry run switch 16 is turned ON (S2: YES). Then, an offset amount automatic setting process is performed (S3, see FIG. 5). In the offset amount automatic setting process, the offset amount is determined based on the NC program. The offset amount automatic setting process will be described later with reference to FIG. If the dry run start flag is OFF and it is determined that the operation is not the first start switch 17 after the dry run switch 16 is turned ON (S2: NO), the offset amount has already been determined. The process proceeds directly to S4.

オフセット量自動設定処理によりオフセット量が決定されたら、解釈対象のブロックを解釈する(S4)。そのブロックにZ軸方向に移動する指令があるか否かの判断を行う(S5)。ここでは、解釈中のブロックにZ軸の移動指令又はZ軸の切削移動指令があれば、Z軸方向の移動があると判断する(S5:YES)。例えば、「G0Zzzz」、「G1Zzzz」,「G2Zzzz」,「G3Zzzz」,「G102Zzzz」,「G103Zzzz」,「G202Zzzz」,「G203Zzzz」であればZ軸方向の移動がある。なお、小文字のzは任意の数字であり、zzzはZ軸の移動先の座標を示している。Z軸方向に移動する指令であれば(S5:YES)、Z軸の移動先の座標zzzにオフセット量を加味する(S6)。具体的には、Z軸を動作させるZ軸モータ33を駆動する駆動回路23に対して出力する移動指令に移動先の座標zzz+オフセット量の値を載せる。そして、解釈対象のブロックの記述に基づいて各種駆動回路21〜24に指令を出力して、解釈対象のブロックの動作を実行する(S8)。そして、解釈対象のブロックを次の行に移し(S9)、S4へ戻る。なお、Z軸方向に移動する指令でなければ(S5:NO)、プログラム終了の指令であるか否かの判断を行う(S7)。プログラム終了指令でなければ(S7:NO)、解釈対象のブロックの動作を実行し(S8)、解釈対象のブロックを次の行に移し(S9)、S4へ戻り、プログラム終了指令まで繰り返しS4〜S9の処理を行う。プログラム終了の指令であれば(S7:YES)、S1へ戻り、起動スイッチ17の操作が待機される(S1)。   When the offset amount is determined by the offset amount automatic setting process, the block to be interpreted is interpreted (S4). It is determined whether or not the block has a command to move in the Z-axis direction (S5). Here, if there is a Z-axis movement command or a Z-axis cutting movement command in the block being interpreted, it is determined that there is a movement in the Z-axis direction (S5: YES). For example, if “G0Zzz”, “G1Zzz”, “G2Zzz”, “G3Zzz”, “G102Zzz”, “G103Zzz”, “G202Zzz”, “G203Zzz”, there is a movement in the Z-axis direction. Note that the lowercase letter z is an arbitrary number, and zzz indicates the coordinate of the movement destination of the Z axis. If the command is to move in the Z-axis direction (S5: YES), the offset amount is added to the coordinate zzz of the movement destination of the Z-axis (S6). Specifically, the coordinate zzz of the movement destination + the value of the offset amount is put on the movement command output to the drive circuit 23 that drives the Z-axis motor 33 that operates the Z-axis. Based on the description of the block to be interpreted, a command is output to the various drive circuits 21 to 24 to execute the operation of the block to be interpreted (S8). Then, the block to be interpreted is moved to the next line (S9), and the process returns to S4. If it is not a command to move in the Z-axis direction (S5: NO), it is determined whether or not it is a program end command (S7). If it is not a program end command (S7: NO), the operation of the block to be interpreted is executed (S8), the block to be interpreted is moved to the next line (S9), the process returns to S4, and the program end command is repeated S4 to The process of S9 is performed. If it is an instruction to end the program (S7: YES), the process returns to S1, and the operation of the start switch 17 is waited (S1).

以上のようにして、オフセット量が加味されてZ軸モータが駆動されるので、ワーク3と工具2との距離が、NCプログラムの指定する距離よりもオフセット量だけ離れた状態でNCプログラムが実行される。   As described above, since the Z-axis motor is driven with the offset amount taken into account, the NC program is executed with the distance between the workpiece 3 and the tool 2 separated from the distance specified by the NC program by the offset amount. Is done.

次に、図5を参照して、オフセット量自動設定処理について説明する。図5に示すように、オフセット量自動設定処理では、まず、変数Zmax,移動前位置を初期化し、NCプログラムの最初の行を解釈対象のブロックとする(S11)。移動前位置には、Z軸方向の移動範囲の最大値を記憶する。本第一の実施の形態では「600」とする。変数Zmaxの初期値は、工具2のZ軸方向の移動範囲の最小値以下の値であればよい。本第一の実施の形態では、工具2のZ軸方向の移動範囲の最小値を「0」とし、変数Zmaxの初期値も「0」とする。これらの変数はRAM14に記憶エリアが設けられている。そして、解釈対象のブロックを解釈する(S12)。そして、このブロックにZ軸方向に移動する指令があるか否かの判断を行う(S13)。ここでは、解釈対象のブロックにZ軸の移動指令又はZ軸の切削移動指令があれば、Z軸方向の移動があると判断する(S13:YES)。   Next, the offset amount automatic setting process will be described with reference to FIG. As shown in FIG. 5, in the offset amount automatic setting process, first, the variable Zmax and the position before movement are initialized, and the first line of the NC program is set as a block to be interpreted (S11). In the pre-movement position, the maximum value of the movement range in the Z-axis direction is stored. In the first embodiment, “600” is assumed. The initial value of the variable Zmax may be a value equal to or smaller than the minimum value of the movement range of the tool 2 in the Z-axis direction. In the first embodiment, the minimum value of the movement range of the tool 2 in the Z-axis direction is “0”, and the initial value of the variable Zmax is also “0”. These variables are provided with a storage area in the RAM 14. Then, the interpretation target block is interpreted (S12). Then, it is determined whether or not this block has a command to move in the Z-axis direction (S13). Here, if there is a Z-axis movement command or a Z-axis cutting movement command in the block to be interpreted, it is determined that there is a movement in the Z-axis direction (S13: YES).

Z軸方向の移動であれば(S13:YES)、さらにZ軸の切削移動指令であるか否かの判断を行う(S14)。例えば、「G1Zzzz」,「G2Zzzz」,「G3Zzzz」,「G102Zzzz」,「G103Zzzz」,「G202Zzzz」,「G203Zzzz」があれば、Z軸の切削移動指令であると判断され(S14:YES)、切削移動の移動量を算出し、変数Zmvに記憶する(S15)。変数Zmvは、「移動前位置−切削移動指令の移動先の座標zzz」で算出される。次いで、変数Zmvが変数Zmaxよりも高いか否かの判断を行う(S16)。つまり、切削移動の移動量Zmv>Zmaxであれば、変数Zmaxよりも長く移動していると判断し(S16:YES)、変数Zmaxに切削移動の移動量Zmvの値を記憶する(S17)。また、切削移動の移動量Zmv≦Zmaxであれば、変数Zmaxよりも長くないと判断し(S16:NO)、変数Zmaxを更新しない。次いで、移動先の座標zzzを移動前位置に記憶する(S19)。   If the movement is in the Z-axis direction (S13: YES), it is further determined whether or not it is a Z-axis cutting movement command (S14). For example, if there are “G1Zzz”, “G2Zzz”, “G3Zzz”, “G102Zzz”, “G103Zzz”, “G202Zzz”, “G203Zzz”, it is determined that the command is a Z axis cutting movement command (S14: YES). The amount of cutting movement is calculated and stored in the variable Zmv (S15). The variable Zmv is calculated by “position before movement−coordinate zzz of movement destination of cutting movement command”. Next, it is determined whether or not the variable Zmv is higher than the variable Zmax (S16). In other words, if the movement amount Zmv> Zmax of the cutting movement, it is determined that the movement is longer than the variable Zmax (S16: YES), and the value of the movement amount Zmv of the cutting movement is stored in the variable Zmax (S17). If the movement amount Zmv ≦ Zmax of the cutting movement is determined, it is determined that it is not longer than the variable Zmax (S16: NO), and the variable Zmax is not updated. Next, the coordinate zzz of the movement destination is stored in the pre-movement position (S19).

次いで、解釈対象のブロックを一つ進める(S21)。そして、S12へ戻り、解釈対象のブロックを解釈する(S12)。そして、このブロックでZ軸方向に移動するか否かの判断を行う(S13)。Z軸方向に移動する指令である場合には(S13:NO)、さらにZ軸の切削移動指令であるか否かの判断を行い(S14)、Z軸の切削移動指令でなければ(S14:NO)、移動先の座標zzzを移動前位置に記憶する(S19)。そして、解釈対象のブロックを次の行に移し(S21)、そのブロックを解釈する(S12)。このブロックにZ軸方向に移動する指令がない場合には(S13:NO)、プログラム終了の指令であるか否かの判断を行う(S20)。プログラム終了の指令であれば(S20:YES)、オフセット量に変数Zmaxの値を記憶して(S22)、メモリモード運転処理へ戻る。   Next, the block to be interpreted is advanced by one (S21). Then, the process returns to S12 to interpret the block to be interpreted (S12). Then, it is determined whether or not the block moves in the Z-axis direction (S13). If it is a command to move in the Z-axis direction (S13: NO), it is further determined whether or not it is a Z-axis cutting movement command (S14), and if it is not a Z-axis cutting movement command (S14: NO), the coordinates zzz of the movement destination are stored in the pre-movement position (S19). Then, the block to be interpreted is moved to the next line (S21), and the block is interpreted (S12). If there is no command to move in the Z-axis direction in this block (S13: NO), it is determined whether or not it is a program end command (S20). If it is a program end command (S20: YES), the value of the variable Zmax is stored in the offset amount (S22), and the process returns to the memory mode operation process.

図2に示したNCプログラムの例では、「N1」は「G0Z250」なので(13:YES、S14;NO)、移動前位置に「250」を記憶する(S19)。次いで、「N2」では、「M8」なのでZ軸の移動指令はなく(S13:NO)、プログラム終了指令でもないので(S20:NO)、変数の更新はない。次いで、「N3」では、「G1Z200」なので(S13:YES、S14:YES)、切削移動の移動量Zmvが変数Zmaxと比較される(S16)。この時点では、切削移動の移動量Zmv=移動前位置−切削移動指令の移動先の座標zzz=250−200=50>0=変数Zmaxなので(S16:YES)、変数Zmaxは「50」となる(S17)。そして、移動前位置を「200」とする(S19)。次いで、「N4」は「G0Z230」なので(S13:YES、S14;NO)、移動前位置に「230」を記憶する(S19)。次いで、「N5」では、「G1Z198」なので(S13:YES、S14:YES)、切削移動の移動量Zmvが変数Zmaxと比較される(S16)。この時点では、切削移動の移動量Zmv=移動前位置−切削移動指令の移動先の座標zzz=230−198=32<50=変数Zmaxなので(S16:NO)、変数Zmaxを更新しない。そして、移動前位置を「198」とする。「N6」は「M30」なので(S13:NO)、プログラム終了と判断され(S20:YES)、「オフセット量」に変数Zmax=「50」を記憶する(S22)。   In the example of the NC program shown in FIG. 2, since “N1” is “G0Z250” (13: YES, S14; NO), “250” is stored at the pre-movement position (S19). Next, in “N2”, since it is “M8”, there is no Z-axis movement command (S13: NO), and it is not a program end command (S20: NO), so no variable is updated. Next, since “N3” is “G1Z200” (S13: YES, S14: YES), the moving amount Zmv of the cutting movement is compared with the variable Zmax (S16). At this time, since the movement amount Zmv of the cutting movement = the position before the movement−the coordinates zzz = 250−200 = 50> 0 = the variable Zmax of the movement destination of the cutting movement command (S16: YES), the variable Zmax is “50”. (S17). Then, the pre-movement position is set to “200” (S19). Next, since “N4” is “G0Z230” (S13: YES, S14; NO), “230” is stored in the pre-movement position (S19). Next, since “N5” is “G1Z198” (S13: YES, S14: YES), the moving amount Zmv of the cutting movement is compared with the variable Zmax (S16). At this time, since the movement amount Zmv of the cutting movement = the position before the movement−the coordinates zzz = 230−198 = 32 <50 = the variable destination of the cutting movement command (S16: NO), the variable Zmax is not updated. The pre-movement position is “198”. Since “N6” is “M30” (S13: NO), it is determined that the program is finished (S20: YES), and the variable Zmax = “50” is stored in “Offset amount” (S22).

以上のようにして、ドライラン動作がONとされて、最初のNCプログラムの実行時に、オフセット量自動設定処理が行われ、全てのNCプログラムを解析し、Z軸の切削移動指令におけるZ軸方向の移動量(切削距離)のうち、最も長い距離を「オフセット量」とする。よって、NCプログラムに基づいて自動的にオフセット量が決定されるので、オフセット量を操作者が入力する場合に発生しうる、操作者によるオフセット量の計算誤り、オフセット量の入力誤り、オフセット量の入力忘れが発生しない。したがって、人為的ミスにより工具とワークとが接触して、ワークを損傷させてしまうことがない。また、切削動作の中で最も大きい移動量がオフセット量とされるので、加工プログラムに対して一律でオフセット量を決定する場合で、安全な量のうち最も少ない量をオフセット量に設定することができる。よって、ワークと工具との距離は、安全な距離のうち最も少ない距離となる。したがって、操作者が加工プログラムの動作を確認する際に、ワークと工具を目視する場合に、工具がワークのどの位置を切削するのかが分かりやすい。   As described above, the dry run operation is turned ON, and when the first NC program is executed, the offset amount automatic setting process is performed, all the NC programs are analyzed, and the Z axis direction in the Z axis cutting movement command is analyzed. Among movement amounts (cutting distances), the longest distance is defined as an “offset amount”. Therefore, since the offset amount is automatically determined based on the NC program, an offset amount calculation error by the operator, an offset amount input error, and an offset amount may occur when the operator inputs the offset amount. There is no forgetting to input. Therefore, the tool and the work do not come into contact with each other due to human error, and the work is not damaged. In addition, since the largest movement amount in the cutting operation is set as the offset amount, when the offset amount is uniformly determined for the machining program, the smallest amount among the safe amounts can be set as the offset amount. it can. Therefore, the distance between the workpiece and the tool is the smallest distance among the safe distances. Therefore, when the operator checks the operation of the machining program, when the workpiece and the tool are visually checked, it is easy to understand which position of the workpiece the tool cuts.

なお、第一の実施の形態において、図4に示すメモリ運転モード処理のS3、すなわち図5に示すオフセット量自動設定処理でオフセット量を決定する処理を行うCPU10が「オフセット量決定手段」に相当し、メモリ運転モード処理のS4〜S7の処理を繰り返し、S3のオフセット量自動設定処理で決定されたオフセット量を加味して数値制御装置1を動作させるCPU10が「ドライラン動作手段」に相当する。   In the first embodiment, S3 of the memory operation mode process shown in FIG. 4, that is, the CPU 10 that performs the process of determining the offset amount in the offset amount automatic setting process shown in FIG. 5 corresponds to the “offset amount determining means”. Then, the CPU 10 that repeats the processing of the memory operation mode processing S4 to S7 and operates the numerical controller 1 in consideration of the offset amount determined by the offset amount automatic setting processing of S3 corresponds to “dry run operation means”.

次に、図6を参照して、第二の実施の形態における「オフセット量」について説明する。図6は、オフセット量の決定方法の説明図である。図3と同様に図6に示す点線の矢印は、Z軸の移動指令による工具2の先端の移動軌跡を示しており、実線の矢印は、Z軸の切削移動指令による工具2の先端の移動軌跡を示している。図6に示す例では、3箇所で切削動作が行われている。左の切削移動の開始点がSS1、終了点がSE1であり、中央の切削移動の開始点がSS2、終了点がSE2であり、右の切削移動の開始点がSS3、終了点がSE3である。それぞれの開始点の大小関係は、SS2<SS1<SS3であり、終了点の大小関係は、SE2<SE1<SE3である。本実施の形態では、NCプログラム中の切削移動における開始点の最大値と、終了点の最小値との距離を「オフセット量」とする。図6に示す例では、右の切削移動の開始点SS3が開始点の最大値であり、中央の切削移動の終了点SE2が終了点の最小値である。この開始点SS3から終了点SE2までの距離が「オフセット量」とされる。   Next, the “offset amount” in the second embodiment will be described with reference to FIG. FIG. 6 is an explanatory diagram of a method for determining the offset amount. Similar to FIG. 3, the dotted arrow shown in FIG. 6 indicates the movement trajectory of the tip of the tool 2 by the Z-axis movement command, and the solid arrow indicates the movement of the tip of the tool 2 by the Z-axis cutting movement command. The trajectory is shown. In the example shown in FIG. 6, the cutting operation is performed at three locations. The start point of the left cutting movement is SS1 and the end point is SE1, the start point of the center cutting movement is SS2, the end point is SE2, the start point of the right cutting movement is SS3, and the end point is SE3. . The magnitude relationship between the start points is SS2 <SS1 <SS3, and the magnitude relationship between the end points is SE2 <SE1 <SE3. In the present embodiment, the distance between the maximum value of the start point and the minimum value of the end point in the cutting movement in the NC program is defined as an “offset amount”. In the example shown in FIG. 6, the start point SS3 of the right cutting movement is the maximum value of the start point, and the end point SE2 of the center cutting movement is the minimum value of the end point. The distance from the start point SS3 to the end point SE2 is set as an “offset amount”.

次に、図4及び図7のフローチャートを参照して、第二の実施の形態における数値制御装置1の動作について説明する。図7は、メモリ運転モードの中で行われるオフセット量自動設定処理のフローチャートである。第二の実施の形態におけるメモリ運転モード処理は、第一の実施の形態と同様に、ドライランスイッチ16がONとされた後の最初の起動スイッチ17の操作が行われると、オフセット量自動設定処理が行われ、オフセット量が自動設定される。   Next, the operation of the numerical controller 1 in the second embodiment will be described with reference to the flowcharts of FIGS. 4 and 7. FIG. 7 is a flowchart of the offset amount automatic setting process performed in the memory operation mode. In the memory operation mode process in the second embodiment, the offset amount automatic setting process is performed when the first start switch 17 is operated after the dry run switch 16 is turned on, as in the first embodiment. The offset amount is automatically set.

図7のフローチャートを参照して、オフセット量自動設定処理について説明する。図7に示すように、オフセット量自動設定処理では、まず、変数Zmax,変数Zmin,移動前位置を初期化し、NCプログラムの最初の行が解釈対象のブロックとされる(S31)。移動前位置には、Z軸方向の移動範囲の最大値を記憶する。本第二の実施の形態では「600」とする。変数Zminの初期値は、工具2のZ軸方向の移動範囲の最大値以上の値、変数Zmaxの初期値は、工具2のZ軸方向の移動範囲の最小値以下の値であればよい。本第二の実施の形態では、工具2のZ軸方向の移動範囲の最小値を「0」とし、最大値を「600」とし、変数Zmaxの初期値も「0」、変数Zminの初期値も「600」とする。これらの変数はRAM14に記憶エリアが設けられている。   The offset amount automatic setting process will be described with reference to the flowchart of FIG. As shown in FIG. 7, in the offset amount automatic setting process, first, the variable Zmax, the variable Zmin, and the position before movement are initialized, and the first line of the NC program is set as a block to be interpreted (S31). In the pre-movement position, the maximum value of the movement range in the Z-axis direction is stored. In the second embodiment, “600” is set. The initial value of the variable Zmin may be a value that is not less than the maximum value of the movement range of the tool 2 in the Z-axis direction, and the initial value of the variable Zmax may be a value that is not more than the minimum value of the movement range of the tool 2 in the Z-axis direction. In the second embodiment, the minimum value of the movement range of the tool 2 in the Z-axis direction is “0”, the maximum value is “600”, the initial value of the variable Zmax is also “0”, and the initial value of the variable Zmin Is also “600”. These variables are provided with a storage area in the RAM 14.

そして、解釈対象のブロックを解釈する(S32)。そして、このブロックにZ軸方向に移動する指令があるか否かの判断を行う(S33)。ここでは、解釈中のブロックにZ軸の移動指令又はZ軸の切削移動指令があれば、Z軸方向の移動があると判断する(S33:YES)。例えば、「G0Zzzz」、「G1Zzzz」,「G2Zzzz」,「G3Zzzz」,「G102Zzzz」,「G103Zzzz」,「G202Zzzz」,「G203Zzzz」であればZ軸方向の移動である。なお、小文字のzは任意の数字であり、zzzはZ軸の移動先の座標を示している。   Then, the interpretation target block is interpreted (S32). Then, it is determined whether or not this block has a command to move in the Z-axis direction (S33). Here, if there is a Z-axis movement command or a Z-axis cutting movement command in the block being interpreted, it is determined that there is a movement in the Z-axis direction (S33: YES). For example, if “G0Zzz”, “G1Zzz”, “G2Zzz”, “G3Zzz”, “G102Zzz”, “G103Zzz”, “G202Zzz”, “G203Zzz”, the movement is in the Z-axis direction. Note that the lowercase letter z is an arbitrary number, and zzz indicates the coordinate of the movement destination of the Z axis.

Z軸方向の移動であれば(S33:YES)、さらにZ軸の切削移動指令であるか否かの判断を行う(S34)。例えば、「G1Zzzz」,「G2Zzzz」,「G3Zzzz」,「G102Zzzz」,「G103Zzzz」,「G202Zzzz」,「G203Zzzz」があれば、Z軸の切削移動指令であると判断され(S34:YES)、移動前位置が変数Zmaxよりも高いか否かの判断を行う(S35)。つまり、移動前位置>Zmaxであれば、変数Zmaxよりも高いと判断し(S35:YES)、変数Zmaxに移動前位置の値を記憶する(S36)。また、移動前位置≦Zmaxであれば、変数Zmaxよりも高くないと判断し(S35:NO)、変数Zmaxを更新しない。次いで、移動完了位置が変数Zminよりも低いか否かの判断を行う(S37)。つまり、移動完了位置である解釈中のブロックの指定する移動先の座標zzz<変数Zminであれば、移動先の座標zzzを変数Zminに記憶する(S38)。また、移動先の座標zzz≧変数Zminであれば、変数Zminを更新しない。そして、S39へ進み、移動先の座標zzzを移動前位置に記憶する(S39)。   If the movement is in the Z-axis direction (S33: YES), it is further determined whether or not it is a Z-axis cutting movement command (S34). For example, if there are “G1Zzz”, “G2Zzz”, “G3Zzz”, “G102Zzz”, “G103Zzz”, “G202Zzz”, “G203Zzz”, it is determined that the command is a Z-axis cutting movement command (S34: YES). It is determined whether the pre-movement position is higher than the variable Zmax (S35). That is, if the pre-movement position> Zmax, it is determined that it is higher than the variable Zmax (S35: YES), and the value of the pre-movement position is stored in the variable Zmax (S36). If the pre-movement position ≦ Zmax, it is determined that the position is not higher than the variable Zmax (S35: NO), and the variable Zmax is not updated. Next, it is determined whether or not the movement completion position is lower than the variable Zmin (S37). That is, if the coordinate zzz of the movement destination designated by the block being interpreted as the movement completion position <the variable Zmin, the coordinate zzz of the movement destination is stored in the variable Zmin (S38). Further, if the coordinate zzz of the movement destination ≧ variable Zmin, the variable Zmin is not updated. Then, the process proceeds to S39, and the coordinate zzz of the movement destination is stored in the pre-movement position (S39).

次いで、解釈対象のブロックを一つ進める(S41)。そして、S32へ戻り、解釈対象のブロックを解釈する(S32)。そして、このブロックでZ軸方向に移動するか否かの判断を行う(S33)。Z軸方向に移動する指令である場合には(S33:NO)、さらにZ軸の切削移動指令であるか否かの判断を行い(S34)、Z軸の切削移動指令でなければ(S34:NO)、移動先の座標zzzを移動前位置に記憶する(S39)。そして、解釈対象のブロックを次の行に移し(S41)、そのブロックを解釈する(S32)。このブロックにZ軸方向に移動する指令がない場合には(S33:NO)、プログラム終了の指令であるか否かの判断を行う(S40)。プログラム終了の指令であれば(S40:YES)、オフセット量に「変数Zmax−変数Zmin」の値を記憶して(S42)、メモリモード運転処理へ戻る。   Next, one block to be interpreted is advanced (S41). Then, the process returns to S32 to interpret the block to be interpreted (S32). Then, it is determined whether or not the block moves in the Z-axis direction (S33). If it is a command to move in the Z-axis direction (S33: NO), it is further determined whether or not it is a Z-axis cutting movement command (S34), and if it is not a Z-axis cutting movement command (S34: NO), the coordinates zzz of the movement destination are stored in the pre-movement position (S39). Then, the block to be interpreted is moved to the next line (S41), and the block is interpreted (S32). If there is no command to move in the Z-axis direction in this block (S33: NO), it is determined whether or not it is a program end command (S40). If it is a program end command (S40: YES), the value of “variable Zmax−variable Zmin” is stored in the offset amount (S42), and the process returns to the memory mode operation process.

図2に示したNCプログラムの例では、「N1」は「G0Z250」なので(S33:YES、S34;NO)、移動前位置に「250」を記憶する(S39)。次いで、「N2」では、「M8」なのでZ軸の移動指令はなく(S33:NO)、プログラム終了指令でもないので(S40:NO)、変数の更新はない。次いで、「N3」では、「G1Z200」なので(S33:YES、S34:YES)、移動前位置が変数Zmaxと比較される(S35)。この時点では、移動前位置=250>変数Zmax=0なので(S35:YES)、変数Zmaxは「250」となる(S36)。そして、移動完了位置=200<600変数=Zminなので(S37:YES)、変数Zminは「200」となる(S38)。そして、移動前位置を「200」とする(S39)。次いで、「N4」は「G0Z230」なので(13:YES、S34;NO)、移動前位置に「230」を記憶する(S39)。次いで、「N5」では、「G1Z198」なので(S33:YES、S34:YES)、移動前位置が変数Zmaxと比較される(S35)。この時点では、移動前位置=230<250=変数Zmaxなので(S35:NO)、変数maxを更新しない。そして、移動完了位置=198<200=変数Zminなので(S37:YES)、変数Zminは「198」となる(S38)。そして、移動前位置を「198」とする。「N6」は「M30」なので(S33:NO)、プログラム終了と判断され(S40:YES)、「オフセット量」に変数Zmax−変数Zmin=250−198=「52」を記憶する(S42)。   In the example of the NC program shown in FIG. 2, since “N1” is “G0Z250” (S33: YES, S34; NO), “250” is stored at the pre-movement position (S39). Next, since “N2” is “M8”, there is no Z-axis movement command (S33: NO) and no program end command (S40: NO), and no variable is updated. Next, since “N3” is “G1Z200” (S33: YES, S34: YES), the pre-movement position is compared with the variable Zmax (S35). At this time, since the position before movement = 250> the variable Zmax = 0 (S35: YES), the variable Zmax is “250” (S36). Since the movement completion position = 200 <600 variable = Zmin (S37: YES), the variable Zmin is “200” (S38). The pre-movement position is set to “200” (S39). Next, since “N4” is “G0Z230” (13: YES, S34; NO), “230” is stored in the pre-movement position (S39). Next, since “N5” is “G1Z198” (S33: YES, S34: YES), the pre-movement position is compared with the variable Zmax (S35). At this time, since the position before movement = 230 <250 = variable Zmax (S35: NO), the variable max is not updated. Since the movement completion position = 198 <200 = variable Zmin (S37: YES), the variable Zmin is “198” (S38). The pre-movement position is “198”. Since “N6” is “M30” (S33: NO), it is determined that the program is finished (S40: YES), and variable Zmax−variable Zmin = 250−198 = “52” is stored in “offset amount” (S42).

以上のようにして、第二の実施の形態では、NCプログラム中の切削移動における開始点の最大値と、終了点の最小値との距離が「オフセット量」とされる。よって、NCプログラムに基づいて自動的にオフセット量が決定されるので、オフセット量を操作者が入力する場合に発生しうる、操作者によるオフセット量の計算誤り、オフセット量の入力誤り、オフセット量の入力忘れが発生しない。したがって、人為的ミスにより工具とワークとが接触して、ワークを損傷させてしまうことがない。また、切削動作の中で最も工具とワークとが離れた位置と、最も工具とワークとが近づいた位置との差がオフセット量とされるので、余裕を持っているが大きな無駄はないオフセット量を設定することができる。   As described above, in the second embodiment, the distance between the maximum value of the start point and the minimum value of the end point in the cutting movement in the NC program is set as the “offset amount”. Therefore, since the offset amount is automatically determined based on the NC program, an offset amount calculation error by the operator, an offset amount input error, and an offset amount may occur when the operator inputs the offset amount. There is no forgetting to input. Therefore, the tool and the work do not come into contact with each other due to human error, and the work is not damaged. In addition, the difference between the position where the tool and the workpiece are farthest in the cutting operation and the position where the tool and the workpiece are closest is the offset amount. Can be set.

なお、第二の実施の形態において、図4に示すメモリ運転モード処理のS3、すなわち図7に示すオフセット量自動設定処理でオフセット量を決定する処理を行うCPU10が「オフセット量決定手段」に相当し、メモリ運転モード処理のS4〜S7の処理を繰り返し、S3のオフセット量自動設定処理で決定されたオフセット量を加味して数値制御装置1を動作させるCPU10が「ドライラン動作手段」に相当する。   In the second embodiment, S3 of the memory operation mode process shown in FIG. 4, that is, the CPU 10 that performs the process of determining the offset amount in the offset amount automatic setting process shown in FIG. 7 corresponds to the “offset amount determining means”. Then, the CPU 10 that repeats the processing of the memory operation mode processing S4 to S7 and operates the numerical controller 1 in consideration of the offset amount determined by the offset amount automatic setting processing of S3 corresponds to “dry run operation means”.

次に、図8乃至図10を参照して、第三の実施の形態について説明する。図8は、オフセット量の決定方法の説明図である。図3と同様に、図8に示す点線の矢印は、Z軸の移動指令による工具2の先端の移動軌跡を示しており、実線の矢印は、Z軸の切削移動指令による工具2の先端の移動軌跡を示している。図8に示す例では、2箇所で移動、切削動作が行われている。左の移動の開始点がMS1、移動の終了点及び切削移動の開始点がSS1、終了点がSE2である。右の移動の開始点がMS2、移動の終了点及び右の切削移動の開始点がSS2、終了点がSE2である。第三の実施の形態では、Z軸の移動指令があれば、NCプログラムを先読みし、次のZ軸の切削移動指令におけるZ軸方向の移動量を「オフセット量」とする。   Next, a third embodiment will be described with reference to FIGS. FIG. 8 is an explanatory diagram of a method for determining the offset amount. Similarly to FIG. 3, the dotted arrow shown in FIG. 8 indicates the movement locus of the tip of the tool 2 by the Z-axis movement command, and the solid arrow indicates the tip of the tool 2 by the Z-axis cutting movement command. The movement trajectory is shown. In the example shown in FIG. 8, movement and cutting operations are performed at two locations. The start point of the left movement is MS1, the end point of the movement and the start point of the cutting movement are SS1, and the end point is SE2. The start point of the right movement is MS2, the end point of the movement and the start point of the right cutting movement are SS2, and the end point is SE2. In the third embodiment, if there is a Z-axis movement command, the NC program is prefetched, and the movement amount in the Z-axis direction in the next Z-axis cutting movement command is set as the “offset amount”.

図8に示す例では、左の開始点MS1から終了点SS1への移動では、次の切削移動として、開始点SS1から終了点SE1までの切削移動が先読みされ、先読みされた切削移動の移動量(開始点SS1から終了点SE1までの距離)が「オフセット量」とされる。そして、左の開始点SS1から終了点SE1までの切削移動では、自身の切削移動の移動量(開始点SS1から終了点SE1までの距離)が「オフセット量」とされる。また、右の開始点MS2から終了点SS2への移動では、次の切削移動として、開始点SS2から終了点SE2までの切削移動が先読みされ、先読みされた切削移動の移動量(開始点SS2から終了点SE2までの距離)が「オフセット量」とされる。そして、右の開始点SS2から終了点SE2までの切削移動では、自身の切削移動の移動量(開始点SS2から終了点SE2までの距離)が「オフセット量」とされる。   In the example shown in FIG. 8, in the movement from the left start point MS1 to the end point SS1, the cutting movement from the start point SS1 to the end point SE1 is prefetched as the next cutting movement, and the amount of movement of the prefetched cutting movement. (Distance from the start point SS1 to the end point SE1) is set as the “offset amount”. In the cutting movement from the left start point SS1 to the end point SE1, the movement amount of the own cutting movement (the distance from the start point SS1 to the end point SE1) is set as the “offset amount”. Further, in the movement from the right start point MS2 to the end point SS2, the cutting movement from the start point SS2 to the end point SE2 is prefetched as the next cutting movement, and the movement amount of the prefetched cutting movement (from the start point SS2). The distance to the end point SE2) is the “offset amount”. In the cutting movement from the right start point SS2 to the end point SE2, the movement amount of the cutting movement (the distance from the start point SS2 to the end point SE2) is set as the “offset amount”.

次に、図9及び図10のフローチャートを参照して、第三の実施の形態における数値制御装置1の動作について説明する。図9は、メモリ運転モードのフローチャートである。図10は、メモリ運転モードの中で行われるオフセット量自動設定処理のフローチャートである。   Next, the operation of the numerical control apparatus 1 in the third embodiment will be described with reference to the flowcharts of FIGS. 9 and 10. FIG. 9 is a flowchart of the memory operation mode. FIG. 10 is a flowchart of the offset amount automatic setting process performed in the memory operation mode.

図9に示すように、メモリ運転モード処理では、まず、起動スイッチ17の操作が待機され、起動スイッチ17が操作されると、NCプログラムをRAM14から読み出し、1つ目のブロックを解釈対象のブロックとする(S51)。次いで、解釈対象のブロックを解釈する(S52)。そのブロックにZ軸方向に移動する指令があるか否かの判断を行う(S53)。ここでは、解釈中のブロックにZ軸の移動指令又はZ軸の切削移動指令があれば、Z軸方向の移動があると判断する(S53:YES)。「G0Zzzz」、「G1Zzzz」,「G2Zzzz」,「G3Zzzz」,「G102Zzzz」,「G103Zzzz」,「G202Zzzz」,「G203Zzzz」であればZ軸方向の移動がある。なお、小文字のzは任意の数字であり、zzzはZ軸の移動先の座標を示している。Z軸方向に移動する指令であれば(S53:YES)、オフセット量自動設定処理を行う(S54、図10参照)。このオフセット量自動設定処理では、オフセット量が決定されるが、詳細については、図10を参照して後述する。Z軸の移動先の座標zzzにオフセット量を加味して(S55)、解釈対象のブロックの動作を実行する(S57)。そして、解釈対象のブロックを次の行に移し(S58)、S52へ戻る。なお、Z軸方向に移動する指令でなければ(S53:NO)、プログラム終了の指令であるか否かの判断を行う(S56)。プログラム終了指令でなければ(S56:NO)、解釈対象のブロックの動作を実行し(S57)、解釈対象のブロックを次の行に移し(S58)、S52へ戻り、プログラム終了指令まで繰り返しS52〜S58の処理を行う。プログラム終了の指令であれば(S56:YES)、S51へ戻り、起動スイッチ17の操作が待機される(S51)。   As shown in FIG. 9, in the memory operation mode process, first, the operation of the start switch 17 is waited. When the start switch 17 is operated, the NC program is read from the RAM 14 and the first block is the block to be interpreted. (S51). Next, the interpretation target block is interpreted (S52). It is determined whether or not the block has a command to move in the Z-axis direction (S53). Here, if there is a Z-axis movement command or a Z-axis cutting movement command in the block being interpreted, it is determined that there is movement in the Z-axis direction (S53: YES). If “G0Zzz”, “G1Zzz”, “G2Zzz”, “G3Zzz”, “G102Zzz”, “G103Zzz”, “G202Zzz”, “G203Zzz”, there is movement in the Z-axis direction. Note that the lowercase letter z is an arbitrary number, and zzz indicates the coordinate of the movement destination of the Z axis. If the command is to move in the Z-axis direction (S53: YES), an offset amount automatic setting process is performed (S54, see FIG. 10). In this offset amount automatic setting process, the offset amount is determined, and details will be described later with reference to FIG. An offset amount is added to the coordinate zzz of the movement destination of the Z axis (S55), and the operation of the block to be interpreted is executed (S57). Then, the block to be interpreted is moved to the next line (S58), and the process returns to S52. If it is not a command to move in the Z-axis direction (S53: NO), it is determined whether or not it is a program end command (S56). If it is not a program end command (S56: NO), the operation of the block to be interpreted is executed (S57), the block to be interpreted is moved to the next line (S58), the process returns to S52, and the steps S52 to S52 are repeated. The process of S58 is performed. If it is an instruction to end the program (S56: YES), the process returns to S51, and the operation of the start switch 17 is waited (S51).

以上のようにして、Z軸方向の移動指令がある度に、その移動指令による移動以降の切削移動の移動距離がオフセット量自動設定処理で決定される。   As described above, every time there is a movement command in the Z-axis direction, the movement distance of the cutting movement after the movement based on the movement command is determined by the offset amount automatic setting process.

次に、図10を参照して、オフセット量自動設定処理について説明する。図10に示すように、オフセット量自動設定処理では、まず、指令動作前位置に現在のZ軸座標の位置を記憶し、オフセット量自動設定処理での解釈対象のブロックを、メモリ運転モード処理での解釈対象のブロックとする(S61)。指令動作前位置及び、後述する指令動作後位置はRAM14に記憶エリアが設けられている。解釈中のブロックにZ軸の切削移動指令があるか否かの判断を行う(S62)。「G1Zzzz」,「G2Zzzz」,「G3Zzzz」,「G102Zzzz」,「G103Zzzz」,「G202Zzzz」,「G203Zzzz」がなければ、Z軸の切削移動指令はないと判断し(S62:YES)、Z軸方向に移動する指令があるか否かの判断を行う(S63)。ここでは、解釈中のブロックにZ軸の移動指令又はZ軸の切削移動指令があれば、Z軸方向の移動があると判断する(S63:YES)。   Next, the offset amount automatic setting process will be described with reference to FIG. As shown in FIG. 10, in the offset amount automatic setting process, first, the current Z-axis coordinate position is stored at the position before the command operation, and the block to be interpreted in the offset amount automatic setting process is stored in the memory operation mode process. (S61). A storage area is provided in the RAM 14 for the pre-command operation position and the post-command operation position described later. It is determined whether or not there is a Z-axis cutting movement command in the block being interpreted (S62). If “G1Zzz”, “G2Zzz”, “G3Zzz”, “G102Zzz”, “G103Zzz”, “G202Zzz”, and “G203Zzz” are not present, it is determined that there is no Z-axis cutting movement command (S62: YES). It is determined whether there is a command to move in the direction (S63). Here, if there is a Z-axis movement command or a Z-axis cutting movement command in the block being interpreted, it is determined that there is movement in the Z-axis direction (S63: YES).

Z軸方向の移動であれば(S63:YES)、指令動作前位置にZ軸の移動先の座標zzzを記憶する(S65)。次いで、オフセット量自動設定処理での解釈対象のブロックを一つ進め(S66)、解釈対象のブロックを解釈する(S67)。そして、S62へ戻り、解釈中のブロックにZ軸の切削移動指令があるか否かの判断を行う(S62)。Z軸方向に移動する指令である場合には(S62:YES)、指令動作後位置に移動先の座標zzzを移動前位置に記憶する(S68)。そして、「オフセット量」に「指令動作前位置−指令動作後位置」の値を記憶して(S70)、メモリモード運転処理へ戻る。   If the movement is in the Z-axis direction (S63: YES), the coordinate zzz of the movement destination of the Z-axis is stored at the pre-command operation position (S65). Next, the block to be interpreted in the offset amount automatic setting process is advanced by one (S66), and the block to be interpreted is interpreted (S67). Then, the process returns to S62, and it is determined whether or not there is a Z-axis cutting movement command in the block being interpreted (S62). If it is a command to move in the Z-axis direction (S62: YES), the coordinate zzz of the movement destination is stored in the pre-movement position in the post-command operation position (S68). Then, the value of “position before command operation−position after command operation” is stored in “offset amount” (S70), and the process returns to the memory mode operation process.

なお、オフセット量自動設定処理を実施するきっかけとなったブロック以後のブロックにZ軸の切削移動指令や、Z軸の移動指令がないままに(S62:NO、S63:NO、S64:NO、S66,S67の繰り返し)、プログラム終了指令がきた場合には(S64:NO)、指令動作後位置にZ軸の最下端の位置(本第三の実施の形態では「0」)を記憶し(S69)、S70へ進み、オフセット量に「指令動作前位置−指令動作後位置」の値を記憶して(S70)、メモリモード運転処理へ戻る。   It should be noted that the blocks following the block that triggered the automatic offset amount setting process have no Z-axis cutting movement command or Z-axis movement command (S62: NO, S63: NO, S64: NO, S66). When the program end command is received (S64: NO), the lowest position of the Z-axis (“0” in the third embodiment) is stored in the post-command operation position (S69). ), The process proceeds to S70, the value of “position before command operation−position after command operation” is stored in the offset amount (S70), and the process returns to the memory mode operation process.

図2に示したNCプログラムの例では、「N1」は「G0Z250」なので(S53:YES)、オフセット量自動設定処理を行う(S54)。そして、オフセット量自動設定処理では、指令動作前位置には、Z軸の現在位置である最上端位置「600」を記憶し、メモリ運転モード処理での解析対象のブロック「N1」を、オフセット量自動設定処理の解析対象のブロックとする(S61)。N1は切削移動でなく(S62:NO)、Z軸の移動指令であるので(S63:YES)、指令動作前位置に「250」を記憶する(S65)。次いで、Z軸の解釈対象のブロックは「N2」となり(S67、S67)、「N2」は「M8」なので、切削指令でもなく(S62:NO)、Z軸の移動指令はなく(S63:NO)、プログラム終了指令でもないので(S64:NO)、変数の更新はない。次いで、「N3」では、「G1Z200」で切削移動指令なので(S62:YES)、指令動作後位置に「200」を記憶する(S68)。そして、「オフセット量」に指令動作前位置−指令動作後位置=250−200=「50」を記憶する(S70)。そして、メモリ運転モード処理では、オフセット量「50」を「N1」の「G0Z250」の「250」に加味して(S55)、「300」の位置まで移動を実施する(S57)。   In the example of the NC program shown in FIG. 2, since “N1” is “G0Z250” (S53: YES), an offset amount automatic setting process is performed (S54). In the offset amount automatic setting process, the uppermost position “600” that is the current position of the Z-axis is stored in the position before the command operation, and the analysis target block “N1” in the memory operation mode process is stored in the offset amount. The block is the analysis target block of the automatic setting process (S61). Since N1 is not a cutting movement (S62: NO) and is a Z-axis movement command (S63: YES), “250” is stored in the pre-command operation position (S65). Next, the Z-axis interpretation target block is “N2” (S67, S67), and “N2” is “M8”, so there is no cutting command (S62: NO), and there is no Z-axis movement command (S63: NO). ) Since it is not a program end command (S64: NO), no variable is updated. Next, in “N3”, since “G1Z200” is a cutting movement command (S62: YES), “200” is stored in the post-command operation position (S68). Then, the pre-command operation position−the post-command operation position = 250−200 = “50” is stored in the “offset amount” (S70). In the memory operation mode process, the offset amount “50” is added to “250” of “G0Z250” of “N1” (S55), and the movement is performed to the position of “300” (S57).

そして、次のブロック「N2」を解釈対象のブロックとし(S58)、解釈する(S52)。「N2」は「M8」なので(S53:NO、S56:NO)、切削油を供給し(S57)、「N3」を釈対象のブロックとし(S58)、解釈する(S52)。「N3」は「G1Z200」なので、Z軸の移動のある指令であり(S53:YES)、オフセット量自動設定処理を行う(S54)。そして、オフセット量自動設定処理では、指令動作前位置には、Z軸の現在位置「250」を記憶し、メモリ運転モード処理での解析対象のブロック「N2」を、オフセット量自動設定処理の解析対象のブロックとする(S61)。N3は切削移動であるので(S62:YES)、指令動作後位置に「200」を記憶する(S68)。そして、「オフセット量」に指令動作前位置−指令動作後位置=250−200=「50」を記憶する(S70)。そして、メモリ運転モード処理では、オフセット量「50」を「N3」の「G1Z200」の「200」に加味して(S55)、「250」の位置まで切削を実施する(S57)。   Then, the next block “N2” is set as a block to be interpreted (S58) and interpreted (S52). Since “N2” is “M8” (S53: NO, S56: NO), cutting oil is supplied (S57), and “N3” is set as a block to be interpreted (S58) and interpreted (S52). Since “N3” is “G1Z200”, it is a command with Z-axis movement (S53: YES), and an offset amount automatic setting process is performed (S54). In the offset amount automatic setting process, the current position “250” of the Z-axis is stored as the pre-command operation position, and the analysis target block “N2” in the memory operation mode process is analyzed in the offset amount automatic setting process. It is set as a target block (S61). Since N3 is a cutting movement (S62: YES), “200” is stored in the post-command operation position (S68). Then, the pre-command operation position−the post-command operation position = 250−200 = “50” is stored in the “offset amount” (S70). In the memory operation mode process, the offset amount “50” is added to “200” of “G1Z200” of “N3” (S55), and cutting is performed to the position of “250” (S57).

そして、次のブロック「N4」を解釈対象のブロックとし(S58)、解釈する(S52)。「N4」は「G0Z230」なので、Z軸の移動のある指令であり(S53:YES)、オフセット量自動設定処理を行う(S54)。そして、オフセット量自動設定処理では、指令動作前位置には、Z軸の現在位置「200」を記憶し、メモリ運転モード処理での解析対象のブロック「N4」を、オフセット量自動設定処理の解析対象のブロックとする(S61)。N4は切削移動でなく(S62:NO)、Z軸の移動指令であるので(S63:YES)、指令動作前位置に「230」を記憶する(S65)。次いで、Z軸の解釈対象のブロックは「N5」となり(S66、S67)、「N5」は「G1Z198」で、切削移動であるので(S62:YES)、指令動作後位置に「198」を記憶する(S68)。そして、「オフセット量」に指令動作前位置−指令動作後位置=230−198=「32」を記憶する(S70)。そして、メモリ運転モード処理では、オフセット量「32」を「N4」の「G0Z230」の「230」に加味して(S55)、「262」の位置まで移動を実施する(S57)。   Then, the next block “N4” is set as a block to be interpreted (S58) and interpreted (S52). Since “N4” is “G0Z230”, it is a command with movement of the Z axis (S53: YES), and an offset amount automatic setting process is performed (S54). Then, in the offset amount automatic setting process, the current position “200” of the Z axis is stored in the pre-command operation position, and the analysis target block “N4” in the memory operation mode process is analyzed in the offset amount automatic setting process. It is set as a target block (S61). Since N4 is not a cutting movement (S62: NO) and is a Z-axis movement command (S63: YES), “230” is stored in the pre-command operation position (S65). Next, the Z-axis interpretation target block is “N5” (S66, S67), and “N5” is “G1Z198”, which is a cutting movement (S62: YES). (S68). Then, the pre-command operation position-the post-command operation position = 230-198 = “32” is stored in the “offset amount” (S70). In the memory operation mode process, the offset amount “32” is added to “230” of “G0Z230” of “N4” (S55), and the movement is performed to the position of “262” (S57).

そして、次のブロック「N5」を解釈対象のブロックとし(S58)、解釈する(S52)。「N5」は「G1Z198」なので、Z軸の移動のある指令であり(S53:YES)、オフセット量自動設定処理を行う(S54)。そして、オフセット量自動設定処理では、指令動作前位置には、Z軸の現在位置「230」を記し、メモリ運転モード処理での解析対象のブロック「N5」を、オフセット量自動設定処理の解析対象のブロックとする(S61)。解釈中のブロックは「N5」である。そして、N5は切削移動であるので(S62:YES)、指令動作後位置に「198」を記憶する(S68)。そして、「オフセット量」に指令動作前位置−指令動作後位置=230−198=「32」を記憶する(S70)。そして、メモリ運転モード処理では、オフセット量「32」を「N5」の「G1Z198」の「198」に加味して(S55)、「230」の位置まで切削を実施する(S57)。   Then, the next block “N5” is set as a block to be interpreted (S58) and interpreted (S52). Since “N5” is “G1Z198”, it is a command with Z-axis movement (S53: YES), and an offset amount automatic setting process is performed (S54). In the offset amount automatic setting process, the current position “230” of the Z-axis is written at the pre-command operation position, and the analysis target block “N5” in the memory operation mode process is the analysis target of the offset amount automatic setting process. (S61). The block being interpreted is “N5”. Since N5 is a cutting movement (S62: YES), “198” is stored in the post-command operation position (S68). Then, the pre-command operation position-the post-command operation position = 230-198 = “32” is stored in the “offset amount” (S70). In the memory operation mode process, the offset amount “32” is added to “198” of “G1Z198” of “N5” (S55), and cutting is performed to the position of “230” (S57).

そして、次のブロック「N6」を解釈対象のブロックとし(S58)、解釈する(S52)。「N6」は「M30」なので、プログラム終了指令である(S56:YES)。よって、S51へ戻り、起動スイッチ17の押下を待機する(S51)。   Then, the next block “N6” is set as a block to be interpreted (S58) and interpreted (S52). Since “N6” is “M30”, it is a program end command (S56: YES). Therefore, the process returns to S51 and waits for the start switch 17 to be pressed (S51).

以上のようにして、第三の実施の形態では、Z軸の移動指令があれば、NCプログラムを先読みし、次のZ軸の切削移動指令におけるZ軸方向の移動量を「オフセット量」とする。よって、NCプログラムに基づいて自動的にオフセット量が決定されるので、オフセット量を操作者が入力する場合に発生しうる、操作者によるオフセット量の計算誤り、オフセット量の入力誤り、オフセット量の入力忘れが発生しない。したがって、人為的ミスにより工具とワークとが接触して、ワークを損傷させてしまうことがない。また、加工プログラムを実行する最中にオフセット量が決定されるので、加工プログラム全体を解析してオフセット量を決定するよりも時間のロスが少ない。   As described above, in the third embodiment, if there is a Z-axis movement command, the NC program is prefetched, and the movement amount in the Z-axis direction in the next Z-axis cutting movement command is referred to as “offset amount”. To do. Therefore, since the offset amount is automatically determined based on the NC program, an offset amount calculation error by the operator, an offset amount input error, and an offset amount may occur when the operator inputs the offset amount. There is no forgetting to input. Therefore, the tool and the work do not come into contact with each other due to human error, and the work is not damaged. Further, since the offset amount is determined during execution of the machining program, time loss is less than when the entire machining program is analyzed to determine the offset amount.

なお、第三の実施の形態において、図9に示すメモリ運転モード処理のS54、すなわち図10に示すオフセット量自動設定処理でオフセット量を決定する処理を行うCPU10が「オフセット量決定手段」に相当し、メモリ運転モード処理のS52〜S58の処理を繰り返し、S3のオフセット量自動設定処理で決定されたオフセット量を加味して数値制御装置1を動作させるCPU10が「ドライラン動作手段」に相当する。   In the third embodiment, S54 of the memory operation mode process shown in FIG. 9, that is, the CPU 10 that performs the process of determining the offset amount in the offset amount automatic setting process shown in FIG. 10 corresponds to the “offset amount determining means”. Then, the CPU 10 that repeats the processing of the memory operation mode processing S52 to S58 and operates the numerical controller 1 in consideration of the offset amount determined in the offset amount automatic setting processing of S3 corresponds to “dry run operation means”.

なお、本発明の数値制御装置は、上述した実施の形態に限定されるものではなく、本発明の要旨を逸脱しない範囲内において種々変更を加え得ることは勿論である。上記第一の実施の形態〜第三の実施の形態では、ワーク3を固定して、工具2を移動させる数値制御装置1を例に挙げて説明したが、工具2とワーク3の両方を移動させる数値制御装置であってもよい。また、工具2がワーク3に対して近づく方向をZ軸としたが、工具2が近づく方向は、その他の軸であってもよい。   The numerical control device of the present invention is not limited to the above-described embodiment, and various changes can be made without departing from the scope of the present invention. In the first embodiment to the third embodiment, the numerical control device 1 that fixes the workpiece 3 and moves the tool 2 is described as an example. However, both the tool 2 and the workpiece 3 are moved. It may be a numerical control device. Moreover, although the direction in which the tool 2 approaches the workpiece 3 is the Z axis, the direction in which the tool 2 approaches may be another axis.

数値制御装置1の電気的構成を示すブロック図である。2 is a block diagram showing an electrical configuration of the numerical control device 1. FIG. NCプログラムの模式図である。It is a schematic diagram of NC program. オフセット量の決定方法の説明図である。It is explanatory drawing of the determination method of offset amount. メモリ運転モードのフローチャートである。It is a flowchart of a memory operation mode. メモリ運転モードの中で行われるオフセット量自動設定処理のフローチャートである。It is a flowchart of the offset amount automatic setting process performed in the memory operation mode. オフセット量の決定方法の説明図である。It is explanatory drawing of the determination method of offset amount. メモリ運転モードの中で行われるオフセット量自動設定処理のフローチャートである。It is a flowchart of the offset amount automatic setting process performed in the memory operation mode. オフセット量の決定方法の説明図である。It is explanatory drawing of the determination method of offset amount. メモリ運転モードのフローチャートである。It is a flowchart of a memory operation mode. メモリ運転モードの中で行われるオフセット量自動設定処理のフローチャートである。It is a flowchart of the offset amount automatic setting process performed in the memory operation mode.

符号の説明Explanation of symbols

1 数値制御装置
2 工具
3 ワーク
10 CPU
16 ドライランスイッチ
17 起動スイッチ
23 駆動回路
33 Z軸モータ
34 主軸モータ
1 Numerical Control Device 2 Tool 3 Workpiece 10 CPU
16 Dry run switch 17 Start switch 23 Drive circuit 33 Z-axis motor 34 Spindle motor

Claims (6)

主軸により保持された工具を動作させ、冶具に固定されたワークを加工する工作機械を加工プログラムに基づいて数値制御する数値制御装置であって、
前記工具と前記ワークとの距離を、前記加工プログラムの指定する距離よりも、所定量であるオフセット量だけ離した状態で前記加工プログラムに基づいて前記工具を動作させるドライラン動作を実施するドライラン動作手段と、
前記工具又は前記ワークを前記工具と前記ワークとが近づく方向に移動させると共に、前記工具を動作させて前記ワークを切削する切削動作を指示する前記加工プログラムの切削指示における移動開始位置及び移動終了位置に基づいて前記オフセット量を決定するオフセット量決定手段とを備えたことを特徴とする数値制御装置。
A numerical control device for operating a tool held by a spindle and numerically controlling a machine tool that processes a workpiece fixed to a jig based on a processing program,
Dry-run operation means for performing a dry-run operation for operating the tool based on the machining program in a state where the distance between the tool and the workpiece is separated from the distance specified by the machining program by a predetermined offset amount. When,
The movement start position and the movement end position in the cutting instruction of the machining program that moves the tool or the workpiece in a direction in which the tool and the workpiece approach each other and instructs the cutting operation to cut the workpiece by operating the tool. A numerical control device comprising offset amount determining means for determining the offset amount based on
前記オフセット量決定手段は、前記切削指示のうち前記移動開始位置と前記移動終了位置との差のうち、最も大きい差を前記オフセット量に決定することを特徴とする請求項1に記載の数値制御装置。   2. The numerical control according to claim 1, wherein the offset amount determination unit determines the largest difference among the differences between the movement start position and the movement end position among the cutting instructions as the offset amount. apparatus. 前記オフセット量決定手段は、前記切削指示の前記移動開始位置のうち前記工具と前記ワークとが最も離れた方向の位置である最遠移動開始位置と、前記切削指示の前記移動終了位置のうち前記工具と前記ワークとが最も近づいた位置である最近移動終了位置との差を前記オフセット量に決定することを特徴とする請求項1に記載の数値制御装置。   The offset amount determination means includes a farthest movement start position that is a position in a direction in which the tool and the workpiece are farthest among the movement start positions of the cutting instruction, and the movement end position of the cutting instruction. The numerical control apparatus according to claim 1, wherein the offset amount is determined as a difference between a position where the tool and the workpiece are closest to each other and a latest movement end position. 前記加工プログラムを実行する際に実行する指示が前記切削指示である場合に、実行する切削指示の次に実行される前記切削指示を前記加工プログラムから探索する次切削指示探索手段を備え、
前記オフセット量決定手段は、前記次切削指示探索手段により探索された切削指示の前記移動開始位置と前記移動終了位置との差をオフセット量に決定することを特徴とする請求項1に記載の数値制御装置。
When an instruction to be executed when executing the machining program is the cutting instruction, the machine program includes a next cutting instruction search means for searching the cutting program for the cutting instruction to be executed next to the cutting instruction to be executed,
2. The numerical value according to claim 1, wherein the offset amount determination unit determines a difference between the movement start position and the movement end position of the cutting instruction searched by the next cutting instruction search unit as an offset amount. Control device.
コンピュータを請求項1乃至4のいずれかに記載の数値制御装置の各種処理手段として動作させる数値制御プログラム。   A numerical control program for causing a computer to operate as various processing means of the numerical control device according to any one of claims 1 to 4. 請求項5に記載の数値制御プログラムを記憶したコンピュータ読み取り可能な記憶媒体。   A computer-readable storage medium storing the numerical control program according to claim 5.
JP2007242312A 2007-09-19 2007-09-19 Numerical control device, numerical control program, and storage medium storing numerical control program Active JP4867876B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2007242312A JP4867876B2 (en) 2007-09-19 2007-09-19 Numerical control device, numerical control program, and storage medium storing numerical control program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2007242312A JP4867876B2 (en) 2007-09-19 2007-09-19 Numerical control device, numerical control program, and storage medium storing numerical control program

Publications (2)

Publication Number Publication Date
JP2009075727A true JP2009075727A (en) 2009-04-09
JP4867876B2 JP4867876B2 (en) 2012-02-01

Family

ID=40610652

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2007242312A Active JP4867876B2 (en) 2007-09-19 2007-09-19 Numerical control device, numerical control program, and storage medium storing numerical control program

Country Status (1)

Country Link
JP (1) JP4867876B2 (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103111760A (en) * 2011-11-17 2013-05-22 深圳市大族激光科技股份有限公司 Z-axis idle stroke copying control method and system and laser cutting machine
JP2021039401A (en) * 2019-08-30 2021-03-11 ファナック株式会社 Numerical control device
CN112578729A (en) * 2019-09-30 2021-03-30 兄弟工业株式会社 Numerical controller and control method

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0863219A (en) * 1994-08-24 1996-03-08 Okuma Mach Works Ltd Numerical controller with fast program check function
JP2002103219A (en) * 2000-09-28 2002-04-09 Toyoda Mach Works Ltd Grinding device
JP2005319531A (en) * 2004-05-07 2005-11-17 Toru Nishikazu Numerical control machine tool and method for checking machining program

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0863219A (en) * 1994-08-24 1996-03-08 Okuma Mach Works Ltd Numerical controller with fast program check function
JP2002103219A (en) * 2000-09-28 2002-04-09 Toyoda Mach Works Ltd Grinding device
JP2005319531A (en) * 2004-05-07 2005-11-17 Toru Nishikazu Numerical control machine tool and method for checking machining program

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103111760A (en) * 2011-11-17 2013-05-22 深圳市大族激光科技股份有限公司 Z-axis idle stroke copying control method and system and laser cutting machine
JP2021039401A (en) * 2019-08-30 2021-03-11 ファナック株式会社 Numerical control device
CN112578729A (en) * 2019-09-30 2021-03-30 兄弟工业株式会社 Numerical controller and control method
JP2021056770A (en) * 2019-09-30 2021-04-08 ブラザー工業株式会社 Numerical control device and control method
JP7331596B2 (en) 2019-09-30 2023-08-23 ブラザー工業株式会社 Numerical controller and control method
CN112578729B (en) * 2019-09-30 2024-06-21 兄弟工业株式会社 Numerical control device and control method

Also Published As

Publication number Publication date
JP4867876B2 (en) 2012-02-01

Similar Documents

Publication Publication Date Title
JP4406034B2 (en) Numerical control device for controlling a 5-axis machine
JP4374045B2 (en) Numerical control device with program restart function
JP5543534B2 (en) Numerical control device with program restart function
US7058473B2 (en) Method and device for generation of machining program
US20130006394A1 (en) Numerical control device and numerical control method
TWI515077B (en) Machine tool system control having automatic safe repositioning
JP4867876B2 (en) Numerical control device, numerical control program, and storage medium storing numerical control program
JP4216808B2 (en) Numerical controller
JP5339815B2 (en) Numerical control device with processing resumption function
US10162335B2 (en) Numerical controller capable of neighboring point search with consideration for tool attitude
US20160209824A1 (en) Numerical controller controlling machining tool based on skiving instruction
JP2008071015A (en) Numerical controller
JP2008046913A (en) Numerical control device of machine tools
JP6408040B2 (en) Numerical controller
JP2020003958A (en) Numerical control device
JP4112433B2 (en) Numerical control device for machine tool and numerical control method for machine tool
JP2009080621A (en) Numerical control device, numerical control program and storage medium which stores numerical control program,
CN109843504B (en) Numerical control device
JP7401665B2 (en) Numerical control device and control method
JP2009110223A (en) Numerical control device, numerical control program, and storage medium storing numerical control program
JP2006072909A (en) Numeric controller
US20240126241A1 (en) Numerical controller
JPH0724645A (en) Wire electric discharge machining device
WO2023058085A1 (en) Numerical control device
WO2022239106A1 (en) Numerical controller and storage medium

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20100902

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20110412

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20110419

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20110616

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20111018

A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20111031

R150 Certificate of patent or registration of utility model

Ref document number: 4867876

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

Free format text: JAPANESE INTERMEDIATE CODE: R150

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20141125

Year of fee payment: 3