G code generation method and device based on voice control
Generating G codes through voice control solves the problems of high operating skills and low work efficiency in the existing technology, and directly generates G codes next to CNC machine tools, improving programming efficiency and reducing operating thresholds.
Patent Information
- Application Number
- CN202510426526.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-07
- Publication Date
- 2025-08-12
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In the prior art, the generation of G code requires professionals to use CAM software to program in a fixed office space, and the operating skills requirements are high, resulting in low work efficiency and programmers need to frequently travel to and from the production site and programming workstations.
The voice required for processing is obtained through voice control, the processing information is analyzed and generated, and the G code is generated based on the processing information. Combined with voice recognition and code generation templates, it supports the generation of G codes directly through voice commands next to the CNC machine tool.
It improves programming efficiency and lowers the operating threshold. It is suitable for a variety of processing equipment and is suitable for production scenarios with frequent small batch adjustments.
Smart Images

Figure CN120472893A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of numerical control machine tool programming, and in particular to a G-code generation method and device based on voice control. Background Art
[0002] CNC machine tools are widely used in modern manufacturing. G-code is the most widely used CNC programming language, primarily used to control automatic machine tools in computer-aided manufacturing (CAM). Traditional G-code programming relies primarily on computer-aided manufacturing (CAM) software, requiring operators to perform programming on a computer in a fixed office.
[0003] Currently, G-code generation requires specialized programming using CAM software, which requires high technical skills and a high learning curve. Furthermore, programmers must write code at a programming workstation, and during debugging, they must travel back and forth between the production site and the programming workstation, resulting in low efficiency. Therefore, a new G-code generation method is urgently needed to address the challenges of existing technologies. Summary of the Invention
[0004] The technical problem to be solved by the present invention is to provide a G-code generation method and device based on voice control to solve the above technical problems.
[0005] The technical solution of the present invention to solve the above-mentioned technical problems is as follows: a G-code generation method based on voice control, comprising: obtaining a processing requirement voice input by a user, wherein the processing requirement voice is a voice describing the processing requirements for a workpiece to be processed; parsing the processing requirement voice to obtain processing information, wherein the processing information is information describing the processing requirements corresponding to the workpiece to be processed; and generating a G-code for the workpiece to be processed based on the processing information.
[0006] The present invention has the following beneficial effects: it extracts processing information based on the user's voice input of processing requirements and then generates G-code suitable for the processing equipment corresponding to the workpiece to be processed based on the processing information. This method is convenient for use in factory production environments, allowing operators to generate G-code directly at the CNC machine tool through voice commands. This significantly improves programming efficiency and lowers the operational threshold, and the method is applicable to a variety of processing equipment.
[0007] On the basis of the above technical solution, the present invention can also be improved as follows.
[0008] Furthermore, generating a G code for the workpiece to be processed based on the processing information includes: identifying a processing type corresponding to the workpiece to be processed based on the processing information; obtaining a code generation template corresponding to the processing type based on a preset code template library; generating a general G code based on the processing information using the code generation template corresponding to the processing type; obtaining processing equipment information input by a user, the processing equipment information being information describing the processing equipment used to process the workpiece to be processed; and generating a G code for the workpiece to be processed based on the general G code and the processing equipment information.
[0009] Furthermore, generating a G code for the workpiece to be processed based on the general G code and the processing equipment information includes: generating processing path information based on the general G code, the processing path information being information describing the motion path of the processing equipment; generating a processing path image based on the processing path information; obtaining verification information for the processing path image input by a user, the verification information being whether the review is passed or not; and generating a G code for the workpiece to be processed based on the verification information, the general G code and the processing equipment information.
[0010] Furthermore, generating a G code for the workpiece to be processed based on the verification information, the general G code and the processing equipment information includes: when the verification information is approved, converting the format of the general G code according to the processing equipment information to obtain the G code for the workpiece to be processed.
[0011] Furthermore, the generating of the G code for the workpiece to be processed based on the verification information, the universal G code and the processing equipment information also includes: when the verification information fails the review, obtaining adjustment information input by the user, the adjustment information being information describing the adjustment content of the universal G code; correcting the universal G code according to the adjustment information to obtain a new universal G code; and converting the format of the new universal G code according to the processing equipment information to obtain the G code for the workpiece to be processed.
[0012] Furthermore, the processing requirement speech is parsed to obtain processing information, including: preprocessing the processing requirement speech to obtain preprocessed speech; performing text recognition on the preprocessed speech through a preset speech recognition model to obtain a processing requirement text; and extracting the processing information based on the processing requirement text.
[0013] To solve the above technical problems, the present invention also provides a G-code generation device based on voice control, comprising: a computing module, a display module, a microphone array and a housing; the computing module, the display module and the microphone array are respectively installed on the housing; the computing module is used to execute a G-code generation method based on voice control as described above; the display module is used to provide an interactive interface with the user; and the microphone array is used to collect the processing requirement voice.
[0014] On the basis of the above technical solution, the present invention can also be improved as follows.
[0015] Furthermore, the device also includes a battery module, which is installed in the housing and is electrically connected to the computing module, the display module and the microphone array respectively.
[0016] Furthermore, the microphone array includes three directional microphones, and the three directional microphones are distributed in a triangle on the housing.
[0017] Furthermore, the device also includes a handle, which is connected to the housing. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 This is a flow chart of a G-code generation method based on voice control according to the present invention. DETAILED DESCRIPTION
[0019] The principles and features of the present invention are described below. The examples given are only used to explain the present invention and are not used to limit the scope of the present invention.
[0020] Example 1
[0021] like Figure 1 As shown, this embodiment provides a G-code generation method based on voice control, including:
[0022] S101: Acquire a processing requirement voice input by a user, wherein the processing requirement voice is a voice describing the processing requirement of a workpiece to be processed. For example, the user may directly describe "processing a circular hole with a diameter of 10 mm, X coordinate 50, Y coordinate 30..."
[0023] S102: Analyze the processing requirement voice to obtain processing information, where the processing information is information describing the processing requirements corresponding to the workpiece to be processed.
[0024] Optionally, in an embodiment, the parsing of the processing requirement voice to obtain processing information includes: preprocessing the processing requirement voice to obtain preprocessed voice; performing text recognition on the preprocessed voice through a preset voice recognition model to obtain a processing requirement text; and extracting the processing information based on the processing requirement text.
[0025] Preprocessing of the speech for processing includes noise suppression and text cleanup. Text cleanup involves converting the audio to mono, resampling, and adding special tags. Converting audio to mono involves converting stereo audio to mono. Resampling involves converting audio from one sampling rate to another. Special tags are used to indicate specific sound effects or emotional expressions.
[0026] When processing the required speech through the speech recognition model, it is necessary to remove factors such as language, emotion, speed, etc. The speech recognition model can be selected according to actual needs. In this embodiment, the speech recognition model uses the SenseVoice multi-language model.
[0027] Extracting the processing information based on the processing requirement text involves performing text analysis on the processing requirement text using a preset text analysis model to extract the processing information. A specific text analysis model can be selected based on actual needs. In this embodiment, qwen2.5 is used as the text analysis model. For processing information, using the example of processing a circular hole using wire cutting equipment, the content of the processing information is shown in Table 1. It should be noted that the content of the processing information is not limited to that shown in Table 1 and is determined based on different processing situations.
[0028] Table 1 Processing information example table
[0029] Classification Chinese description round hole The first round hole X coordinate 10 Y coordinate 11 Aperture 3 Number of processing tools 3 First knife correction 0.185 Second knife correction 0.125 The third knife correction 0.115
[0030] S103: Generate a G code for the workpiece to be processed according to the processing information.
[0031] Optionally, in an embodiment, generating a G code for the workpiece to be processed based on the processing information includes: identifying a processing type corresponding to the workpiece to be processed based on the processing information; obtaining a code generation template corresponding to the processing type based on a preset code template library; generating a general G code based on the processing information through the code generation template corresponding to the processing type; obtaining processing equipment information input by a user, the processing equipment information being information describing the processing equipment used to process the workpiece to be processed; and generating a G code for the workpiece to be processed based on the general G code and the processing equipment information.
[0032] Before identifying the processing type corresponding to the workpiece to be processed based on the processing information, the processing information must be parameter-verified to determine whether any necessary parameters are missing. If no parameters are missing, the processing type corresponding to the workpiece to be processed is directly identified based on the processing information. If there are missing parameters, such as missing coordinate information, the user will be prompted to correct the parameters and re-record the recording. The newly acquired processing requirement voice is processed as described above to obtain new processing information, and the processing type corresponding to the workpiece to be processed is then identified based on this new processing information.
[0033] In this embodiment, machining types include cavity, contour, and drilling. A code generation template corresponding to each machining type is set in a pre-set code template library. For example, if the machining information indicates that a circular hole needs to be machined, the corresponding machining type is drilling. The code generation template corresponding to the drilling type is obtained, and the Agent program calls the data in the machining information to populate the code generation template corresponding to the drilling type, resulting in a universal G-code for the workpiece to be machined. Universal G-code is G-code that complies with international standards.
[0034] Optionally, in an embodiment, generating a G code for the workpiece to be processed based on the general G code and the processing equipment information includes: generating processing path information based on the general G code, the processing path information being information describing the motion path of the processing equipment; generating a processing path image based on the processing path information; obtaining verification information for the processing path image input by the user, the verification information being whether the review is passed or not; and generating a G code for the workpiece to be processed based on the verification information, the general G code and the processing equipment information.
[0035] The machining path image visually displays the motion path of the machining equipment during the machining process of the workpiece. This allows the user to determine whether the generated universal G-code is correct based on the machining path image. If it meets the user's requirements, the user input is approved; otherwise, the user input is rejected.
[0036] Optionally, in an embodiment, the G code for the workpiece to be processed is generated based on the verification information, the general G code and the processing equipment information, including: when the verification information is approved, the general G code is formatted according to the processing equipment information to obtain the G code for the workpiece to be processed.
[0037] Optionally, in an embodiment, generating a G code for the workpiece to be processed based on the verification information, the universal G code and the processing equipment information also includes: when the verification information fails the review, obtaining adjustment information input by the user, the adjustment information being information describing the adjustment content of the universal G code; correcting the universal G code according to the adjustment information to obtain a new universal G code; and converting the format of the new universal G code according to the processing equipment information to obtain a G code for the workpiece to be processed.
[0038] The international standard for G-code was established relatively late, a product of compromise among various manufacturers. It is inherently open, defining only a basic instruction framework but not strictly restricting specific implementations, allowing manufacturers to freely experiment. Aside from some common basic instructions, everything else, including code definitions, code formats, and device compatibility, is entirely defined by the equipment manufacturers. Therefore, it is necessary to convert the universal G-code format to obtain a G-code that is compatible with the processing equipment corresponding to the workpiece being processed. This ultimately results in the G-code for the workpiece being processed.
[0039] Example 2
[0040] This embodiment provides a G-code generation device based on voice control, including: a computing module, a display module, a microphone array and a housing; the computing module, the display module and the microphone array are respectively installed on the housing; the computing module is used to execute a G-code generation method based on voice control as described in Example 1; the display module is used to provide an interactive interface with the user; and the microphone array is used to collect the processing requirement voice.
[0041] This device can be used portable in factory production environments, quickly generating G-code via voice commands and supporting visual verification and modification. With this device, operators can generate and modify G-code directly at the CNC machine tool using voice commands, while also viewing the machining trajectory in real time. This significantly improves programming efficiency and lowers the operational barrier, making it particularly suitable for production scenarios requiring frequent small-batch adjustments.
[0042] Specifically, the housing is made of industrial-grade protective materials, such as industrial-grade ABS+PC composite. It is shockproof, dustproof, and oil-resistant, with an IP54 rating, effectively protecting against dust and oil in factory environments. The overall housing is a flat rectangular parallelepiped, measuring approximately 140mm × 110mm × 40mm and weighing less than 500g, making it easy to hold in one hand for extended operation.
[0043] The computing module consists of a main controller, memory, and wireless communication unit. The high-performance main controller is at its core, powered by a multi-core ARM architecture processor running at 2.4GHz. The memory includes 8GB of RAM and 128GB of flash memory for storing the operating system, applications, and user data. The wireless communication unit supports both WiFi and Bluetooth, enabling high-speed communication with external systems and CNC equipment.
[0044] The display module is a display screen. The specific model and parameters can be selected based on actual needs. In this embodiment, the display module includes a 5-inch IPS screen with a resolution of 1280×720 pixels and a brightness of 300 nits, ensuring clear visibility under factory lighting conditions. The touch layer uses industrial-grade capacitive touch technology and supports 5-point touch. The display interface adopts a split-screen design, showing the processing path image and the parameter table and control buttons at the bottom.
[0045] Specifically, the display interface includes a waveform display area, function button area, machining path view area, machining information table area, and G-code export button. The waveform display area is used to display the waveform during voice input, making it easier for users to determine whether the voice input has been recorded. The function button area includes buttons for uploading audio files, recording, stopping, saving, and canceling. The machining information table area displays information such as the machining number, coordinate information, machining parameters, and correction data.
[0046] Optionally, in an embodiment, the device further includes a battery module, which is installed in the housing and is electrically connected to the computing module, the display module and the microphone array respectively.
[0047] The battery module utilizes a dual-cell design, including a main battery consisting of three 18650 lithium-ion batteries. The charging port supports fast charging, allowing for a charge to 80% capacity in 30 minutes. Under normal use, the battery can power the device for over eight hours of continuous operation.
[0048] Optionally, in an embodiment, the microphone array includes three directional microphones, and the three directional microphones are distributed in a triangular shape on the housing.
[0049] The microphone array includes three highly sensitive directional microphones arranged in a triangular pattern on the upper housing. This multi-microphone array technology, combined with digital signal processing algorithms, effectively suppresses background noise in factory environments and improves speech recognition accuracy. The microphones have a pickup range of up to 50cm and maintain over 90% recognition accuracy in an 85dB noise environment.
[0050] Optionally, in an embodiment, the device further comprises a handle connected to the housing.
[0051] The handle is located on the left side of the case and is ergonomically designed with a non-slip silicone surface. There is also an emergency button on the handle for quick shutdown.
[0052] The working principle of this device is as follows: the user holds the device next to the machine tool and describes the processing requirements through voice commands, such as "process a circular hole with a diameter of 10 mm, X coordinate 50, Y coordinate 30...". The microphone array collects the voice signal and transmits it to the computing module after noise suppression processing. The computing module executes the G-code generation method based on voice control as described in Example 1 above, and the generated processing path image is displayed by the display module for user verification. The user can adjust the parameters through the touch screen, and after confirmation, the obtained general G-code is converted into G-code suitable for the processing equipment corresponding to the workpiece to be processed. The user can transfer the G-code directly to the CNC device via Bluetooth or WiFi, or export it to a USB flash drive.
[0053] The system architecture of the present invention comprises a hardware layer, a system layer, and an application layer. The hardware layer includes the aforementioned hardware modules; the system layer comprises a customized embedded operating system, drivers, and middleware; and the application layer comprises a speech recognition module, a semantic understanding module, a G-code generation module, a visualization display module, and a device communication module.
[0054] Designed specifically for workshop environments, this device is dust- and oil-resistant. Its microphone array effectively suppresses industrial noise, and its display remains clearly visible even under indoor lighting. Its integrated handheld design allows operators to use it freely on the production floor. It rapidly generates G-code through voice interaction, eliminating the need to return to a workstation to operate CAM software, thus solving the problem of mobile programming on the production floor. Combining voice commands with touchscreen operation, this device adapts to the interactive needs of diverse work scenarios, lowering the barrier to entry and improving code generation efficiency.
[0055] In the description of this specification, the reference terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" mean that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art can combine and combine different embodiments or examples described in this specification and features of different embodiments or examples without contradiction.
[0056] Although the embodiments of the present invention have been shown and described above, it will be understood that the above embodiments are illustrative and are not to be construed as limitations on the present invention. A person skilled in the art may change, modify, replace and modify the above embodiments within the scope of the present invention.
Claims
1. A G-code generation method based on voice control, characterized in that: include: Acquiring a processing requirement voice input by a user, wherein the processing requirement voice is a voice describing the processing requirement of a workpiece to be processed; Parsing the processing requirement voice to obtain processing information, where the processing information is information describing the processing requirements corresponding to the workpiece to be processed; A G code for the workpiece to be processed is generated according to the processing information.
2. The G-code generation method based on voice control according to claim 1, characterized in that: Generating a G code for the workpiece to be processed according to the processing information includes: Identifying a processing type corresponding to the workpiece to be processed according to the processing information; According to a preset code template library, a code generation template corresponding to the processing type is obtained; Generate a general G code according to the processing information using a code generation template corresponding to the processing type; Acquire processing equipment information input by a user, wherein the processing equipment information is information describing the processing equipment used to process the workpiece to be processed; A G code for the workpiece to be processed is generated according to the general G code and the processing equipment information.
3. The G-code generation method based on voice control according to claim 2, characterized in that: Generating a G code for the workpiece to be processed based on the general G code and the processing equipment information includes: Generate machining path information according to the universal G code, wherein the machining path information is information describing a motion path of a machining device; generating a processing path image according to the processing path information; Acquiring verification information for the processing path image input by the user, wherein the verification information is whether the verification is passed or not; A G code for the workpiece to be processed is generated according to the verification information, the general G code and the processing equipment information.
4. The G-code generation method based on voice control according to claim 3, characterized in that: Generating a G code for the workpiece to be processed according to the verification information, the general G code, and the processing equipment information includes: When the verification information is approved, the format of the general G code is converted according to the processing equipment information to obtain the G code for the workpiece to be processed.
5. The G-code generation method based on voice control according to claim 3, characterized in that: The step of generating a G code for the workpiece to be processed according to the verification information, the general G code, and the processing equipment information further includes: When the verification information indicates that the verification information fails the review, the adjustment information input by the user is obtained, where the adjustment information is information describing the adjustment content of the general G code; Correcting the general G code according to the adjustment information to obtain a new general G code; The new universal G code is formatted according to the processing equipment information to obtain a G code for the workpiece to be processed.
6. The G-code generation method based on voice control according to claim 1, characterized in that: The step of parsing the processing requirement voice to obtain processing information includes: Preprocessing the processing-required speech to obtain preprocessed speech; Performing text recognition on the pre-processed speech through a preset speech recognition model to obtain a processing requirement text; The processing information is extracted according to the processing requirement text.
7. A G-code generation device based on voice control, characterized in that: include: Computing module, display module, microphone array and casing; The computing module, the display module and the microphone array are respectively mounted on the housing; The computing module is used to execute a G-code generation method based on voice control as described in any one of claims 1 to 6; the display module is used to provide an interactive interface with the user; and the microphone array is used to collect the processing requirement voice.
8. The G-code generation device based on voice control according to claim 7, characterized in that: It also includes a battery module, which is installed in the housing and is electrically connected to the computing module, the display module and the microphone array respectively.
9. The G-code generation device based on voice control according to claim 7, characterized in that: The microphone array includes three directional microphones, and the three directional microphones are distributed in a triangle shape on the housing.
10. The G-code generating device based on voice control according to claim 7, characterized in that: The utility model further comprises a handle connected to the housing.
Citation Information
Cited By
Multi-screen preview method for large model generation codes
CN120994156A