The content of the invention
Different 3D presentation terminals are needed to parse and emulate the Machining Instruction representated by G code for different G codes,
In the absence of a kind of defect for the 3D presentation terminals that emulation can be processed with integrated a variety of G codes, the present invention provides a kind of add
Method, terminal device and the computer-readable recording medium of work emulation.
The first aspect of the embodiment of the present invention provides a kind of method of machining simulation, including:
Syntax check is carried out with reference to preset format to original G code;
If the inspection result of syntax check is correct, action event list is generated after original G code is explained;If wrong
By mistake, then after original G code is modified with reference to preset format, syntax check is repeated, until inspection result is correct;
Corresponding action event is matched out of action list of thing according to the action of triggering, the action event that matching is obtained
It is sent to emulation end and carries out mould processing demonstration.
Further, before to original G code with reference to preset format progress syntax check, method includes:
Receive and preserve original G code.
Further, action event list is generated after original G code is explained, including:
Original G code is explained into some action events of generation;
Some action events are placed into task manager by the order of occurrence of event.
Further, action event matching obtained is sent to emulation end and carries out mould processing demonstration, including:
Cutter height figure is formed after the three-dimensional coordinate point of cutter is handled;
Workpiece prototype height map is formed after the three-dimensional coordinate point of workpiece prototype is handled;
Cutter height figure is projected on workpiece prototype height map and forms deformation workpiece height figure;
Come out according to deformation workpiece height figure generation deformation workpiece and demonstration.
Further, corresponding action event is matched out of action list of thing according to the action of triggering, matching is obtained
Action event be sent to emulation end demonstrated after, method includes:
End is emulated to the surface coloring for the model demonstrated.
The second aspect of the embodiment of the present invention provides a kind of device of machining simulation, including:
Module is checked, for carrying out syntax check with reference to preset format to original G code;
Generation module, if for judging that the inspection result of syntax check is correct, being generated after original G code is explained
Action event list;If mistake, after original G code is modified with reference to preset format, repeat syntax check, until
Inspection result is correct;
Demonstration module is processed, corresponding action event is matched out of action list of thing for the action according to triggering, will
Match obtained action event and be sent to the progress mould processing demonstration of emulation end.
Further, generation module, is specifically included:
Interpretation unit, for original G code to be explained into some action events of generation;
Placement unit, for some action events to be placed into task manager by the order of occurrence of event.
Further, device also includes:
Colouring module, for emulating end to the surface coloring for the model demonstrated.
The third aspect of the embodiment of the present invention provides a kind of terminal device of machining simulation, including memory, processor
And storage is in memory and the computer program that can run on a processor, during computing device computer program realization with
Lower step:
Syntax check is carried out with reference to preset format to original G code;
If the inspection result of syntax check is correct, action event list is generated after original G code is explained;If wrong
By mistake, then after original G code is modified with reference to preset format, syntax check is repeated, until inspection result is correct;
Corresponding action event is matched out of action list of thing according to the action of triggering, the action event that matching is obtained
It is sent to emulation end and carries out mould processing demonstration.
The fourth aspect of the embodiment of the present invention provides a kind of computer-readable recording medium of machining simulation, and computer can
Read storage medium to be stored with computer program, following steps are realized when computer program is executed by processor:
Syntax check is carried out with reference to preset format to original G code;
If the inspection result of syntax check is correct, action event list is generated after original G code is explained;If wrong
By mistake, then after original G code is modified with reference to preset format, syntax check is repeated, until inspection result is correct;
Corresponding action event is matched out of action list of thing according to the action of triggering, the action event that matching is obtained
It is sent to emulation end and carries out mould processing demonstration.
The beneficial effect that the embodiment of the present invention exists compared with prior art is:The present invention is by by the G generations of different-format
Frameshift alteration be uniform format G code form, and export emulation to 3D end be processed demonstration, enhance 3D emulation end compatibility
Property, convenient not homologous G code, which inputs 3D emulation end, can check workpiece process, reduce configuration not source device into
This.
Embodiment
In describing below, in order to illustrate rather than in order to limit, it is proposed that such as tool of particular system structure, technology etc
Body details, thoroughly to understand the embodiment of the present invention.However, it will be clear to one skilled in the art that there is no these specific
The present invention can also be realized in the other embodiments of details.In other situations, omit to well-known system, device, electricity
Road and the detailed description of method, in case unnecessary details hinders description of the invention.
In order to illustrate technical scheme, illustrated below by specific embodiment.
Fig. 1 is the implementation process schematic diagram of the method for machining simulation provided in an embodiment of the present invention;Fig. 2 is that Fig. 1 is provided
System architecture diagram where the method for machining simulation;Fig. 3 is the scene applicating flow chart of the method for the machining simulation that Fig. 1 is provided.
As shown in Figure 1 to Figure 3, the present embodiment executive agent is 3D presentation terminals, the method for the machining simulation that the present embodiment is provided, can be with
Including:
101st, syntax check is carried out with reference to preset format to original G code;
Specifically, before syntax check is carried out with reference to preset format to original G code, it is necessary first to receive and preserve original
Beginning G code.Here the not homologous G code that the original G code preserved is developed for each manufacturer on the market.Here preset format is
The unified form that the G code that the presentation terminal is specified is preserved, such as, null, space, annotation, starting mark are deleted by G code
The irrelevant informations such as knowledge, end of identification, only leave key word information.Preset format is not construed as limiting herein.
It should be noted that existing on the market in a variety of 3D presentation terminals, the present embodiment, using unity3D as 3D, demonstration is whole
End is described.
If the 102, the inspection result of syntax check is correct, action event list is generated after original G code is explained;
If mistake, after original G code is modified with reference to preset format, repeat syntax check, until inspection result is correct;
Specifically, action event list is generated after original G code is explained, including:Original G code is explained
Generate some action events;Some action events are placed into task manager by the order of occurrence of event.Further,
CNC (Computer numerical control) digital control system is the abbreviation of numerical control system, according to computer storage
The control program of middle storage, executable portion or whole numerical control function, and it is special equipped with interface circuit and servo drive
Use computer system.G code can be compiled in CNC code compiler.In the present embodiment, CNC code compiler is encapsulated
For dll file, in the scripted code editing machine for being embedded into U3D (general 3 D graphic form Universal 3D).By calling CNC
Syntax check function in code encoder judges the form of the original G code of input.
If it is determined that format error, show that the original G code form of input is not consistent with preset format, then need to be changed to pre-
If entering row format judgement again after form as defined in form.If it is determined that form is correct, showing the original G code of input does not have language
Method and logic error, then read G code line by line in new file.The G code in new file is processed ginseng herein
According to the standard G code of preset format, the irrelevant informations such as null, space, annotation, origin identification, end of identification have been deleted.Will be every
The treated G code of row is transmitted to after CNC code compiler again, and compiler can explain translation to G code, and final with event
The form of list is delivered and is given to U3D presentation terminals.
Further, often row G code may be translated into a plurality of instruction, and these instructions can be placed by action order of occurrence
Into task manager.After the completion of translation, CNC code compiler first instruction of triggering automatically, the corresponding action of the instruction exists
Realized in U3D interfaces (if U3D has the action command).After the completion of action, U3D catcher task managers trigger next finger
Make and realize its action or function, so circulation until completing all events and instruction.Then next line G code is sent to CNC
Code encoder, repeats said process, until all G codes are processed and save as preset format.
103rd, corresponding action event is matched out of action list of thing according to the action of triggering, the action that matching is obtained
Event is sent to emulation end and carries out mould processing demonstration.
Specifically, the operation acts that progress mould processing demonstration in emulation end includes are as shown in the table:
Workpiece deformation process is demonstrated, the cutter for cutting workpiece is also selected first.Cutter refers to mechanical system
It is used for the instrument of machining, also known as cutting element in making.Most of cutter is that machine is used, and also has hand.Due to machine
The cutter used in tool manufacture is substantially all for cutting metal material, so " cutter " one word is typically just interpreted as metal cutting
Cutter.Tool category is a lot, according to part machining shape from suitable cutter.
Further, action event matching obtained is sent to emulation end and carries out mould processing demonstration, including:By cutter
Three-dimensional coordinate point handled after formed cutter height figure;Workpiece is formed after the three-dimensional coordinate point of workpiece prototype is handled
Prototype height map;Cutter height figure is projected on workpiece prototype height map and forms deformation workpiece height figure;According to deformation workpiece
Height map generation deforms workpiece and demonstrated and comes out.Yet further, the three-dimensional coordinate point of cutter is extracted, picked by invalid
Remove, the methods such as point are paid in position conversion, scale conversion, rotation, and cutter is projected on a virtual plane, form a cutter height
Degree figure.The three-dimensional coordinate point of workpiece prototype is also generated into a dynamic workpiece prototype height map, and sets workpiece prototype
Normal and unity and coherence in writing mapping coordinates.Follow-up workpiece deformation operation projects to cutter height figure on workpiece height figure, passes through height
Conversion forms a new deformation workpiece height figure, and workpiece height figure is being deformed into the change after a new deformation by this
Shape workpiece.Wherein, the process of deformation workpiece is included in processing working angles, and blank workpiece is gradually become by regular cutting
Into the whole process of part.
It should be understood that the size of the sequence number of each step is not meant to the priority of execution sequence, each process in above-described embodiment
Execution sequence should determine that the implementation process without tackling the embodiment of the present invention constitutes any limit with its function and internal logic
It is fixed.
The method that above example is proposed can be seen that the present invention and be united by the way that the G code of different-format is changed into form
One G code form, and export and be processed demonstration to 3D emulation end, the compatibility that 3D emulates end is enhanced, facilitates not homologous G
Code, which inputs 3D emulation end, can check workpiece process, reduce the cost for configuring not source device.
Fig. 4 is the implementation process schematic diagram of the method for the machining simulation that another embodiment of the present invention is provided;As shown in figure 4,
The present embodiment executive agent is 3D presentation terminals, and the action according to triggering that the present embodiment is provided is matched out of action list of thing
Corresponding action event, will match obtained action event and is sent to after emulation end demonstrated, this method can also include:
401st, emulation end is to the surface coloring for the model demonstrated.
Specifically, unobvious by the profile of the workpiece after deformation, it is difficult to highlight actual effect.At this moment need to take color
The means of separation, the difference in height of each coordinate points by deforming workpiece height figure, the bright and clear texture of one color profile of generation,
It is attached on the workpiece of deformation.
Relative to a upper embodiment, reality can be clearly observed by adding surface texture to workpiece in the present embodiment
The deformation effect of workpiece.
It should be understood that the size of the sequence number of each step is not meant to the priority of execution sequence, each process in above-described embodiment
Execution sequence should determine that the implementation process without tackling the embodiment of the present invention constitutes any limit with its function and internal logic
It is fixed.
Fig. 5 is the schematic block diagram of the device of machining simulation provided in an embodiment of the present invention;As shown in figure 5, the present embodiment
Executive agent is 3D presentation terminals, and the device for the machining simulation that the present embodiment is provided can include:
Module 51 is checked, for carrying out syntax check with reference to preset format to original G code;
Generation module 52, if for judging that the inspection result of syntax check is correct, it is raw after original G code is explained
Into action event list;If mistake, after original G code is modified with reference to preset format, repeat syntax check, directly
It is correct to inspection result;
Demonstration module 53 is processed, corresponding action event is matched out of action list of thing for the action according to triggering,
The action event that matching is obtained is sent to emulation end and carries out mould processing demonstration.
It should be noted that modules in said system provided in an embodiment of the present invention, due to real with the inventive method
Apply example and be based on same design, its technique effect brought is identical with the inventive method embodiment, and particular content can be found in the present invention
Narration in embodiment of the method, here is omitted.
The device that above example is proposed is again it can be seen that the present invention by the G code of different-format by being changed to lattice
The unified G code form of formula, and export emulation to 3D end be processed demonstration, enhance 3D emulate end compatibility, facilitate not
Homologous G code, which inputs 3D emulation end, can check workpiece process, reduce the cost for configuring not source device.
Fig. 6 is the schematic diagram of the terminal device for the machining simulation that one embodiment of the invention is provided.As shown in fig. 6, the implementation
The terminal device 6 of the machining simulation of example includes:Processor 60, memory 61 and it is stored in memory 61 and can be in processor
The computer program 62 run on 60, such as the computer program for the method for realizing machining simulation.Processor 60 performs meter
Realize the step in the embodiment of the method for each above-mentioned machining simulation during calculation machine program 62, such as step 101 shown in Fig. 1 to
104.Or, processor 60 realizes the function of each module/unit in above-mentioned each device embodiment, example when performing computer program 62
The function of module 51 to 54 as shown in Figure 5.
The present invention proposes the computer program 62 of the method for realizing machining simulation, including:To original G code with reference to pre-
If form carries out syntax check;If the inspection result of syntax check is correct, generation acts thing after original G code is explained
Part list;If mistake, after original G code is modified with reference to preset format, repeat syntax check, until checking knot
Fruit is correct;Corresponding action event is matched out of action list of thing according to the action of triggering, the action event that matching is obtained
It is sent to emulation end and carries out mould processing demonstration.Computer program 62 can be divided into one or more module/units, one
Or multiple module/units are stored in memory 61, and performed by processor 60, to complete the present invention.It is one or more
Module/unit can complete the series of computation machine programmed instruction section of specific function, and the instruction segment is used to describe to calculate
Implementation procedure of the machine program 62 in the terminal device 6 of machining simulation.For example, computer program 62 can be divided into synchronous mould
Block, summarizing module, acquisition module, return module (module in virtual bench), each module concrete function are as follows:
The terminal device 6 of machining simulation can be the meter such as desktop PC, notebook, palm PC and cloud server
Calculate equipment.The terminal device of machining simulation may include, but be not limited only to, processor 60, memory 61.Those skilled in the art can
To understand, Fig. 6 is only the example of the terminal device 6 of machining simulation, does not constitute the limit to the terminal device 6 of machining simulation
It is fixed, it can include than illustrating more or less parts, either combine some parts or different parts, for example, process imitative
Genuine terminal device 6 can also include input-output equipment, network access equipment, bus etc..
Alleged processor 60 can be CPU (Central Processing Unit, CPU), can also be
Other general processors, digital signal processor (Digital Signal Processor, DSP), application specific integrated circuit
(Application Specific Integrated Circuit, ASIC), ready-made programmable gate array (Field-
Programmable Gate Array, FPGA) or other PLDs, discrete gate or transistor logic,
Discrete hardware components etc..General processor can be microprocessor or the processor can also be any conventional processor
Deng.
Memory 61 can be the internal storage unit of the terminal device 6 of machining simulation, and the terminal of such as machining simulation is set
Standby 6 hard disk or internal memory.Memory 61 can also be the External memory equipment of the terminal device 6 of machining simulation, for example, process imitative
The plug-in type hard disk being equipped with genuine terminal device 6, intelligent memory card (Smart Media Card, SMC), secure digital
(Secure Digital, SD) blocks, flash card (Flash Card) etc..Further, memory 61 can also both include processing
The internal storage unit of the terminal device 6 of emulation also includes External memory equipment.Memory 61 be used for store computer program with
And other programs and data needed for the terminal device 6 of machining simulation.Memory 61 can be also used for temporarily storing defeated
The data that goes out or will export.
It is apparent to those skilled in the art that, for convenience of description and succinctly, only with above-mentioned each work(
Energy unit, the division progress of module are for example, in practical application, as needed can distribute above-mentioned functions by different
Functional unit, module are completed, i.e., the internal structure of device is divided into different functional unit or module, to complete above description
All or part of function.Each functional unit, module in embodiment can be integrated in a processing unit or
Unit is individually physically present, can also two or more units it is integrated in a unit, above-mentioned integrated unit
Both it can be realized in the form of hardware, it would however also be possible to employ the form of SFU software functional unit is realized.In addition, each functional unit, mould
The specific name of block is also only to facilitate mutually differentiation, is not limited to the protection domain of the application.It is single in said system
Member, the specific work process of module, may be referred to the corresponding process in preceding method embodiment, will not be repeated here.
In the above-described embodiments, the description to each embodiment all emphasizes particularly on different fields, without detailed description or note in some embodiment
The part of load, may refer to the associated description of other embodiments.
Those of ordinary skill in the art are it is to be appreciated that the list of each example described with reference to the embodiments described herein
Member and algorithm steps, can be realized with the combination of electronic hardware or computer software and electronic hardware.These functions are actually
Performed with hardware or software mode, depending on the application-specific and design constraint of technical scheme.Professional and technical personnel
Described function can be realized using distinct methods to each specific application, but this realization is it is not considered that exceed
The scope of the present invention.
, can be with embodiment provided by the present invention, it should be understood that disclosed device/terminal device and method
Realize by another way.For example, device described above/terminal device embodiment is only schematical, for example, mould
The division of block or unit, only a kind of division of logic function can have other dividing mode when actually realizing, such as multiple
Unit or component can combine or be desirably integrated into another system, or some features can be ignored, or not perform.It is another
Point, shown or discussed coupling or direct-coupling or communication connection each other can be by some interfaces, device or
The INDIRECT COUPLING of unit or communication connection, can be electrical, machinery or other forms.
The unit illustrated as separating component can be or may not be physically separate, be shown as unit
Part can be or may not be physical location, you can with positioned at a place, or can also be distributed to multiple networks
On unit.Some or all of unit therein can be selected to realize the purpose of this embodiment scheme according to the actual needs.
In addition, each functional unit in each embodiment of the invention can be integrated in a processing unit, can also
That unit is individually physically present, can also two or more units it is integrated in a unit.Above-mentioned integrated list
Member can both be realized in the form of hardware, it would however also be possible to employ the form of SFU software functional unit is realized.
If integrated module/unit is realized using in the form of SFU software functional unit and as independent production marketing or used
When, it can be stored in a computer read/write memory medium.Understood based on such, the present invention realizes above-described embodiment side
All or part of flow in method, can also instruct the hardware of correlation to complete by computer program, computer program
It can be stored in a computer-readable recording medium, each above-mentioned side can be achieved when being executed by processor in the computer program
The step of method embodiment.Wherein, computer program includes computer program code, and computer program code can be source code shape
Formula, object identification code form, executable file or some intermediate forms etc..Computer-readable medium can include:Meter can be carried
Any entity or device of calculation machine program code, recording medium, USB flash disk, mobile hard disk, magnetic disc, CD, computer storage, only
Read memory (ROM, Read-Only Memory), random access memory (RAM, RandomAccess Memory), electric carrier wave
Signal, telecommunication signal and software distribution medium etc..It should be noted that the content that computer-readable medium is included can basis
Legislation and the requirement of patent practice carry out appropriate increase and decrease in jurisdiction, such as in some jurisdictions, according to legislation
And patent practice, computer-readable medium is including electric carrier signal and telecommunication signal.
The above embodiments are merely illustrative of the technical solutions of the present invention, rather than its limitations;Although with reference to the foregoing embodiments
The present invention is described in detail, it will be understood by those within the art that:It still can be to foregoing each implementation
Technical scheme described in example is modified, or carries out equivalent substitution to which part technical characteristic;And these modification or
Replace, the essence of appropriate technical solution is departed from the spirit and scope of various embodiments of the present invention technical scheme, all should include
Within protection scope of the present invention.