1. Technical Field
Embodiments of the present disclosure relate to measurement technology, and more particularly to a computing device and method for automatically generating a measurement program of a product.
2. Description of Related Art
Measurements of manufactured products using a measuring software, such as image measuring software, can be helpful to determine if the manufactured products meet design specifications, to provide product information for improvements in the process of the product quality control.
For providing more product information, a plurality of compatible manufactured parts need to be measured. Thus, repeated operations must be performed manually. Therefore, a measuring program is needed for redundant manual operations.
In order to compile the measuring program, a measuring process of measuring one of the plurality of manufactured products needs to be recorded, and a designer needs to compile the measuring program according to the measuring process. However, the process of manually compiling the measuring program is complex and inefficient”.
It should be understood that
The program generation system 21 may include computerized instructions in the form of function modules that are executed by the processing unit 3 and stored in the storage unit 4. The processor unit 3 may include a processor, a microprocessor, an application-specific integrated circuit (ASIC), and a field programmable gate array (FPGA), for example. Some non-limiting examples of the storage unit 4 include CDs, DVDs, BLU-RAY, flash memory, hard disk drives, and other suitable non-transitory computer-readable medium. A detailed description of the program generation system 21 will be given in the following paragraphs.
In general, the word “function module” as used herein, refers to logic embodied in hardware or firmware, or to a collection of software instructions, written in a programming language, such as, Java, C, or assembly.
The function modules 210-214 of the program generation system 21 have function of automatically generating a measuring program using a pre-created macro according to variables and variable types designated by a user. Detailed functions of the function modules 210˜214 are illustrated in
In step S10, the measuring software 2 runs in the computing device 1, and in step S11, the script editor 20 of the measuring software 2 is opened.
In step S12, one or more macro s are created in the script editor 20, and each of the one or more macro s is given a macro name and stored into a designated directory or a macro folder of the storage unit 4. One example of a created macro which is given a macro name “kk” may be described as:
Return a+b;
It may be understood that each of the one or more created macros stored in the designated directory or the macro folder can be invoked repeatedly to execute a particular function for measuring the product, such as computing a length, an angle, for example. Thus, if a macro having an intended function has originally existed in the designated directory or the macro folder, steps S10-S12 can be omitted.
In step S13, the script editor 20 is reopened when the product is measured using the measuring software 2.
In step S14, a macro option of the script editor 20 is selected to show a macro interface. An example of the macro interface is shown in
In step S15, the initialization module 210 initializes the variable type list 10 in the macro interface for loading all data types into the variable type list. The data types may include Integer, Long, Single, Double, for example.
In step S16, the initialization module 210 initializes the macro name list 11 in the macro interface for loading all the macro names of the created macros stored in the designated directory or macro folder into the macro name list 11.
In step S17, the receiving module 211 receives a variable name inputted through the variable name box 12 of the macro interface. The received variable name may be “a”, “b”, or “c”, for example.
In step S18, the receiving module 211 receives a variable type of the received variable name selected through the variable type list 10 of the macro interface. If the received variable type is Integer, it means that the received variable a, b, or c is an integer.
In step S19, the determination module 212 determines whether the received variable name and variable type are qualified. In one embodiment, if the created macros are written in a particular programming language, the determination module 122 determines whether the received variable name and variable type comply with the rules of the particular programming language. The determination module 122 determines that the received variable name and variable type are not qualified when the variable name and variable type do not comply with the rules of the particular programming language, step S20 is implemented. The determination module 122 determines that the received variable name and variable type are qualified when the variable name and variable type comply with the rules of the particular programming language, step S21 is implemented.
In step S20, the determination module 212 displays an error information on the macro interface, and then the procedure goes to step S17.
In step S21, the generation module 213 generates a variable declaration according to the received variable name and variable type, and adds the received variable name into the macro result list 13 of the macro interface. The variable declaration may be, for example, “Dim a integer”, “Dim b integer”, “Dim c integer”, for example.
In step S22, the determination module 212 determines if other variable name is received. If another one variable name is inputted through the variable name box 12 of the macro interface, step S17 is repeated. Otherwise, if no variable name is inputted through the variable name box 12 of the macro interface, step S23 is implemented.
In step S23, the receiving module 211 receives a macro name, such as “kk”, selected from the macro name list 12, and receives a variable name, such as “c” selected from the macro result list 13.
In step S24, the generation module 213 assigns the selected variable name to a macro corresponding to the selected macro name, such as c=Load macro (“kk”).
In step S25, the receiving module 211 receives one or more variables inputted into the macro that corresponds to the selected macro name.
In step S26, the execution module 214 executes the macro according to the received variables, and output results in the output column 14 of the macro interface.
In step S27, the generation module 213 generates a measuring program of the product according to the above operation, and displays the measuring program on the script editor 20.
It should be emphasized that the above-described embodiments of the present disclosure, particularly, any embodiments, are merely possible examples of implementations, merely set forth for a clear understanding of the principles of the disclosure. Many variations and modifications may be made to the above-described embodiment(s) of the disclosure without departing substantially from the spirit and principles of the disclosure. All such modifications and variations are intended to be included herein within the scope of this disclosure and the present disclosure and protected by the following claims.
Number | Date | Country | Kind |
---|---|---|---|
201110456009.X | Dec 2011 | CN | national |