Roundness compensation file generation method and system for CNC

文档序号:1905159 发布日期:2021-11-30 浏览:5次 中文

阅读说明:本技术 一种用于cnc的圆度补偿文件生成方法及系统 (Roundness compensation file generation method and system for CNC ) 是由 张陈伟 林观生 黄云飞 于 2021-08-30 设计创作,主要内容包括:本发明提供了一种用于CNC的圆度补偿文件生成方法,包括执行以下步骤:步骤1:用户选择需要补偿的圆度测量源文件;步骤2:读取步骤1所选择的圆度测量源文件;步骤3:通过Pandas数据分析模块,以设定的索引对数据进行循环查找,直至找到补偿数据起始和终止位置;步骤4:抓取检索的数据,同时生成补偿文件并将抓取的数据写入,存储在源文件路径,并在界面反馈结果;步骤5:判断是否完成所有文件转换,如果所有文件完成转换后返回结果,否则返回步骤2。本发明的有益效果是:快速便捷,减少了不必要的时间浪费,每完成一次数据补偿的时间由之前的10min缩短至1分钟以内,节约时间,降低人力消耗。(The invention provides a roundness compensation file generation method for CNC, which comprises the following steps: step 1: a user selects a roundness measurement source file needing to be compensated; step 2: reading the roundness measurement source file selected in the step 1; and step 3: circularly searching data by a Pandas data analysis module according to a set index until the initial and final positions of the compensation data are found; and 4, step 4: capturing retrieved data, generating a compensation file at the same time, writing the captured data into the compensation file, storing the compensation file in a source file path, and feeding back a result on an interface; and 5: and (5) judging whether all the files are converted or not, if all the files are converted, returning the result, and if not, returning to the step (2). The invention has the beneficial effects that: the method is rapid and convenient, unnecessary time waste is reduced, the time for completing data compensation once is shortened to be within 1 minute from the previous 10min, time is saved, and labor consumption is reduced.)

1. A roundness compensation file generation method for CNC, comprising performing the steps of:

step 1: a user selects a roundness measurement source file needing to be compensated;

step 2: reading the roundness measurement source file selected in the step 1;

and step 3: circularly searching data by a Pandas data analysis module according to a set index until the initial and final positions of the compensation data are found;

and 4, step 4: capturing retrieved data, generating a compensation file at the same time, writing the captured data into the compensation file, storing the compensation file in a source file path, and feeding back a result on an interface;

and 5: and (5) judging whether all the files are converted or not, if all the files are converted, returning the result, and if not, returning to the step (2).

2. The roundness compensation file generating method according to claim 1, wherein: in step 1, to prevent wrong selection, only file selection of a specific format is supported.

3. The roundness compensation file generating method according to claim 1, wherein: in the step 2, after the selection is finished, a 'conversion' button is clicked, and the main program reads and writes the Excel file by using xlrd and xlwt modules.

4. The roundness compensation file generating method according to claim 1, further comprising, in the step 3, the steps of:

and (3) judging compensation data: and judging whether the compensation data is found, if so, executing the next step, otherwise, returning to report errors and skipping to the next file to read the roundness measurement source file.

5. The roundness compensation file generating method according to claim 1, wherein: the roundness compensation file generation method further comprises the steps of building a PyQT5 environment and applying PyQT5 to visually develop a module design software interface.

6. A roundness compensation file generation system for CNC, comprising:

a selection module: the roundness measurement source file is used for selecting roundness measurement source files needing compensation by a user;

a reading module: the roundness measurement source file is used for reading the roundness measurement source file selected by the selection module;

a data retrieval module: the system comprises a Pandas data analysis module, a data storage module, a data processing module and a data processing module, wherein the Pandas data analysis module is used for circularly searching data by a set index until the initial and end positions of compensation data are found;

a fetch/write module: the system comprises a data storage unit, a data retrieval unit, a data storage unit and a data processing unit, wherein the data storage unit is used for storing retrieved data, generating a compensation file, writing the retrieved data into the compensation file, storing the data in a source file path and feeding back a result on an interface;

a file conversion judging module: and the reading module is used for judging whether all the files are converted or not, if all the files are converted, the result is returned, and if not, the result is returned to the reading module.

7. The roundness compensation file generating system according to claim 6, wherein: in the selection module, only file selection of a specific format is supported in order to prevent wrong selection.

8. The roundness compensation file generating system according to claim 6, wherein: and clicking a 'conversion' button after the selection is finished in the reading module, and reading and writing the Excel file by the main program by using xlrd and xlwt modules.

9. The roundness compensation file generating system of claim 6, further comprising, in the data retrieval module:

the compensation data judgment module: and the data acquisition module is used for judging whether compensation data is found, if so, entering the capture/write-in module, and otherwise, returning an error report and skipping to the next file to read the roundness measurement source file.

10. The roundness compensation file generating system of claim 6 further comprising a PyQT5 visual development module, the development module design software interface being visualized by PyQT 5.

Technical Field

The invention relates to the technical field of information, in particular to a roundness compensation file generation method and system for CNC.

Background

When CNC processes axle type part, need use taylor roundness appearance to measure its processing part's circularity, CNC compensates the circularity with the measuring result. In a traditional compensation method, compensation data are manually captured in a report (MDR format) generated by a roundness meter, and are uploaded to a CNC (computer numerical control) for compensation after being modified into a specific file format by using EXCEL office software. For a method for manually capturing data, the problems of high labor cost, low efficiency, error risk compensation and the like exist, and the method is as follows:

1) high labor cost: manually capturing data wastes time and labor, reports need to be manually found, compensation data is copied and pasted into a text file with a specific format, and the average time for capturing data once and generating the compensation file is about 10 minutes;

2) the efficiency is low: the manual process can only grab a set of data once, and cannot be processed in batches, so that the efficiency is low. (ii) a

3) Compensating for error risks: the process of manually capturing data has certain risk, 3600 pieces of position compensation data are shared in the interval from 0 degrees to 359.9 degrees, missing one piece of position compensation data can cause data dislocation, compensation failure is caused, error compensation can be caused in serious conditions, and the risk of batch accidents is increased.

Disclosure of Invention

The invention provides a roundness compensation file generation method for CNC, which comprises the following steps:

step 1: the user selects the roundness measurement source file that needs compensation.

Step 2: and reading the roundness measurement source file selected in the step 1.

And step 3: and circularly searching the data by a Pandas data analysis module according to the set index until the initial and final positions of the compensation data are found.

And 4, step 4: and capturing the retrieved data, generating a compensation file, writing the captured data into the compensation file, storing the compensation file in a source file path, and feeding back a result on an interface.

And 5: and (5) judging whether all the files are converted or not, if all the files are converted, returning the result, and if not, returning to the step (2).

As a further improvement of the present invention, in step 1, to prevent wrong selection, only file selection of a specific format is supported.

As a further improvement of the invention, in the step 2, after the selection is completed, a 'conversion' button is clicked, and the Excel file is read and written by the main program by using xlrd and xlwt modules.

As a further improvement of the present invention, in the step 3, the method further comprises the following steps:

and (3) judging compensation data: and judging whether the compensation data is found, if so, executing the next step, otherwise, returning to report errors and skipping to the next file to read the roundness measurement source file.

As a further improvement of the invention, the roundness compensation file generation method further comprises the steps of building a PyQT5 environment and utilizing PyQT5 to visually develop a module design software interface.

The invention also discloses a roundness compensation file generation system for CNC, which comprises:

a selection module: for the user to select the roundness measurement source file that needs compensation.

A reading module: for reading the roundness measurement source file selected by the selection module.

A data retrieval module: and the system is used for circularly searching the data by the Pandas data analysis module according to the set index until the initial and end positions of the compensation data are found.

A fetch/write module: the system is used for grabbing the retrieved data, generating a compensation file at the same time, writing the grabbed data into the compensation file, storing the data in a source file path, and feeding back a result on an interface.

A file conversion judging module: and the reading module is used for judging whether all the files are converted or not, if all the files are converted, the result is returned, and if not, the result is returned to the reading module.

As a further improvement of the invention, in the selection module, only file selection of a specific format is supported in order to prevent wrong selection.

As a further improvement of the invention, in the reading module, after the selection is completed, a 'conversion' button is clicked, and the Excel file is read and written by the main program by using xlrd and xlwt modules.

As a further improvement of the present invention, in the data retrieval module, the data retrieval module further includes:

the compensation data judgment module: and the data acquisition module is used for judging whether compensation data is found, if so, entering the capture/write-in module, and otherwise, returning an error report and skipping to the next file to read the roundness measurement source file.

As a further improvement of the invention, the roundness compensation file generation system also comprises a PyQT5 visual development module, and a software interface is designed through the PyQT5 visual development module.

The invention has the beneficial effects that: 1. the method is rapid and convenient, unnecessary time waste is reduced, the time for completing data compensation once is shortened to be within 1 minute from the previous 10min, the time is saved, and the labor consumption is reduced; 2. the batch processing is supported, compared with manual grabbing, the tool can be used for simultaneously converting and generating a plurality of compensation files, and the compensation working efficiency is greatly improved; 3. the data processing is automatic, the error risk caused by human factors is eliminated, and the accuracy and the reliability of compensation can be greatly improved.

Drawings

FIG. 1 is a flowchart of the operation of roundness compensation file generation of the present invention.

Detailed Description

As shown in fig. 1, the present invention discloses a roundness compensation file generating method for CNC, including the following steps:

step 1: and the user selects the roundness measurement source file needing to be compensated, and only supports file selection of a specific format to prevent wrong selection.

Step 2: reading the roundness measurement source file selected in the step 1; the method comprises the following specific steps:

and clicking a 'conversion' button after the selection is finished, and reading and writing the Excel file by the main program by using xlrd and xlwt modules.

And step 3: and circularly searching the data by a Pandas data analysis module according to the set index until the initial and final positions of the compensation data are found.

In the step 3, the method further comprises the following steps:

and (3) judging compensation data: and judging whether the compensation data is found, if so, executing the next step, otherwise, returning to report errors and skipping to the next file to read the roundness measurement source file.

And 4, step 4: and capturing the retrieved data, generating a compensation file, writing the captured data into the compensation file, storing the compensation file in a source file path, and feeding back a result on an interface.

And 5: if a plurality of files are processed in batch, the program is executed circularly, and the result is returned after all the files are converted. The method comprises the following specific steps:

and (5) judging whether all the files are converted or not, if all the files are converted, returning the result, and if not, returning to the step (2).

The user can directly import the generated compensation file into the CNC for adjustment and compensation after checking.

The xlrd and xlwt are two modules mainly used by Python operation Excel, and the functions of the two modules are respectively reading and writing Excel files.

The Pandas is a combined abbreviation of python + data + analysis, is mainly used for data processing and analysis, and supports a complete set of flow operations including data reading and writing, numerical calculation, data processing, data analysis and data visualization.

The PyQT is a visual development toolkit in Python, can run in all mainstream operating systems, and is powerful and system-stable.

The invention also discloses a roundness compensation file generation system for CNC, which comprises:

a selection module: for the user to select the roundness measurement source file that needs compensation.

A reading module: for reading the roundness measurement source file selected by the selection module.

A data retrieval module: and the system is used for circularly searching the data by the Pandas data analysis module according to the set index until the initial and end positions of the compensation data are found.

A fetch/write module: the system is used for grabbing the retrieved data, generating a compensation file at the same time, writing the grabbed data into the compensation file, storing the data in a source file path, and feeding back a result on an interface.

A file conversion judging module: and the reading module is used for judging whether all the files are converted or not, if all the files are converted, the result is returned, and if not, the result is returned to the reading module.

In the selection module, only file selection of a specific format is supported in order to prevent wrong selection.

And clicking a 'conversion' button after the selection is finished in the reading module, and reading and writing the Excel file by the main program by using xlrd and xlwt modules.

In the data retrieval module, further comprising:

the compensation data judgment module: and the data acquisition module is used for judging whether compensation data is found, if so, entering the capture/write-in module, and otherwise, returning an error report and skipping to the next file to read the roundness measurement source file.

The roundness compensation file generation system further comprises a PyQT5 visual development module, a software interface is designed through the PyQT5 visual development module, and an operation interface is in butt joint with the roundness compensation file generation system. The roundness compensation file generation system has the functions of reading file data, searching indexes, creating compensation files, writing data, judging and feeding back results and the like.

After the roundness measuring instrument of the roundness compensation file generation system finishes measurement, a roundness measurement result report (table file) is generated, and the roundness measurement result report not only contains shape and position information of each angle, but also contains other contents and parameters. The software needs to recognize and extract the data needed by CNC and output the data in a specific document format.

The innovation points of the invention are as follows:

1) compiling based on a Python3.8 platform, reading and writing Excel files through library commands and functions such as xlrd and xlwt, and realizing the functions of table data retrieval and key data extraction by combining with a Pandas data analysis module.

2) A PyQT5 visual development platform is applied, a simplified software function interface is built, and the operation is convenient.

3) Automatically recognizing data: and (3) creating an index by using the key parameters, circularly scanning and reading the table data, finding out all compensation data and capturing, wherein the error occurrence rate is almost zero compared with manual selection.

4) Multi-file conversion support: the software supports simultaneous conversion of a plurality of files, and the effect of batch processing is achieved.

The invention has the beneficial effects that: 1. the method is rapid and convenient, unnecessary time waste is reduced, the time for completing data compensation once is shortened to be within 1 minute from the previous 10min, the time is saved, and the labor consumption is reduced; 2. the batch processing is supported, compared with manual grabbing, the tool can be used for simultaneously converting and generating a plurality of compensation files, and the compensation working efficiency is greatly improved; 3. the data processing is automatic, the error risk caused by human factors is eliminated, and the accuracy and the reliability of compensation can be greatly improved.

The present invention is described in further detail in connection with specific preferred embodiments, and the practice of the invention should not be construed as limited to those descriptions. For those skilled in the art to which the invention pertains, several simple deductions or substitutions can be made without departing from the spirit of the invention, and all shall be considered as belonging to the protection scope of the invention.

7页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:文本摘要与关键词抽取方法、装置、设备及介质

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!