Method for writing translated characters in cad file AI translation
By employing structured parsing and content extraction, AI multi-dimensional classification, and precise attribute binding write-back, the problems of incomplete text extraction and attribute loss in CAD file translation are solved, ensuring the accuracy and format consistency of the translated CAD file, especially the correct display of special symbols.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHENZHEN JIACHEN ARCHITECTURAL DESIGN CO LTD
- Filing Date
- 2026-01-16
- Publication Date
- 2026-04-17
AI Technical Summary
Traditional CAD file translation methods cannot fully and accurately extract text entities and their associated graphic attributes, resulting in information loss, loss or reset of graphic attributes to default values, inability to accurately identify technical text, and failure to correctly display special symbols after translation, affecting the integrity and accuracy of the translation.
Through structured parsing and content extraction, AI multi-dimensional classification and precise attribute binding write-back, text entities and their graphic attributes are identified, and targeted translation and write-back are performed to ensure that attributes are not reset and to handle special symbol encoding.
It achieves completeness and accuracy in text extraction, maintains the consistency and accuracy of the format of the translated CAD file, and improves translation efficiency and the correct display of special symbols.
Smart Images

Figure CN121881995A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of CAD file processing technology, and in particular to a method for writing translated text in AI translation of CAD files. Background Technology
[0002] In the application of CAD file translation, with the development of globalization and international exchanges, communication in industries such as engineering design and industrial product design is becoming increasingly frequent. Accurately translating the text content of CAD files and writing it back to the original file is crucial for the engineering field. Traditional CAD file text processing methods have long been used in this field and can meet basic text translation needs to a certain extent.
[0003] However, with the widespread use of CAD files in different countries and regions, and the increasing demands for translation quality and efficiency, traditional methods are gradually becoming inadequate to meet these new needs. In terms of text extraction and parsing, traditional methods may not be able to fully and accurately extract all text entities and their associated graphic attributes from CAD files, leading to the loss of some information and affecting the integrity and accuracy of the translation. In terms of classification, the lack of AI-based multi-dimensional and precise classification makes it difficult to process different types of text in a targeted manner. For example, it may be unable to accurately identify and properly retain technical text, potentially leading to mistranslation. During text rewriting, traditional methods usually cannot achieve deep binding with the original attributes of CAD entities, easily resulting in the loss or reset of graphic attributes to default values after rewriting, thus damaging the original format and layout of the CAD file. Furthermore, for the processing of special symbols, traditional methods may not be able to effectively solve the problem of incompatibility with the target language encoding system, resulting in special symbols not being displayed correctly after translation.
[0004] To address this issue, we provide a method for writing translated text into AI translation of CAD files. Summary of the Invention
[0005] The purpose of this invention is to provide a method for writing translated text in AI translation of CAD files. By combining structured parsing with content extraction and precise attribute binding for write-back, it solves the problems of incomplete text extraction and loss or reset of graphic attributes during write-back in the prior art.
[0006] To solve the above-mentioned technical problems, the present invention is achieved through the following technical solution: This invention provides a method for writing translated text in AI translation of CAD files, comprising the following steps: S1: Structured parsing and content extraction: Reading the CAD source file, parsing its internal structure, and extracting all text entities and all their associated graphic attributes; S2: AI multi-dimensional content classification: Classifying the extracted text strings by language, entity type association, and technical semantics; S3: Path-based content processing and generation: Translating the text to be translated based on the classification results, while preserving technical text; S4: Precise attribute binding write-back: Writing the processed new text back through the corresponding data channel according to its original entity type, ensuring that it inherits and maintains all associated graphic attributes of the original text entities; S5: Verifying and outputting the translated CAD file.
[0007] The present invention is further configured such that the text entity includes at least single-line text (TEXT), multi-line text (MTEXT), dimension annotation text, leader annotation text, and block attribute definition text; the associated graphic attributes include at least: layer, text style, insertion point coordinates, rotation angle, text height, color, and line type.
[0008] The present invention is further configured such that the entity type association classification specifically involves: identifying whether the text string belongs to free annotation, dimension annotation overlay text, block attribute value, table cell content, or title bar information of the drawing frame, and labeling each type for subsequent steps to differentiate and process.
[0009] The present invention is further configured such that the precise attribute binding write-back further includes: For single-line text (TEXT) and multi-line text (MTEXT) entities, the CAD editing interface is called directly. While modifying their text content, all associated graphic attribute parameters are explicitly locked and passed to ensure that the attributes are not reset to their default values. For dimensioned entities, first determine whether their text content is a manually overridden value; if so, only locate, translate, and replace the natural language prefix / suffix part, while retaining the dimension measurement value and tolerance part; if not, keep its automatically generated measurement value unchanged.
[0010] The present invention is further configured such that, in step S4, for multiline text (MTEXT) entities, a format parsing and reconstruction step is performed before writing back: parsing the format control code in the original MTEXT string, recording the start and end positions and styles of each format paragraph; segmenting the translated text according to semantics, and reapplying the original format control code to the corresponding paragraphs of the new text according to the mapping relationship.
[0011] The present invention is further configured such that, in step S4, for the block attribute definition text, the write-back operation is performed at the level of the block definition (BLOCK), modifying the default value field of its attribute definition (ATTDEF); after modification, the corresponding attribute values in all inserted reference instances (INSERT) of the block are automatically updated, and the attribute hint (Tag) and prompt information remain unchanged.
[0012] The present invention is further configured such that the technical semantic recognition is based on a pre-set industry professional terminology dictionary. When a text string matches a term in the dictionary, it is marked as "non-translated text" or the target language term specified in the dictionary is forced to be used during translation.
[0013] The present invention is further configured such that special symbol encoding verification is included between steps S3 and S4. The steps of special symbol encoding verification are: checking whether the processed text string contains special symbols that are incompatible with the target language encoding system; if so, converting them into equivalent symbols that can be correctly displayed by the target CAD platform or retaining their original Unicode encoding.
[0014] The present invention is further configured such that the method also includes a batch processing mode: for complex CAD files containing multiple layouts and external references (Xrefs), steps S1 to S4 are executed recursively to ensure that the content of all levels in the file is processed.
[0015] A computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of a method for writing translated text in AI translation of a CAD file as described in any one of claims 1 to 9.
[0016] The present invention has the following beneficial effects: 1. This invention, through structured parsing and precise attribute binding write-back process, can comprehensively and accurately extract text and its attributes, and accurately write them back after translation, retaining 100% of all non-text graphic attributes. It effectively solves the problems of incomplete information extraction and attribute loss in traditional methods, ensuring the accuracy and format consistency of the translated CAD file, and meeting the high-quality requirements of CAD file translation in various industries such as engineering and product design.
[0017] 2. This invention clarifies the scope of text and attributes, improving the completeness of processing; precise classification enhances the targeting of processing; special symbol processing ensures display accuracy; batch processing mode improves the efficiency of processing complex files; and computer-readable storage media enables convenient application of the method. Attached Figure Description
[0018] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below.
[0019] Figure 1 This is the main flowchart of a method for writing translated text in AI translation of CAD files; Figure 2 This is the main flowchart of Embodiment 3 of a method for writing translated text in AI translation of CAD files; Figure 3 This is a flowchart of the translation preparation and text matching and processing sub-flowchart of Example 3 in a method for writing translated text in AI translation of CAD files; Figure 4 This is a flowchart illustrating the format intelligent matching and block text differentiation writing sub-process of Example 3 in a method for writing translated text in AI translation of CAD files. Figure 5 This is a flowchart illustrating the exception handling and file saving sub-flow of Example 3 in a method for writing translated text in AI translation of CAD files. Figure 6 This is a screenshot of the working interface for a method of writing translated text into AI translation of CAD files. Figure 7 This is an example of a method for writing the translated text into the original text in an AI translation of a CAD file. Figure 1 ; Figure 8 This is an example of a method for writing translated text into AI translation of CAD files. Figure 1 ; Figure 9 This is an example of a method for writing the translated text into the original text in an AI translation of a CAD file. Figure 2 ; Figure 10 This is an example of a method for writing translated text into AI translation of CAD files. Figure 2 . Detailed Implementation
[0020] The technical solutions of the present invention will be described below with reference to the accompanying drawings. The described embodiments are only some embodiments of the present invention, and not all embodiments.
[0021] Please see Figure 1This invention relates to a method for writing translated text in AI translation of CAD files, comprising the following steps: S1: Structured parsing and content extraction: Reading the CAD source file, parsing its internal structure, extracting all text entities and all associated graphic attributes, where text entities include at least single-line text (TEXT), multi-line text (MTEXT), dimension annotation text, leader annotation text, and block attribute definition text; associated graphic attributes include at least: layer, text style, insertion point coordinates, rotation angle, text height, color, and line type; S2: AI multi-dimensional content classification: Performing language classification, entity type association classification, and technical semantic recognition on the extracted text strings, where the entity type association classification is specifically... The process involves: identifying whether the text string belongs to a free annotation, a dimension overlay, a block attribute value, table cell content, or title block information, and labeling each type for subsequent processing. Technical semantic recognition is based on a pre-built industry-specific terminology dictionary. When a text string matches a term in the dictionary, it is marked as "non-translated text" or the translation is forced to use the target language term specified in the dictionary. S3: Path-specific content processing and generation: Based on the classification results, the text to be translated is translated, while technical text is preserved. This also includes special symbol encoding verification. The special symbol encoding verification steps include checking whether the processed text string contains characters that do not conform to the target language encoding system. Compatible special symbols; if they exist, convert them to equivalent symbols that can be correctly displayed on the target CAD platform or retain their original Unicode encoding; S4: Precise attribute binding write-back: Write back the processed new text according to its original entity type through the corresponding data channel, and make it inherit and retain all associated graphic attributes of the original text entity. Precise attribute binding write-back further includes: for single-line text (TEXT) and multi-line text (MTEXT) entities, directly call the CAD editing interface, modify its text content, and explicitly lock and pass all its associated graphic attribute parameters to ensure that the attributes are not reset to the default value; for dimensioning entities, first determine whether its text content is handwritten. If the value is dynamically covered, then only the natural language prefix / suffix part is located, translated and replaced, while the size measurement value and tolerance part are retained; if not, the automatically generated measurement value remains unchanged. For multiline text (MTEXT) entities, the format parsing and reconstruction steps are performed before writing back: the format control code in the original MTEXT string is parsed, and the start and end positions and styles of each format paragraph are recorded; the translated text is segmented according to semantics, and the original format control code is reapplied to the corresponding paragraphs of the new text according to the mapping relationship. For block attribute definition text, the write-back operation is performed at the level of block definition (BLOCK), and the default value field of its attribute definition (ATTDEF) is modified.After modification, the corresponding attribute values in all inserted reference instances of this block are automatically updated, and the attribute hints (Tag) and prompts remain unchanged; S5: Verify and output the translated CAD file. This method also includes a batch processing mode: for complex CAD files containing multiple layouts and external references (Xref), recursively execute steps S1 to S4 to ensure that all levels of content within the file are processed.
[0022] Through systematic structured analysis, multi-dimensional classification, path-based processing, and precise attribute binding and write-back, a complete and accurate CAD file translation and text write-back process has been established. This method comprehensively solves a series of key problems in the CAD file translation process, from text extraction to write-back. Compared with traditional methods, it can more accurately and completely translate CAD files, and ensure that the format and layout of the translated file are consistent with the original text, greatly improving the usability and accuracy of CAD files in international communication.
[0023] Clearly defining the specific scope of text entities and associated graphic attributes provides a clear framework for subsequent content extraction, processing, and write-back. Comprehensive coverage of various text entities and graphic attributes ensures that no important information is missed during the entire translation and write-back process. Detailed entity type association classification accurately identifies different types of text strings and tags them for subsequent differentiated processing, making the processing of different text types more targeted. Precise attribute binding write-back methods for single-line text (TEXT), multi-line text (MTEXT), and dimension entities ensure that associated graphic attributes are fully preserved when text content is modified. By calling the CAD editing interface and explicitly locking the passed attribute parameters, as well as intelligently judging and processing the dimension annotation text content, the format parsing and reconstruction steps before writing back multi-line text (MTEXT) entities ensure that the translated text is consistent with the original in format. By parsing the original format control code and reapplying it to the translated text paragraphs, the write-back operation is performed at the block definition level for block attribute definition text, ensuring accurate updates of block attribute values and consistency of related prompts. The attribute values of all inserted block reference instances are automatically updated, and the attribute prompts and prompts remain unchanged, improving the accuracy and convenience of block attribute text write-back. Based on the technical semantic recognition of a pre-built industry professional terminology dictionary, it can accurately mark non-translated text or force the use of specified terms for translation, improving the accuracy and standardization of CAD file translation in professional fields. The special symbol encoding verification step effectively solves the problem of special symbol display in the target language encoding system of the processed text. By checking, converting or retaining special symbol encoding, it ensures that special symbols can be correctly displayed in the translated text on the target CAD platform. Batch processing mode provides an efficient processing method for complex CAD files containing multiple layouts and external references. By recursively executing each processing step, it is ensured that all levels of content within the file are processed.
[0024] A computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of a method for writing translated text in AI translation of a CAD file as claimed in any one of claims 1 to 9.
[0025] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more steps in a process.
[0026] Please see Figure 2-5This invention relates to a method for writing translated text in AI translation of CAD files, comprising the following steps: S1: Translation preparation, configuring the translation direction, writing mode, and block names that need to retain the source language, filtering the target text to be written in the CAD file and preprocessing it, the writing mode includes overwriting the original text, appending to the original text, inserting before the original text, and bilingual comparison output, which the user can choose through an interactive interface, text filtering is achieved through mark tags, needtran attributes, and block mark status, excluding text with mark=0, needtran=0, and text within blocks that need to retain the source language, the text preprocessing includes enabling / disabling blank spaces. S1: Filtering and splitting the MText format header and body, extracting plain text content, and recording the original text's position coordinates, style attributes, and formatting tags; S2: Text matching and processing, matching the AI translation result corresponding to the target text, adjusting the translated text format according to the original text's capitalization rules and user configuration, combining text content according to the writing mode, and using a built-in uppercase pattern recognition algorithm to automatically match the original text's capitalization rules, supporting two configuration modes: default first letter capitalization and all uppercase; S3: Intelligent format adaptation, adjusting the height, width factor, and position of the translated text, retaining the original text's formatting tags, and supporting text height adjustment from 0.3 to 1. 0x manual scaling selection and intelligent adaptation mode. The intelligent adaptation mode automatically calculates the optimal height based on the original text height, drawing layout density, and text type. Position optimization is achieved by calculating the insertion point or alignment point of the new text to avoid overlap with the original text and drawing graphics. Users can manually fine-tune the position offset. S4: Differentiated writing of block text. The writing operation is skipped for block text that needs to retain the source language. After the text to be translated within the block is written, it is returned to its original position. S5: Anomaly handling. Corresponding processing logic is executed for anomalies in translation result acquisition, text matching, and format compatibility. Anomaly handling includes: enabling a 3-retry mechanism when translation result acquisition is abnormal, and retry failure... If the translation fails, the abnormal text is recorded and the writing is skipped; if the text matching is abnormal, the original text is retained and marked "untranslated"; if the format compatibility is abnormal, it is automatically replaced with a universal compatible style and the original style information is retained; S6: File saving, write the processed text to a CAD file and save it as a DWG file, generate a translation statistics report, and automatically mark the translation direction and timestamp in the file name when saving the file. The translation statistics report includes the number of translated characters, the number of words, the number of untranslated texts and the number of abnormal texts, and also includes a local caching step: store the mapping relationship between the translated text and the original text in the local dictionary cache, and reuse the cached results when processing similar texts in the future, without having to repeatedly call the AI translation engine.
[0027] Specifically, by integrating multiple key steps such as translation preparation, text processing, format adaptation, differentiated writing, exception handling, and file saving, a series of problems in the text writing process after CAD file translation have been solved.Innovations such as multi-mode writing schemes, block-differentiated writing mechanisms, intelligent format adaptation, multi-level exception handling system, local caching optimization, and case-sensitivity adaptation algorithms effectively improve the diversity of writing functions, drawing integrity, layout aesthetics, process stability, writing efficiency, and the professionalism of translation results. Clearly defined writing modes include overwriting the original text, appending to the original text, inserting before the original text, and bilingual comparison output, with user-selectable options. This meets diverse user needs in different scenarios, making the text presentation of translated CAD files more flexible and solving the problem of the single writing mode in traditional methods. It improves the user experience. Utilizing mark tags, needtran attributes, and block mark status to filter text can accurately exclude text that does not need translation and writing. The text preprocessing system accurately identifies text within blocks that require preservation of the source language, providing a precise text set for subsequent processing. This improves processing efficiency, avoids unnecessary operations, and ensures that critical source language text is not misprocessed. The text preprocessing steps, including enabling / disabling whitespace filtering, separating the MText format header from the main text, extracting plain text content, and recording key information from the original text, provide a clear and standardized data foundation for subsequent text matching, format adjustment, and writing operations. This helps improve the accuracy and consistency of text processing, ensuring that the translated text better integrates into the original CAD file's formatting system. The built-in uppercase pattern recognition algorithm automatically matches the case rules of the original text and supports two configuration modes to ensure that the translated text format remains consistent with the original text. This enhances the uniformity and professionalism of the text style in drawings. Text height adjustment supports manual scaling and intelligent adaptation modes, allowing for flexible height adjustments based on different needs. In particular, the intelligent adaptation mode automatically calculates the optimal height based on multiple factors, solving the problem of unreasonable layout caused by the inability of traditional methods to intelligently adjust text height. This improves the aesthetics and rationality of CAD file layout. Position optimization is achieved by calculating new text insertion points or alignment points, and users can manually fine-tune the position offset, effectively avoiding overlap between translated text and original text or drawing graphics, thus improving the rationality of text layout. It also gives users a certain degree of autonomy in adjustment, meeting the personalized needs of different users for text position. This is particularly relevant for translation result acquisition and text matching. The system employs dedicated handling logic for three types of exceptions: format compatibility, and translation. A multi-level exception handling system ensures stable writing even under various abnormal conditions, reducing the probability of file errors. When saving files, the system automatically marks the translation direction and timestamp in the filename, facilitating user management and traceability. Translation statistics reports provide detailed translation information, helping users understand the overall progress of their translation work and providing data support for subsequent optimization and evaluation. This enhances the convenience of file management and the measurability of the work. The local caching step stores the mapping relationship between the translated text and the original text in a local dictionary cache, reusing translation results of repeated texts. This reduces the frequency of calls to the AI translation engine, effectively improving writing efficiency and lowering computational costs.
[0028] Please see Figure 6-8 In mechanical CAD drawing translation, structured analysis and content extraction were performed: a specially developed parsing program was used to read the mechanical CAD drawing file and deeply analyze its internal structure. All text entities were successfully extracted, including single-line text (TEXT) used to annotate part features in different locations, multi-line text (MTEXT) providing detailed descriptions of the overall assembly process of the part, dimensioning text indicating the length, diameter, and other dimensions of various parts of the part, and block attribute definition text defining the part's material, number, and other attributes. Simultaneously, graphic attributes closely related to these text entities were extracted.
[0029] AI-powered multi-dimensional content classification: Utilizing advanced AI technology, extracted text strings are classified in multiple dimensions. First, language classification is performed, confirming the text is Chinese and requires translation into English. Next, entity type association classification is performed, clearly identifying single-line text as free annotations explaining the design intent of a part's local structure; some dimension annotations are overlay text, supplementing automatically generated dimension annotations; certain block attribute definitions correspond to the part's material attribute values, etc., and each type is tagged accordingly. In the technical semantic recognition stage, based on a pre-built dictionary of mechanical industry terminology, terms such as "gear" and "shaft" are accurately marked as "non-translated text," ensuring consistency and accuracy in terminology.
[0030] Sub-path content processing and generation: Based on the classification results, a professional machine translation engine is called to translate the free annotations, natural language parts of multi-line texts, and other texts that need to be translated.
[0031] Precise property binding write-back: Single-line text (TEXT) and multi-line text (MTEXT) entities: Using the CAD editing interface, while modifying the text content to English translation, all associated graphic attribute parameters are explicitly locked and passed to ensure that the text's layer, text style, insertion point coordinates, rotation angle, text height, color, and line type are not reset to their default values.
[0032] Dimensioning entities: Carefully determine whether the dimension text content is a manually overridden value. If the dimension is an automatically generated measurement value, keep it unchanged.
[0033] Multiline Text (MTEXT) Entity: Format parsing and reconstruction steps are performed before writing back. The format control codes in the original multiline text string are parsed, recording the start and end positions and styles of each formatted paragraph. For example, if a paragraph in the original multiline text uses the "SimSun, 10pt, bold" style, its start and end positions are recorded. The translated English text is segmented semantically, and the original format control codes are reapplied to the corresponding paragraphs in the new text according to the mapping relationship, ensuring that the translated multiline text maintains the same format as the original text.
[0034] Block attribute definition text: Performs a write-back operation at the block definition (BLOCK) level, modifying the default value field of its attribute definition (ATTDEF). For example, if a block attribute definition text is used to represent the material of a part, and the original default value is "aluminum alloy", it is changed to "Aluminumalloy". After the modification, the corresponding attribute values in all inserted reference instances (INSERT) of this block are automatically updated, and the attribute tag and prompt information remain unchanged.
[0035] Special character encoding verification: A thorough check was performed on the processed English text string to verify for special characters incompatible with the target language's encoding system. No such special characters were found, therefore no conversion was required.
[0036] Verify and output the translated CAD file: Perform a comprehensive verification of the written-back CAD file, carefully checking whether the translated English text is accurate, whether the graphic attributes are fully preserved, and whether the dimension annotations are correct. After confirming that there are no errors, output the translated CAD file, completing the translation of the mechanical CAD drawings.
[0037] Please see Figure 6 , Figure 9-10 In industrial production, CAD drawing translation involves structured analysis and content extraction: Professional analysis tools are used to read the CAD drawing file related to the sprinkler system and comprehensively analyze its internal structure. All text entities are extracted, including single-line text (TEXT) annotating sprinkler head functions, multi-line text (MTEXT) detailing pipe connections, dimension text indicating pipe diameters and lengths, and block attribute definition text defining valve types, flow rates, and other attributes. Simultaneously, the graphic attributes associated with these text entities are obtained. For example, layers determine the text's category and display in the drawing, text styles determine its appearance, insertion point coordinates define its position, rotation angles indicate direction, and text height, color, and line type affect its visual effect.
[0038] AI-powered multi-dimensional content classification: Extracted text strings are classified in multiple dimensions using AI technology. First, the language is determined to be Chinese, with the goal of translation into English. Then, entity type association classification is performed, identifying single-line text as free annotations explaining the specific design of the sprinkler head; some multi-line text as title block information, recording basic drawing information; some dimension annotations as overlay text, supplementing pipe dimension annotations; and block attribute definition text corresponding to valve flow attribute values, etc., and assigning corresponding tags to each type of text. During technical semantic recognition, based on a pre-built dictionary of professional terminology for the sprinkler industry, terms such as "spray head" and "valve" are marked as "non-translated text" or forced to use the English terms specified in the dictionary.
[0039] Sub-path content processing and generation: Based on the classification results, translate free annotations, natural language portions of multi-line text, and other texts that need to be translated.
[0040] Precise property binding write-back: Single-line text (TEXT) and multi-line text (MTEXT) entities: With the help of the CAD editing interface, while modifying the text content into English translation, all associated graphic attribute parameters are explicitly locked and passed to ensure that the text's layer, text style, insertion point coordinates, rotation angle, text height, color and line type do not change, and these attributes are still maintained after translation and writing back.
[0041] Dimensioning entity: Determines whether the dimension text content is a manually overridden value. If it is an automatically generated measurement value, it remains unchanged.
[0042] Multiline Text (MTEXT) entity: Before writing back, the original multiline text string is formatted and reconstructed. It records the start and end positions and styles of each formatted paragraph in the original multiline text, segments the translated English text according to semantics, and then applies the original format control codes to the corresponding paragraphs of the new text according to the mapping relationship, so that the format of the translated multiline text is consistent with the original text.
[0043] Block attribute definition text: Write back at the block definition (BLOCK) level to modify the default value field of the attribute definition (ATTDEF). After modification, the corresponding attribute values in all reference instances (INSERT) of this block will be automatically updated, and the attribute tag and prompt information will remain unchanged.
[0044] Special symbol encoding verification: The processed English text string was inspected and found to contain the symbol "℃". Under the target language encoding system, the CAD platform may not display it correctly. Therefore, it was converted to the equivalent symbol "degC" that can be correctly displayed on the target CAD platform, ensuring that special symbols can be displayed correctly.
[0045] Verify and output the translated CAD file: The written-back CAD file undergoes rigorous verification, checking the accuracy of the translated English text, the completeness of graphic attributes, the correctness of dimensioning, and the display of special symbols. Once confirmed to be error-free, the translated CAD file is output, completing the translation of the CAD drawings for the production spray system.
[0046] The preferred embodiments of the present invention disclosed above are only for the purpose of illustrating the present invention. The preferred embodiments do not describe all the details in detail, nor do they limit the invention to the specific implementation described herein. This specification selects and specifically describes these embodiments in order to better explain the principles and practical applications of the present invention, so that those skilled in the art can better understand and utilize the present invention.
Claims
1. A method for writing translated text in AI translation of a cad file, characterized by: Includes the following steps: S1: Structured parsing and content extraction: Read the CAD source file, parse its internal structure, and extract all text entities and all their associated graphic attributes; S2: AI Multi-Dimensional Content Classification: Performing language classification, entity type association classification, and technical semantic recognition on the extracted text strings; S3: Path-specific content processing and generation: Based on the classification results, the text to be translated is translated, while technical text is preserved; S4: Precise attribute binding write-back: The processed new text is written back through the corresponding data channel according to its original entity type, and it inherits and maintains all the associated graphic attributes of the original text entity; S5: Verify and output the translated CAD file.
2. The method of claim 1, wherein the translated text is written in the CAD file AI translation. The text entities include at least single-line text (TEXT), multi-line text (MTEXT), dimension text, leader annotation text, and block attribute definition text; the associated graphic attributes include at least: layer, text style, insertion point coordinates, rotation angle, text height, color, and line type.
3. The method of claim 1, wherein the translated text is written in the CAD file AI translation. The entity type association classification specifically involves: identifying whether the text string belongs to free annotation, dimension annotation overlay text, block attribute value, table cell content, or title bar information of the drawing frame, and labeling each type for subsequent steps to differentiate and process.
4. The method of claim 1, wherein the translated text is written in the CAD file AI translation. The precise attribute-bound writeback further includes: For single-line text (TEXT) and multi-line text (MTEXT) entities, the CAD editing interface is called directly. While modifying their text content, all associated graphic attribute parameters are explicitly locked and passed to ensure that the attributes are not reset to their default values. For dimensioned entities, first determine whether their text content is a manually overridden value; if so, only locate, translate, and replace the natural language prefix / suffix part, while retaining the dimension measurement value and tolerance part; if not, keep its automatically generated measurement value unchanged.
5. The method of claim 1, wherein the translated text is written in the CAD file AI translation. In step S4, for multiline text (MTEXT) entities, a format parsing and reconstruction step is performed before writing back: the format control code in the original MTEXT string is parsed, and the start and end positions and styles of each format paragraph are recorded; the translated text is segmented according to semantics, and the original format control code is reapplied to the corresponding paragraphs of the new text according to the mapping relationship.
6. The method of claim 1, wherein the translated text is written to a file in a format that is compatible with a CAD program. In step S4, for block attribute definition text, the write-back operation is performed at the block definition (BLOCK) level, modifying the default value field of its attribute definition (ATTDEF); after modification, the corresponding attribute values in all inserted reference instances (INSERT) of the block are automatically updated, and the attribute hint (Tag) and prompt information remain unchanged.
7. The method of claim 1, wherein the translated text is written to a file in a format that is compatible with a CAD program. The semantic recognition technology is based on a pre-built industry terminology dictionary. When a text string matches a term in the dictionary, it is marked as "non-translated text" or the target language term specified in the dictionary is forced to be used during translation.
8. The method of claim 1, wherein the translated text is written in the CAD file AI translation. Between steps S3 and S4, there is also a special symbol encoding verification step, which involves checking whether the processed text string contains special symbols that are incompatible with the target language encoding system; if so, converting them into equivalent symbols that can be correctly displayed by the target CAD platform or retaining their original Unicode encoding.
9. The method for writing translated text in AI translation of CAD files according to claim 1, characterized in that: The method also includes a batch processing mode: for complex CAD files containing multiple layouts and external references (Xrefs), steps S1 to S4 are executed recursively to ensure that all levels of content in the file are processed.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by the processor, the program implements the steps of the method for writing translated text in AI translation of CAD files as described in any one of claims 1 to 9.