CAD drawing batch translation method and system based on ActiveX and COM technologies
By adopting ActiveX and COM technologies in the CAD drawing translation system, combined with user-defined dictionary and translation server, multi-language, two-way, batch translation of CAD drawings is realized, and the problems of low translation efficiency and poor accuracy in the existing technology are solved. Improved translation quality and consistency.
Patent Information
- Application Number
- CN202411317106.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-20
- Publication Date
- 2025-02-14
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The prior art is difficult to realize multilingual direct translation of CAD drawings, and cannot batch process drawing files, cannot translate text in tiles and enhancement attribute blocks, and there are translation consistency and quality problems.
Using ActiveX and COM technology methods, the text information in the drawing is extracted by calling the CAD program, preprocessing and sending it to the translation server for translation. It supports multilingual and two-way translation, and combines user-defined professional dictionaries and fixed translation phrases. Group.
It realizes multi-language, two-way, batch translation of CAD drawings, improves translation efficiency and accuracy, ensures professionalism and consistency of translation results, and continuously optimizes translation quality through user feedback.
Smart Images

Figure CN119443118A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer graphics processing technology, and in particular to a method and system for batch translation of CAD drawings based on ActiveX and COM technology. Background Art
[0002] As Chinese design consulting goes abroad, more and more Chinese engineers and designers are involved in international projects, which involve a large number of multilingual and two-way translation needs for drawings. At present, there is no commercial CAD software that can better achieve the direct translation of multilingual drawings. It often relies on manual translators to open the drawings and modify them one by one. Or it is to extract the characters in the drawings, export them as text, translate them one by one, and finally replace the translated text back into the drawings. This method has many technical defects, including: it is impossible to process drawing files in batches; it is impossible to translate the text in blocks and enhanced attribute blocks; the same character sequence may be translated repeatedly; it is impossible to introduce user-defined professional dictionaries or habitual expressions; different translators have poor consistency in translating the same drawing content, or the same translator has poor consistency in translating at different time periods. These defects seriously affect the efficiency and quality of the translation of engineering drawings, and over-reliance on the language level and professional quality of translators often leads to translation confusion in practice.
[0003] In view of this, this application is specially filed. Summary of the invention
[0004] In view of the defects in the prior art, the purpose of this application is to provide a method and system for batch translation of CAD drawings based on ActiveX and COM technology, so as to realize multi-language, bidirectional controllable, accurate, batch and sustainable quality optimized CAD drawing translation.
[0005] In one aspect of the present application, a method for batch translation of CAD drawings based on ActiveX and COM technology is provided, the method comprising the following steps:
[0006] S1. Obtain the CAD drawing file or folder selected by the user;
[0007] S2, call the CAD program through ActiveX and COM technology, extract the text information in the drawing, and perform preprocessing;
[0008] S3, sending the processed text list and the target language name to the translation server, which translates the text list and returns it in combination with the user-defined professional dictionary and the fixed translation phrase group;
[0009] S4. Visually display the translated text on the user interface to determine whether the user confirms the translated text. If yes, update the translation result to the drawing; if no, the user revises the translation result and updates it to the drawing, and simultaneously uploads the revised content to the server to update the knowledge base, and proceeds to the next drawing task;
[0010] S5. Determine whether the current drawing file is the last one. If so, end the process.
[0011] Furthermore, in step S2, calling the CAD program through ActiveX and COM technology to extract text information from the drawing includes:
[0012] S21, obtaining component object models COM and ActiveX, and opening the drawing file selected by the user;
[0013] S22, constructing an object filter, the filter including: single-line text (AcadText), multi-line text (AcadMtext), and text of attribute values in enhanced attribute blocks (AcadBlockReference);
[0014] S23, extracting text information and attribute information from AcadText, AcadMtext and AcadBlockReference objects in the drawing through the Selection method of ActiveX Object Model;
[0015] S24. Build a text list based on the extracted text information and attribute information.
[0016] Furthermore, in step S2, preprocessing includes:
[0017] S25, processing the assembled text list, removing duplicate string elements, and removing items that do not need to be translated according to user-defined removal rules;
[0018] The user-defined rejection rules include: simple numbers or a combination of symbols and numbers, fixed codes, fixed industry abbreviations, and special characters;
[0019] S26, generating a text list to be translated after being eliminated and simplified.
[0020] Furthermore, in step S3, it includes:
[0021] S31, sending the processed text list to the translation server through the Web-API interface in POST or HTTP access mode, with additional parameters of the names of the original language and the target translation language;
[0022] S32. The server translates the text list in combination with the user-defined professional dictionary and the fixed translation phrase group.
[0023] Furthermore, in S32, the user-defined professional dictionary includes: a professional dictionary, a translation revision knowledge base of historical user feedback, an enterprise standard translation text base, and the like.
[0024] Furthermore, in step S4, it includes:
[0025] S41, obtaining the translated text, and displaying the one-to-one correspondence between the original text and the translated text in a table form on a user interface, so that the user can review and revise the text;
[0026] S42: Determine whether the user confirms the translated text. If so, the translation result is automatically updated to the drawing. If not, determine that the translated text has been revised and feedback the revised content.
[0027] Furthermore, after S42, the method further includes:
[0028] S43, obtaining revised content based on user feedback;
[0029] S44, feeding back the obtained revised content to the translation server, and updating the translation knowledge base of the server;
[0030] S45, start translation, update the revised content into the translated text, and continue to execute step S41.
[0031] Furthermore, in step S5, it includes:
[0032] After the user confirms the translated text, the translation result is automatically updated to the drawing, and it is determined whether the current drawing is the last drawing file. If so, the process ends; if not, the process continues to execute step S1.
[0033] Furthermore, in step S3, the translation server may be a translation server built by the user, or a translation API interface provided by service providers such as DeepL, Google, Youdao, and Baidu Translation.
[0034] The second aspect of the present invention provides a CAD drawing batch translation system based on ActiveX and COM technology, comprising:
[0035] The acquisition module is used to acquire the CAD drawing file or folder selected by the user;
[0036] The processing module is used to call the CAD program through ActiveX and COM technology, extract the text information in the drawing, and perform preprocessing;
[0037] A translator module is used to obtain the processed text list and the target language name. The translation server in the translator module translates the text list in combination with a user-defined professional dictionary and a fixed translation phrase group;
[0038] The first judgment module is used to visualize the translated text on the user interface and judge whether the user confirms the translated text. If yes, the translation result is automatically updated to the drawing. If no, the revised content is fed back;
[0039] The second judgment module is used to judge whether the current drawing file is the last one, and if so, the process ends.
[0040] Compared with the prior art, the present invention has at least one of the following beneficial effects:
[0041] 1. This application solves many defects in traditional drawing translation methods by combining ActiveX and COM technologies, as well as user interaction and revision feedback mechanisms, and realizes batch translation of drawing files. Through the target language support provided by the translation server, bidirectional and multilingual automatic processing of text is realized, which has strong practicality and broad application prospects.
[0042] 2. This application can realize batch processing of drawings by selecting multiple CAD drawing files or folders, saving time. The automatic extraction and preprocessing process of ActiveX and COM reduces the manual search for texts to be translated, improving efficiency and accuracy. At the same time, professional dictionaries and phrase groups are used to increase the professionalism and accuracy of automated translation, especially for the translation of specific industry terms. In combination with user interaction, the accuracy and applicability of the translation results are ensured through user confirmation steps. At the same time, automated updates reduce the workload of manual modifications by users.
[0043] 3. This method collects and feeds back users' revisions to automatic translation results and updates them to the translation server. This process can continuously accumulate translation experience, avoid repeated errors, and form an enterprise-level corpus to achieve continuous improvement in translation quality. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] Other features, objects and advantages of the present application will become more apparent by reading the detailed description of non-limiting embodiments with reference to the following drawings:
[0045] Figure 1 This is a flow chart of a method for batch translation of CAD drawings based on ActiveX and COM technology according to an embodiment of the present application.
[0046] Figure 2 Detailed flowchart of step S2 in one embodiment of the present application.
[0047] Figure 3Detailed flowchart of step S4 in one embodiment of the present application.
[0048] Figure 4 This is a detailed flow chart of a method for batch translating CAD drawings based on ActiveX and COM technology in one embodiment of the present application.
[0049] Figure 5 This is a translation page diagram in one embodiment of the present application. DETAILED DESCRIPTION
[0050] The present application is described in detail below in conjunction with specific embodiments. The following embodiments will help those skilled in the art to further understand the present application, but do not limit the present application in any form. It should be noted that, for those of ordinary skill in the art, several variations and improvements can also be made without departing from the concept of the present application. These all belong to the protection scope of the present application.
[0051] The present application provides a method for batch translation of CAD drawings based on ActiveX and COM technologies. By combining ActiveX and COM technologies, as well as user interaction and revision feedback mechanisms, it solves many defects in traditional drawing translation methods, realizes batch translation of drawing files and two-way, multi-language automatic processing of texts, and has strong practicality and broad application prospects.
[0052] Reference Figure 1 As shown, a method for batch translation of CAD drawings based on ActiveX and COM technology is provided in accordance with an embodiment of the present application. The method comprises the following steps:
[0053] S1. Obtain the CAD drawing file or folder selected by the user.
[0054] Specifically, any language development platform can be used, including but not limited to Python, Visual Studio, VBA and other development tools. When the user uses it, select a folder or a single or multiple CAD files (DWG drawings), and the program obtains the drawing file path (list) reference Figure 5 As shown, the file path is also displayed in the translation interface.
[0055] S2. Call the CAD program through ActiveX and COM technology to extract the text information in the drawing and perform preprocessing.
[0056] S3. Send the processed text list and the target language name to the translation server, and the translation server translates the text list in combination with the user-defined professional dictionary and the fixed translation phrase group.
[0057] S4. Visualize the translated text on the user interface to determine whether the user confirms the translated text. If so, the translation result is automatically updated to the drawing. If not, the user revise the translation result and update it to the drawing, and simultaneously upload the revised content to the server to update the knowledge base and continue with the next drawing task.
[0058] S5. Determine whether the current drawing file is the last one. If so, end the process.
[0059] Specifically, the user first selects one or more CAD drawing files or the entire folder containing the drawings through a graphical user interface (GUI), then uses ActiveX controls and COM interfaces to interact with CAD software (such as AutoCAD), reads text elements in the drawings (such as comments, font size, color, etc.), and performs necessary preprocessing (such as removing irrelevant characters, letters, etc.), and sends the preprocessed text to a local translation server. The server uses natural language processing technology and professional dictionaries and phrase groups provided by the user for translation. The automated extraction and preprocessing process reduces manual intervention, improves efficiency and accuracy, and uses professional dictionaries and phrase groups to improve the professionalism and accuracy of the translation, especially for the translation of specific industry terms. The translation results are then displayed to the user, who can confirm or revise the translation content through the interface. After confirmation, the program automatically updates the translation results back to the corresponding position in the CAD drawing. Finally, when performing batch processing, it is determined whether all files have been processed to ensure that all drawings are processed correctly.
[0060] This application achieves batch processing of drawings by acquiring CAD files or folders, saving time. It reduces manual intervention and improves efficiency and accuracy through the automatic extraction and preprocessing process of ActiveX and COM. At the same time, it uses professional dictionaries and phrase groups to increase the professionalism and accuracy of automated translation, especially for the translation of specific industry terms. It combines user interaction and ensures the accuracy and applicability of translation results through user confirmation steps. At the same time, automated updates reduce the workload of manual modification by users. Collect and feedback user revisions to automatic translation results and update them to the translation server. This process can continuously accumulate translation experience, avoid duplication of errors, and form an enterprise-level corpus to achieve continuous improvement in translation quality.
[0061] Reference Figure 2 As shown, in some possible embodiments, in step S2, calling the CAD program through ActiveX and COM technology to extract text information from the drawing includes:
[0062] S21. Obtain component object model COM and ActiveX, and open the drawing file selected by the user.
[0063] Adopting Component Object Model (COM) and ActiveX technology, the main CAD program, such as the Application.Documents object of AutoCAD product, is called to open drawings, control CAD software, and realize automatic processing without manual intervention.
[0064] S22. Construct an object filter, the filter including: single-line text (AcadText), multi-line text (AcadMtext), and text of attribute values in enhanced attribute blocks (AcadBlockReference).
[0065] Define a set of filters to identify text objects that need to be translated from CAD drawings. The filters include AcadText (single-line text), AcadMtext (multi-line text), and AcadBlockReference (block reference, which may contain text).
[0066] Specifically, taking Python as an example, the code for building the filter is as follows (other programming languages are similar, all using COM technology):
[0067] 1. The #acad object is the currently running CAD main program instance, which can be obtained through various methods such as function transfer, pyautocad module creation, or win32com.client.Dispatch("AutoCAD.Application")
[0068] 2.#Add a new selection set
[0069] 3.selection_set=acad.ActiveDocument.SelectionSets.Add("WU_HAN_SelectionSet")
[0070] 4.#Build filters based on DXF group codes to select enhanced attribute blocks, single-line text and multi-line text
[0071] 5.filter_type=[0,'INSERT',0,'TEXT',0,'MTEXT']
[0072] 6.filter_data=[8,'ATTRIB',0,'TEXT',0,'MTEXT']
[0073] 7.#Apply Selection Set
[0074] 8.selection_set.Select(5,None,None,filter_type,filter_data)
[0075] 9.#At this point, the selection set includes all single-line and multi-line texts and attribute values of enhanced attribute blocks in the current drawing. The filter is constructed through the above code example.
[0076] S23. Extract text information and attribute information from AcadText, AcadMtext and AcadBlockReference objects in the drawing through the Selection method of ActiveX Object Model.
[0077] Build an object filter and use the Selection method to extract text information and attribute information (including string content, text alignment, font size, color, etc.) from AcadText, AcadMtext, and BlockReference objects in the drawing.
[0078] S24. Build a text list based on the extracted text information and attribute information.
[0079] The extracted text information is stored in a string object array to obtain a string object array.
[0080] Build a string array Array object (VB, C / C++, C# and other programming languages) or a list List object (Jave, Python and other programming languages), hereinafter referred to as "text list"
[0081] This application can efficiently locate text objects in drawings by constructing filters, reduce unnecessary data processing, and then extract text information and attribute information, and construct a text list. The text list is an ordered collection of text information, which is convenient for subsequent processing and analysis.
[0082] Among them, another specific implementation method is to use the component object model (COM) and ActiveX technology, call the CAD main program such as the Application.Documents object of the AutoCAD product to open the drawing, build an object filter, and use the Selection method to extract the text information and attribute information (including string content, text alignment, font size, color, etc.) in the AcadText, AcadMtext and AcadBlockReference objects in the drawing to obtain a multidimensional dictionary list object, that is, a text list.
[0083] In the above embodiment, in step S2, preprocessing includes:
[0084] S25. Process the text list of the component, remove duplicate string elements, and remove items that do not need to be translated according to user-defined removal rules.
[0085] User-defined exclusion rules include: simple numbers or symbol-number combinations, fixed codes, industry-fixed abbreviations, special characters, etc.
[0086] S26, generating a text list to be translated after being eliminated and simplified.
[0087] Specifically, by traversing the text list, processing the objects in the extracted text list, removing duplicate string elements, and removing items that do not need to be translated according to user-defined removal rules, such as numbers, fixed codes, industry-fixed abbreviations, etc., to obtain a streamlined text list. At the same time, check and remove duplicate string elements to ensure the uniqueness and conciseness of the content to be translated, and reorganize the string objects that have been removed and streamlined into a new data structure, which is the text list to be translated.
[0088] This application reduces the burden on the translation server and improves translation efficiency and accuracy by eliminating unnecessary and repeated content. The list of texts to be translated serves as input for subsequent translation processes.
[0089] For example: suppose that the CAD drawing contains the names of some mechanical parts (such as "gear", "bearing"), specifications (such as "diameter 100mm"), and some explanatory texts (such as "installation location"); in step S2, the program will first open the drawing file through COM and ActiveX technology, and then identify and extract these text objects; then, in the preprocessing stage, the program will remove the numerical part such as "100mm" in "diameter 100mm", as well as the fixed codes and industry abbreviations that may exist in the drawing, such as "GB / T"; finally, the program will generate an array of plain text strings that only need to be translated, such as "gear", "bearing", "installation location", etc., which will then be sent to the translation server for translation.
[0090] In some possible embodiments, step S3 includes:
[0091] S31. Send the processed text list to the translation server via the Web-API interface in POST or HTTP access mode.
[0092] S33. The server translates the text list in combination with the user-defined professional dictionary and the fixed translation phrase group.
[0093] Specifically, the processed text list string is sent to the translation server through the Web-API interface in POST or HTTP access mode, and the name of the translation initial language and target language (such as Chinese, English) is sent. Figure 5As shown, the translation page diagram of the present application has multiple target languages, and users can choose according to their needs. The server translates the text list in combination with the user-defined professional dictionary and fixed translation phrase group, and returns it to the user.
[0094] In the above embodiment, one specific implementation method is: the technical details of sending a translation request to the server are taken as an example below using Python language. The principles of other languages or platforms are similar and are not shown separately here.
[0095] The following is a code example of using a function to make a server POST request:
[0096] 1.#Python key step example, the user permission verification process is omitted here
[0097] 2. Import requests 3.
[0099] 4.#Set the URL of the translation API
[0100] 5.url="https: / / example.com / translate" 6.
[0102] 7.#Build request data, including the list of texts to be translated and translation parameters
[0103] 8.data={
[0104] 9. "text_list":["Text to be translated 1","Text to be translated 2"],
[0105] 10. "source_lang":"zh",#The original language of the translation, such as Chinese
[0106] 11. "target_lang":"en",#The target language of translation, such as English
[0107] 12. "user_dict": "custom_dictionary" #User-defined professional vocabulary
[0108] 13.} 14.
[0110] 15.#Sending a POST request
[0111] 16.response=requests.post(url,json=data) 17.
[0113] 18.#Judge whether the request is successful
[0114] 19.if response.status_code==200:
[0115] 20.print("POST request successful, waiting for the server to return the translation result")
[0116] 21.else:
[0117] 22.print(f"POST request failed, status code: {response.status_code}")
[0118] The above example implements the process of sending a translation request to the server.
[0119] Among them, in S33, user-defined professional dictionaries include: professional dictionaries, historical translation optimization experience, corporate standard translation texts, etc. Some of the experience and standard library data are stored on the server side and continuously updated as the corporate knowledge base.
[0120] This application constructs an HTTP request containing a processed text list according to the API documentation provided by the translation server. Use an HTTP client (such as Python's requests library, JavaScript's fetch API, etc.) to send a request to the URL of the translation server. Before sending the translation request, the user interface or configuration link allows the user to select or enter the name of the initial language and the target language, or the initial language detected by the system before and the name of the target language determined by the user, and pass the language name selected by the user as a parameter to the translation request, or explicitly specify it in the request body. After receiving the translation request, the translation server first loads the professional dictionary uploaded or specified by the user, historical translation optimization experience, corporate standard translation text, etc.; finally, the translation engine (such as rule-based, statistical or neural network translation model) is used to translate the text list. During the translation process, the loaded custom dictionary and fixed translation phrase group will be referenced to realize the automated translation process, reduce manual intervention, support the rapid transmission and processing of large-scale text data, and provide more accurate and user-friendly translation results. The translated text list is returned to the client in an appropriate format (such as JSON), which improves the accuracy and professionalism of the translation, especially for the translation of industry-specific terms, reducing ambiguity and misunderstanding in the translation process and dependence on manual labor.
[0121] Specifically, in step S3, the translation server may be a translation server built by the user, or a translation API interface provided by service providers such as DeepL, Google, Youdao, and Baidu Translation.
[0122] Reference Figure 3As shown, in some possible embodiments, in step S4, it includes:
[0123] S41. Obtain the translated text, and display the original text and the translated text in a table form on a user interface for review and revision by the user.
[0124] In step S41, the translation results are processed and visualized in a table. When the server returns the translated text list, the program will display the original text and the translated text in a table in the interface for the user to check one by one.
[0125] An example of a table display is as follows:
[0126]
[0127]
[0128] Through the above sample code, refer to Figure 5 As shown, a list of texts before and after translation is displayed on the customer interface, and users can check and revise the translation results through the interface to ensure that the translated content complies with industry translation practices and national customs.
[0129] S42: Determine whether the user confirms the translated text. If so, the translation result is automatically updated to the drawing. If not, determine that the translated text has been revised and feedback the revised content.
[0130] After the user has checked the translation content, click the "Confirm" button and the program will start the process of updating the translation results to the drawings.
[0131] In some possible embodiments, after S42, the method further includes:
[0132] S43, obtaining revised content based on user feedback;
[0133] S44, feeding back the obtained revised content to the translation server, and updating the translation knowledge base of the server;
[0134] S45, automatically start translation, update the revised content into the translated text, and continue to execute step S41.
[0135] After determining that the user has revisions, the results of the user's revision translation are updated to the drawing, and the revision content is simultaneously uploaded to the server to update the knowledge base and continue with the next drawing task.
[0136] Specifically, after the user confirms the revision, the program will automatically start the process of translating and updating the drawings to ensure that the drawing content is accurate. In addition, the revision content submitted by the user will be recorded by the server and updated to the knowledge base. The server will learn the user's modification, optimize the vocabulary and translation algorithm, and achieve continuous improvement of translation quality, translation results, and continuous update and optimization of the knowledge base.
[0137] Before confirmation, when the user makes changes to the translation content, all the user's revisions will be recorded and fed back to the server to update the server's translation knowledge base.
[0138] The POST request code example for revised feedback is as follows: #Python key step example, where the user permission verification process is omitted.
[0139]
[0140] This application implements user revisions and feedback through the above code examples.
[0141] In some possible embodiments, step S5 includes:
[0142] After the user confirms the translated text, the translation result is automatically updated to the drawing, and it is determined whether the current drawing is the last drawing file. If so, the process ends; if not, the process continues to execute step S1.
[0143] After determining the translated text, the system will then determine whether the drawing file selected by the user is the last drawing file to be translated, and then proceed to the translation process of the next drawing, ensuring that multiple drawings in the drawing file have been translated, thereby achieving the effect of batch translation of drawing files.
[0144] Among them, in this application, one is that if the user selects multiple CAD drawings, the drawing will be judged whether the number of drawings is recorded and compared with the number after translation to achieve batch translation. The other is that when the user selects a real folder or multiple folders, the system will first determine whether there are drawing files to be translated in the folder. If so, the translated files will be selected in order to execute the translation process. If not, it will continue to judge the next folder and execute the translation process.
[0145] Reference Figure 4As shown, in the above embodiment, one specific implementation method is: start executing the task, then obtain the drawing list, open the J+1th drawing, where J is initially 0, build filters including AcadMText, AcadText, and AcadBlockReference, use the Select method of ActiveX to extract specific objects (ObjectArray) in the drawing, and then build a string object array (StringArrayOrg). Before translation, preprocessing is required. The eliminated word library contains user-defined content that does not need to be translated, such as Arabic numerals, customary abbreviations, special characters, etc., obtain the character array (StringArraySim) to be translated after elimination and simplification, and use Post or Ht tp is submitted to the translation server, which includes the user dictionary. The user dictionary includes the user-defined professional dictionary and historical translation optimization experience, corporate standard translation text, etc. The translation result string TranslatedArray is returned, and the translation result is visualized. The user reviews, revises and confirms the translation result. When there is a modification, the modified content is automatically fed back to the translation server and translated again. After the user confirms to keep the original text, the Object.AddMtext method adds the TranslatedArray to the drawing. If there is no confirmation, the translated text is replaced with ObjectArray. The Jth drawing after translation is judged. If it is the last one, the task is terminated. If not, the remaining drawing files are opened to realize batch translation of drawings.
[0146] Among them, the string array Array object (VB, C / C++, C# and other programming languages) or list List object (Jave, Python and other programming languages) are referred to as "text lists"
[0147] The second aspect of the present application provides a CAD drawing batch translation system based on ActiveX and COM technology, including: an acquisition module, a processing module, a translator module, a first judgment module and a second judgment module.
[0148] The acquisition module is used to obtain the CAD drawing file or folder selected by the user.
[0149] The processing module is used to call the CAD program through ActiveX and COM technology, extract the text information in the drawing, and perform preprocessing.
[0150] The translator module is used to obtain the processed text list and the target language name. The translation server in the translator module translates the text list in combination with the user-defined professional dictionary and the fixed translation phrase group.
[0151] The first judgment module is used to visualize the translated text on the user interface and judge whether the user confirms the translated text. If so, the translation result is automatically updated to the drawing. If not, the revised content is fed back.
[0152] The second judgment module is used to judge whether the current drawing file is the last one, and if so, the process ends.
[0153] The present application first determines the CAD drawing file or folder selected by the user through the acquisition module, and then the processing module calls the CAD program through ActiveX and COM technology to extract the text information in the drawing and perform preprocessing to reduce the information that affects the translation during the translation process and improve the translation efficiency; then the translator module translates the processed text list and the target language name through the user-defined professional dictionary and fixed translation phrase group stored in the system, and displays the translation result visually on the user interface, and then determines whether the user confirms the translated text through the first judgment module. If so, the translation result is automatically updated to the drawing, if not, the revision content is fed back, the system records the feedback revision content, and updates the translation library, and updates the final translation result to the drawing in the form of replacing or adding annotation text, and finally determines whether the remaining drawing translation is completed through the second judgment module. After the determination is completed, the operation ends.
[0154] This application solves many defects in traditional drawing translation methods by combining ActiveX and COM technologies, as well as user interaction and revision feedback mechanisms, and realizes batch translation of drawing files and two-way, multi-language automated processing of texts. By collecting and feeding back user revisions to automatic translation results and updating them to the translation server, this process can continuously accumulate translation experience, avoid repeated errors, and form an enterprise-level corpus to achieve continuous improvement in translation quality. This method has strong practicality and broad application prospects.
[0155] The above describes the specific embodiments of the present application. It should be understood that the present application is not limited to the above specific embodiments, and those skilled in the art can make various modifications or variations within the scope of the claims, which does not affect the substantive content of the present application. The above preferred features can be used in any combination without conflicting with each other.
Claims
1. A method for batch translation of CAD drawings based on ActiveX and COM technology, characterized in that: The method comprises the following steps: S1. Obtain the CAD drawing file or folder selected by the user; S2, calling the CAD program through ActiveX and COM technology, extracting the text information in the drawing and performing preprocessing; S3, sending the processed text list and the target language name to the translation server, which translates the text list and returns it in combination with the user-defined professional dictionary and the fixed translation phrase group; S4. Visually display the translated text on the user interface to determine whether the user confirms the translated text. If yes, update the translation result to the drawing; if no, the user revises the translation result and updates it to the drawing, and simultaneously uploads the revised content to the server to update the knowledge base, and proceeds to the next drawing task; S5. Determine whether the current drawing file is the last one. If so, end the process.
2. The method for batch translation of CAD drawings based on ActiveX and COM technology according to claim 1, characterized in that: In step S2, the CAD program is called by ActiveX and COM technology to extract text information from the drawing, including: S21, obtaining component object models COM and ActiveX, and opening the drawing file selected by the user; S22, constructing an object filter, the filter including: single-line text (AcadText), multi-line text (AcadMtext), and text of attribute values in enhanced attribute blocks (AcadBlockReference); S23, extracting text information and attribute information from AcadText, AcadMtext and AcadBlockReference objects in the drawing through the Selection method of ActiveX Object Model; S24. Build a text list based on the extracted text information and attribute information.
3. The method for batch translation of CAD drawings based on ActiveX and COM technology according to claim 2, characterized in that: In step S2, preprocessing includes: S25, processing the assembled text list, removing duplicate string elements, and removing items that do not need to be translated according to user-defined removal rules; The user-defined rejection rules include: simple numbers or a combination of symbols and numbers, fixed codes, fixed industry abbreviations, and special characters; S26, generating a text list to be translated after being eliminated and simplified.
4. The method for batch translation of CAD drawings based on ActiveX and COM technology according to claim 1, characterized in that: In step S3, it includes: S31, sending the processed text list to the translation server through the Web-API interface in POST or HTTP access mode, with additional parameters of the names of the original language and the target translation language; S32. The server translates the text list in combination with the user-defined professional dictionary and the fixed translation phrase group.
5. The method for batch translation of CAD drawings based on ActiveX and COM technology according to claim 4 is characterized in that: In S32, the user-defined professional dictionary includes: a professional dictionary, a translation revision knowledge base of historical user feedback, an enterprise standard translation text base, etc.
6. The method for batch translation of CAD drawings based on ActiveX and COM technology according to claim 1, characterized in that: In step S4, it includes: S41, obtaining the translated text, and displaying the one-to-one correspondence between the original text and the translated text in a table form on a user interface, so that the user can review and revise the text; S42: Determine whether the user confirms the translated text. If so, the translation result is automatically updated to the drawing. If not, determine that the translated text has been revised and feedback the revised content.
7. The method for batch translation of CAD drawings based on ActiveX and COM technology according to claim 6 is characterized in that: After S42, it also includes: S43, obtaining revised content based on user feedback; S44, feeding back the obtained revised content to the translation server, and updating the translation knowledge base of the server; S45, start translation, update the revised content into the translated text, and continue to execute step S41.
8. The method for batch translation of CAD drawings based on ActiveX and COM technology according to claim 1, characterized in that: In step S5, it includes: After the user confirms the translated text, the translation result is automatically updated to the drawing, and it is determined whether the current drawing is the last drawing file. If so, the process ends; if not, the process continues to execute step S1.
9. The method for batch translation of CAD drawings based on ActiveX and COM technology according to claim 1, characterized in that: In step S3, the translation server may be a translation server built by the user, or a translation API interface provided by service providers such as DeepL, Google, Youdao, and Baidu Translation.
10. A CAD drawing batch translation system based on ActiveX and COM technology, characterized in that: include: The acquisition module is used to acquire the CAD drawing file or folder selected by the user; The processing module is used to call the CAD program through ActiveX and COM technology, extract the text information in the drawing, and perform preprocessing; A translator module is used to obtain the processed text list and the target language name. The translation server in the translator module translates the text list in combination with a user-defined professional dictionary and a fixed translation phrase group; The first judgment module is used to visualize the translated text on the user interface and judge whether the user confirms the translated text. If yes, the translation result is automatically updated to the drawing. If no, the revised content is fed back; The second judgment module is used to judge whether the current drawing file is the last one, and if so, the process ends.
Citation Information
Patent Citations
Translation method and device
CN102467498A
CAD drawing translation method
CN110083843A
Translation data processing method, device and equipment and computer readable storage medium
CN110334323A
Methods, devices, and systems for part-to-build
CN110770734A
Multi-language machine translation method for DWG drawing
CN118607538A