A part batch automatic labeling method and system based on a CATIA assembly model

By recursively traversing the CATIA assembly model to obtain part instances and reference attributes, selecting and annotating topological surfaces, and synchronously updating 3D and 2D information, the bottleneck of information annotation efficiency and consistency issues in 3D and 2D design environments are solved, achieving efficient information maintenance and synchronous updates.

CN122113184APending Publication Date: 2026-05-29SHANGHAI AVIATION IND GRP CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SHANGHAI AVIATION IND GRP CO LTD
Filing Date
2025-12-29
Publication Date
2026-05-29

AI Technical Summary

Technical Problem

In existing technologies, the information annotation of 3D models and 2D engineering drawings suffers from efficiency bottlenecks and consistency issues. Information maintenance is cumbersome and error-prone. Annotation association is difficult in the context of assembly. There is a lack of bidirectional, linked, and real-time synchronous annotation methods between 3D and 2D design environments.

Method used

By recursively traversing the CATIA assembly model, part instances and reference attribute information are obtained, the topological surface is selected and the center point is located. The annotation function of CATIA is used to realize the batch annotation of the 3D model, and the relevant information is updated synchronously in the 2D engineering drawing to ensure the consistency of 3D and 2D information.

Benefits of technology

It enables the synchronous updating of 3D model attribute information, 3D annotation information, and 2D engineering icon annotation information, reducing the difficulty and tediousness of information annotation and maintenance, and improving design efficiency and reliability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122113184A_ABST
    Figure CN122113184A_ABST
Patent Text Reader

Abstract

The application discloses a kind of based on CATIA assembly model's part batch automatic marking method and system, and the hierarchical analysis of CATIA three-dimensional assembly model is carried out, and the part reference is sequentially obtained for each part instance;Each part reference is traversed, and the part reference attribute information is obtained, the whole topological surface of part reference is obtained, the largest topological surface is selected as the marking topological surface, and the center point of marking topological surface is positioned;Create marking set and determine marking plane, determine three-dimensional marking content text, determine marking position according to center point, enable the marking function of CATIA so that part reference attribute information is batch marked on corresponding marking plane.The application can realize the batch modification of three-dimensional model attribute information, and in the modification process, it is ensured that the attribute information of three-dimensional model, three-dimensional marking information, the marking information of two-dimensional engineering drawing and the marking information in detail column always remain consistent, effectively reduce the work difficulty and tedious degree of information marking maintenance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of digital manufacturing technology in aviation, specifically to a method, system, electronic device, and medium for automatic batch annotation of parts in CATIA assembly models. Background Technology

[0002] With the in-depth development of digital design and manufacturing technologies, product development processes are now fully based on the collaborative use of 3D models and 2D drawings. 3D models (including parts and assemblies) are the core of product definition, containing geometry, assembly relationships, and design parameters. 2D drawings, as the traditional carrier of design and manufacturing instructions, clearly express the product's manufacturing requirements, assembly guidelines, and material information in standardized graphic and annotation formats within the drawing frame, title block, parts list, and various projected views. Both are indispensable in engineering design, process planning, production manufacturing, and quality inspection.

[0003] In current design work, to ensure the accurate transmission of design intent, consistent information labeling is required for the same part or assembly in both 3D models and 2D engineering drawings. This information typically includes part name, drawing number (material code), material, quantity, and version. Specifically, this means setting or labeling attributes in the 3D part model, identifying the part through annotations in each projection view of the 2D engineering drawing, and systematically listing all component information in the Bill of Materials (BOM) of the 2D drawing. Ideally, the information in the labeling of the 3D model, the identification in the 2D view, and the BOM entries should be strictly synchronized and consistent. However, existing technical processes suffer from significant efficiency bottlenecks and consistency issues, such as cumbersome and error-prone information maintenance and difficulties in associating labeling within an assembly context.

[0004] Based on the above problems, the applicant proposes the technical solution of this application. Summary of the Invention

[0005] The purpose of this invention is to provide a method and system for batch automatic annotation of parts in CATIA assembly models, which can realize batch modification of the attribute information of 3D models, and ensure that the attribute information of 3D models, 3D annotation information, annotation information of 2D engineering drawings and annotation information in the details column remain consistent during the modification process, effectively reducing the difficulty and tediousness of information annotation and maintenance.

[0006] To achieve the above objectives, this invention discloses a method for automatic batch annotation of parts based on a CATIA assembly model, comprising the following steps: The CATIA 3D assembly model is hierarchically parsed by recursively traversing the structure tree. All part instances in the CATIA 3D assembly model are collected. For each part instance, the corresponding part reference is obtained in turn. The part instance and part reference are stored in the part instance set and part reference set respectively. Traverse each part reference in the part reference set, obtain the part reference attribute information and all topological surfaces, select the topological surface with the largest area from all topological surfaces as the annotation topological surface, and locate the center point of the annotation topological surface; Create an annotation set and determine the annotation plane. Determine the 3D annotation content text based on the part instance and its corresponding part reference attribute information. Determine the annotation position based on the center point of the annotation topology plane, ensuring that the leader arrow of the annotation text points to the center point of the annotation topology plane. Enable CATIA's annotation function to batch-annotate the part reference attribute information onto the corresponding annotation plane. Preferably, after the part reference attribute information is annotated onto the annotation plane, the method further includes: Iterate through all the projected views in the 2D engineering drawing corresponding to the CATIA assembly model. For each projected view, obtain all the 2D geometric elements in the projected view and the 3D part instances associated with each 2D geometric element. Obtain the corresponding 3D part reference based on the 3D part instances. Two-dimensional geometric elements are classified into the first level according to the three-dimensional part reference. When the three-dimensional part references are the same, they are classified into the second level according to the three-dimensional part instances, and the number of three-dimensional part instances corresponding to the same three-dimensional part reference is counted. For multiple two-dimensional geometric elements in the second-level category, select the longest two-dimensional line segment as the label line segment, and find the center point of the label line segment; The two-dimensional annotation content text is determined based on the three-dimensional part instance corresponding to the annotation line segment and the part reference attribute information of the corresponding three-dimensional part reference. A two-dimensional text annotation guide line is created pointing to the center point of the annotation line segment. The annotation function of CATIA is enabled so that the part reference attribute information is batch-annotated on the corresponding annotation line segment.

[0007] Preferably, after the part reference attribute information is marked on the annotation line segment, the method further includes: When a detail column has been created in a 2D engineering drawing, select the corresponding part reference attribute information according to the detail column format, use the part reference attribute information and the number of corresponding instances as the detail column content text, set the detail column content style, and then complete the detail column content filling.

[0008] Preferably, the text style of the two-dimensional annotation content text is determined according to a preset annotation style configuration table, and the text style of the detail column content text is determined according to a preset detail column style configuration table.

[0009] Preferably, after the part reference attribute information is labeled, the method further includes: A preset two-dimensional prefix string is added to the text of the two-dimensional annotation. When it is necessary to delete two-dimensional annotations in batches, the two-dimensional prefix string is identified and deleted in batches. A preset 3D prefix string is added to the 3D annotation text. When it is necessary to delete 3D annotations in batches, the 3D prefix string is identified and deleted in batches.

[0010] Preferably, before performing hierarchical analysis on the CATIA 3D assembly model, the method further includes: Open the CATIA 3D assembly model, obtain the root node object of the model, and obtain all child node objects under the root node object by recursively traversing. For each child node object whose object type is part, obtain the tree structure node, part instance and part reference of the child node object. Based on the part instance and part reference, retrieve the corresponding part instance attributes and part reference attributes from the structure tree node, integrate the part instance attributes and part reference attributes to form a report and export it; Open and edit the specified column representing the specified attribute content in the report. After editing is complete, import the report into the CATIA 3D assembly model so that the specified attribute content in the CATIA 3D assembly model is updated in batches.

[0011] Preferably, the report is an Excel format file, and the specified column is the item number in the part reference attribute information.

[0012] This invention also discloses a batch automatic part annotation system based on CATIA assembly models, comprising the following modules: The model parsing module is used to perform hierarchical parsing of the CATIA 3D assembly model by recursively traversing the structure tree. It collects all part instances in the CATIA 3D assembly model that have been traversed. For each part instance, it sequentially obtains the part reference corresponding to the part instance and stores the part instance and part reference in the part instance set and part reference set respectively. The annotation surface determination module is used to traverse each part reference in the part reference set, obtain part reference attribute information and all topological surfaces, select the topological surface with the largest area from all topological surfaces as the annotation topological surface, and locate the center point of the annotation topological surface. The annotation text determination module is used to create annotation sets and determine annotation planes. It determines the 3D annotation content text based on part instances and corresponding part reference attribute information, determines the annotation position based on the center point of the annotation topology plane, and makes the leader arrow of the annotation text point to the center point of the annotation topology plane. It enables CATIA's annotation function so that the part reference attribute information is batch-annotated on the corresponding annotation plane.

[0013] The present invention also discloses an electronic device, including one or more processors, a memory, and a computer program, wherein the computer program, when executed by the processor, is used to implement the above-described method for automatic batch annotation of parts based on the CATIA assembly model.

[0014] The present invention also discloses a computer-readable storage medium storing a computer program, which, when executed by a processor, is used to implement the above-described method for automatic batch annotation of parts based on a CATIA assembly model.

[0015] Compared with the prior art, the present invention has the following beneficial effects: The present invention provides a method and system for automatic batch annotation of parts based on CATIA assembly models. It obtains all part instances in the 3D assembly model by hierarchical parsing, then maps the part instances to part references and automatically generates part codes as attribute information. Based on the attribute information of the part references, it selects the annotation topology surface and annotation content text to achieve batch annotation. It also ensures that the attribute information of the 3D model, the 3D annotation information, the annotation information in the 2D engineering drawings, and the information in the details column are consistent. Batch modification effectively reduces the difficulty and tediousness of information annotation and maintenance work.

[0016] The following will further explain the concept, specific structure, and technical effects of the present invention in conjunction with the accompanying drawings, so as to fully understand the purpose, features, and effects of the present invention. Attached Figure Description

[0017] Figure 1 This is a flowchart illustrating the automatic batch annotation method for parts based on the CATIA assembly model in this invention.

[0018] Figure 2 This is a schematic diagram illustrating the model traversal, attribute acquisition and report export, report import, and attribute update based on the CATIA assembly model in this invention.

[0019] Figure 3 This is a 3D batch annotation diagram of the automatic batch annotation method for parts based on the CATIA assembly model in this invention.

[0020] Figure 4This is another 3D batch annotation diagram of the automatic batch annotation method for parts based on the CATIA assembly model in this invention.

[0021] Figure 5 This is a two-dimensional batch annotation diagram of the automatic batch annotation method for parts based on the CATIA assembly model in this invention.

[0022] Figure 6 This is a detailed flowchart of the two-dimensional batch annotation process of the automatic batch annotation method for parts based on the CATIA assembly model in this invention.

[0023] Figure 7 This is a schematic diagram of a two-dimensional single annotation process for the batch automatic annotation method of parts based on the CATIA assembly model in this invention. Detailed Implementation

[0024] To make the technical means, inventive features, objectives, and effects of the invention readily understandable, the invention is further illustrated below with reference to specific figures. However, the invention is not limited to the embodiments described below.

[0025] It should be noted that the structures, proportions, sizes, etc., illustrated in the accompanying drawings of this specification are only used to complement the content disclosed in the specification for those skilled in the art to understand and read, and are not intended to limit the conditions under which the present invention can be implemented. Therefore, they have no substantial technical significance. Any modifications to the structure, changes in the proportions, or adjustments to the size, without affecting the effects and objectives that the present invention can produce, should still fall within the scope of the technical content disclosed in the present invention.

[0026] Significant efficiency bottlenecks and consistency issues exist in the technical processes of 3D part design and assembly design, as well as 2D engineering drawing design for existing aerospace products. For example, information maintenance is cumbersome and error-prone, and annotation association in the assembly context is difficult. The cumbersome and error-prone nature of information maintenance is specifically manifested in complex assemblies containing multiple levels and a large number of parts, where the same part may exist in multiple "instances." Designers need to manually and repeatedly input or assign attributes, add annotations, and fill in detail columns for each part instance in both the 3D assembly environment and the 2D engineering drawing environment. This process is not only time-consuming and labor-intensive, but also highly susceptible to human error, leading to inconsistencies in information about the same part in different locations (3D model, different 2D views, detail columns), such as incorrect drawing numbers or quantity statistical deviations, severely impacting the accuracy of subsequent production preparation. The difficulty in annotation association in the assembly context is specifically manifested in the fact that in the 2D engineering drawings of complex assemblies, the projected outlines of multiple parts often intersect and overlap. Designers must trace back and accurately identify the corresponding specific parts in the 3D model using points and lines in the 2D view, which is extremely difficult and prone to selecting the wrong object. This presents a significant challenge in adding accurate annotations to the correct parts in the correct view location, further reducing annotation efficiency and reliability.

[0027] Currently available automated auxiliary tools have relatively limited and fragmented functions. For example, some tools or plugins can quickly generate part drawing numbers based on rules and batch write them into 3D model attributes; others focus on automatically generating or quickly drawing templates for 2D engineering drawings' frame, title block, and parts list. However, there is a lack of an integrated method that can connect 3D and 2D design environments, enabling bidirectional, linked, and real-time synchronized annotation. Existing technologies cannot achieve continuity between 3D and 2D. For example, after annotating or modifying part information in the 3D model, the associated 2D view annotations and parts list content cannot be automatically updated synchronously. Conversely, after modifying information in the 2D drawing's parts list, the corresponding 3D model attributes and view annotations cannot be automatically synchronized. This lack of a bidirectional synchronization mechanism makes the management cost of design changes high and makes it difficult to guarantee the uniqueness and real-time consistency of data sources across all design platforms. Therefore, there is an urgent need for an innovative technical solution that can overcome the above-mentioned defects and achieve rapid, accurate, bidirectional linkage annotation and synchronous updating of part information between 3D parts / assemblies and 2D engineering drawings, thereby significantly improving design efficiency, eliminating information inconsistency errors, and supporting the continuity and reliability of digital design data throughout the entire product lifecycle.

[0028] The first embodiment of the present invention provides a method for automatic batch annotation of parts based on CATIA assembly models, such as... Figure 1 As shown, when performing batch 3D annotation, it is necessary to first import the model attributes, which includes the following steps: Step SA1: Obtain model attributes.

[0029] Open the CATIA 3D assembly model, obtain the root node object of the model, and obtain all child node objects under the root node object by recursively traversing. For each child node object whose object type is part, obtain the child node's structure tree node, part instance, and part reference.

[0030] Step SA2: Export model properties.

[0031] Based on the part instance and part reference, retrieve the corresponding part instance attributes and part reference attributes from the structure tree node, integrate the part instance attributes and part reference attributes to form a report and export it.

[0032] Step SA3: Batch update attributes.

[0033] Open and edit the specified column representing the specified attribute content in the report. After editing is complete, import the report into the CATIA 3D assembly model so that the specified attribute content in the CATIA 3D assembly model is updated in batches.

[0034] Step SA4: Analyze the 3D assembly model.

[0035] The CATIA 3D assembly model is hierarchically parsed by recursively traversing the structure tree. All part instances in the CATIA 3D assembly model are collected. For each part instance, the corresponding part reference is obtained in turn. The part instance and part reference are stored in the part instance set and part reference set respectively.

[0036] Step SA5: Determine the annotation surface.

[0037] Traverse each part reference in the part reference set, obtain all topological surfaces of the part reference attribute information, select the topological surface with the largest area from all topological surfaces as the annotation topological surface, and locate the center point of the annotation topological surface.

[0038] Step SA6: Determine the annotation text.

[0039] Create a set of annotations and determine the annotation plane. Determine the 3D annotation content text based on the part instance and the corresponding part reference attribute information. The text style of the 3D annotation content text is determined according to the preset annotation style configuration table. Determine the annotation position based on the center point of the annotation topology plane, so that the leader arrow of the annotation text points to the center point of the annotation topology plane. Enable CATIA's annotation function so that the part reference attribute information is batch-annotated on the corresponding annotation plane.

[0040] The above method performs batch annotation within sub-parts. In one example, for easier annotation management, a new annotation part is created. This involves creating and saving a dedicated annotation part under the root node of the assembly or sub-assembly, transforming the batch annotations within each sub-part into unified annotations for the new part. Specifically, the annotation part is created, the structure tree is traversed, and the assembly position matrix (CATMathTransformation) of each instance relative to the root node in the global coordinate system is obtained using the GetAbsPosition method under CATIMovable. Then, the attributes of the instance's corresponding reference, the center point of the maximum topological surface, and the normal are obtained. Next, the assembly position matrix of the instance is multiplied left by the center point and normal of the maximum topological surface of the instance's corresponding reference to solve for the annotation center point and normal in the global coordinate system. Within the annotation part, the annotation center point corresponding to each instance is obtained through step SA5. An annotation set is created under the annotation part, an annotation plane is created based on the points and lines obtained in step SA6, and the attribute information of the instance's corresponding reference is added as the annotation content text.

[0041] Exporting annotated assembly models into lightweight WRL files facilitates the creation of 3D manuals and data distribution between upstream and downstream partners. For CATIA V5, the entire annotated assembly WRL file can be exported directly. For CATIA V6, it's not possible to view all internal annotations of parts at once while the assembly is in progress. Therefore, separate WRL files are exported for each annotated part. Activate the annotated part and export WRL file 1. Activate the assembly root node and export WRL file 2. Merge the two files using a text editor, deleting duplicate descriptions to generate the lightweight annotated assembly WRL file. It should be noted that 3D annotation can be refined to each part reference; or it can be uniformly converted and annotated in a certain part for centralized management.

[0042] CATIA offers two environment versions: V5 and V6. In CATIA V5's assembly environment, you can view the annotation information of all parts in the structure tree, as well as the geometry of the entire assembly and the annotation information of all parts in the 3D view. It can also generate lightweight WRL files for easy 3D illustration creation. In CATIA V6's assembly environment, while you can view the annotation information of all parts in the structure tree, you can only view the geometry of the entire assembly and the annotation information of the instance corresponding to the currently active flexible part reference in the 3D view. You cannot view the annotations of all parts in the entire assembly. The attribute information of all parts in an assembly is annotated in the same annotation model under the assembly node. Activating this part allows you to view all annotations for that assembly, but you cannot export a lightweight assembly file (WRL) with annotations all at once.

[0043] For batch annotation, attribute export and import are required. First, the assembly model in CATIA V5 or V6 is parsed, recursively searching for all part instances and obtaining the corresponding references. The instance name, reference name, and part code or project number are stored in three columns in an Excel report at a specified path. Instance names and reference names are derived from the model; instance names are unique, while reference names may be duplicated. Part codes or project numbers are automatically generated. If Arabic numerals are used as part codes, different instance names and reference names will have different codes, while different instance names and the same reference name will have the same code. If the user needs to modify attribute information, the part code can be modified in the report column. After modification, the part code will be added to the description attribute of the part reference. If further modifications are needed, a previous report can be used, or the report can be exported first (i.e., obtaining the model instance name, reference name, and existing part code), filled into the report, and then modified by the user before importing, thus completing the batch update of part attribute information. Since the same reference corresponds to multiple instances, when batch modifying annotations, only the attribute information needs to be added once in the description of the reference.

[0044] After modifying the attributes, 3D annotation can begin. For 3D annotation of parts, the assembly model in CATIA V5 or V6 first needs to be parsed, recursively searching for all part instances and obtaining the corresponding references. All unique part references are obtained, and for each part reference, all bodies under its 3DShape are retrieved. The topological faces of all bodies are then identified, and the topological face with the largest area is found. Its center point and the normal at the center point are obtained for use in 3D annotation. For each part, 3D annotation involves: first, creating an annotation set; second, creating an annotation plane; third, creating annotation content such as part code text within the annotation plane; and finally, adjusting the position and style of the annotations. Annotation planes can be created using the same plane, such as the XY plane, YZ plane, or XZ plane; alternatively, each part can create its own plane, such as using the center point of the plane and the normal at that point to construct a plane. The annotation position can be an arrow pointing to the center point of the plane, with text positioned at a certain distance (45° to the lower right). Annotation text styles, such as font color, border presence and color, and font size, can be uniformly set in the configuration file for easy user modification.

[0045] like Figure 2 As shown, the steps in the attribute export and import process are as follows: The first step is to open the assembly or subassembly in CATIA V6 and obtain the root node of the structure tree. Specifically, use the GetOrCreateRootOccurrence method in the CATIPrdOccurrenceMngt interface to obtain the CATIPLMNavOccurrence of the root node.

[0046] The second step is to recursively obtain all child nodes under the root node. Specifically, this involves using a recursive method to obtain the CAIPLMNavOccurrence of all child nodes under the root node CAIPLMNavOccurrence.

[0047] The third step is to obtain the instance CATIPLMNavInstance of each child node using the GetRelatedInstance method in the interface, and obtain its reference CATIPLMNavReference using the GetRelatedReference method in the interface.

[0048] The fourth step is to use ListChildren to obtain the list of direct child nodes of each child node, which is the PLMCoreRepInstance type instance corresponding to 3DShape. If the number is not 0, it is determined to be a part; if the number is 0, it is determined to be a product.

[0049] Store the corresponding CATIPLMNavOccurrence, CATIPLMNavInstance, and CATIPLMNavReference for all parts in an array. In this list, CATIPLMNavOccurrence and CATIPLMNavInstance are unique, while CATIPLMNavReference is not unique.

[0050] The unique references CAIPLMNavReference, along with the corresponding multiple instances CAIPLMNavInstance and multiple CAIPLMNavOccurrence, are used as the second array.

[0051] Fifth, using the second array as the main element, employ the interface. CATCkeObjectAttrReadServices::GetValueAsString retrieves the content of multiple attributes for each CATIPLMNavReference, such as part number, structure name, and project number. The attribute names can be configured in the XML configuration table according to user needs. They can be basic attributes of the model or attributes that the user extends in the model.

[0052] Step 6: Count the number of different instances corresponding to the same reference and write the count into a column of the report.

[0053] Step 7: Export the referenced part numbers, names, item numbers, quantities, etc., to an Excel report in the specified path.

[0054] Step 8: The user modifies the item number in the Excel report and saves it, then imports the report.

[0055] It should be noted that steps one through four are repeated until unique references are obtained. After the report is imported, the contents of the updated Excel report are read, and the corresponding new project number is obtained based on the reference name. The specified attribute content, such as the project number, of each CATIPLMNavReference is rewritten using the method CATCkeObjectAttrWriteServices::SetValueWithString, thus completing the batch attribute update.

[0056] like Figure 3 As shown, the steps in the batch annotation process are as follows: The first step, steps one through four of the batch update of duplicate attributes, is to obtain non-duplicate references.

[0057] The second step is to obtain the attribute information of each reference, such as the project number, which is used as the content element for annotation.

[0058] The third step is to obtain the 3D shape instance CATIPLMNavRepInstance and the 3D shape reference CATIPLMNavRepReference for each reference; then obtain the mechanical modeling container CATIMMiPrtContainer from the 3D shape reference, and use the interface methods in the mechanical modeler such as CATIPLartRequest and CATIBodyRequest to obtain all the geometry under the 3D shape.

[0059] The fourth step is to use the CATIMeasurableVolume method to measure the volume of all geometries and obtain the geometry with the largest volume.

[0060] The fifth step involves obtaining the geometric feature CATBody from the mechanical features of the geometry. Using the GetAllCells method in the geometry modeler, all topological faces of the geometry are obtained. The area of ​​all topological faces is measured using the CATIMeasurableSurface method, and the largest face is obtained. The center point of the face is obtained using the GetCOG method. The normal direction at the center of the largest face is calculated using the CATCGMCreateTopLineOperatorNormalToShell method in the geometry modeler. Points and directions serve as the basic elements for constructing the annotation plane.

[0061] Step 6: For each reference, use the GetSet or RetrieveOrCreateCurrentTPSSet methods in CATITPSServicesContainers to obtain or create the annotation set CATITPSSet; Step 7: Obtain the TPS view factory CATITPSViewFactory based on the annotation set, and create the annotation view CATITPSView based on the points and directions obtained in step 5 (or a uniform direction can be specified).

[0062] Step 8: Use CreateTextOnGeometry in the CATITPSFactoryAdvanced to create a text annotation CATITPSText. The leader line of the text annotation points to the center point in step 5, and the annotation content is the item number in step 2.

[0063] Step 9: Read the annotation styles in the configuration file, including but not limited to font, color, font size, whether a text box is needed and the text box color, etc., and use the text property interface CATIDrwTextProperties to set the properties of the annotation text CATITPSText.

[0064] Step 10: For the 3D annotated views and 3D annotated text created by the program, you can add a prefix such as PrjNumb3D_ to make it easier for the program to recognize them.

[0065] Step 11: Update the parts.

[0066] Step 12: For each part reference in the assembly or subassembly, repeat the process from Step 1 to Step 11 to complete the batch annotation within each sub-part.

[0067] like Figure 4 As shown, when generating annotations with a single click by creating a new 3D annotated part, the following steps are also included: Step 13: Under the root node of an assembly or subassembly, create a new part specifically for annotation and save it, converting the batch annotations within each sub-part into a unified annotation for the new part.

[0068] Step 14: Traverse the tree structure and obtain the assembly position matrix CATMathTransformation of each instance relative to the root node using the GetAbsPosition method under CATIMovable.

[0069] Step 15: Multiply the assembly position matrix of the instance by the center point and normal of the maximum topological surface corresponding to the instance, and solve for the annotation center point and normal in the global coordinate system.

[0070] Step 16: In the annotated part, create the annotation center point corresponding to each instance obtained in the previous step, create an annotation set, create an annotation plane based on the points and lines obtained in the previous step, and add the attribute information of the instance's corresponding reference as annotation content.

[0071] Step 17: Activate the annotated part and export WRL file 1; activate the assembly root node and export WRL file 2. Merge the two files using a text editor, and delete duplicate file descriptions to generate a lightweight annotated assembly file WRL.

[0072] This method is an alternative to manual annotation. Manual 3D annotation requires manually creating annotation planes, selecting the location for annotation text creation (which must be related to the 3D model), finding the annotation content, and setting the style for each annotation item. The operation is cumbersome and cannot guarantee that everything will be correct.

[0073] One example also includes batch deletion of 3D annotations, as follows: The first step is to repeat steps one through four of the model attribute export and import process to obtain unique references.

[0074] The second step is to use the GetSet method in CATITPSServicesContainers to obtain the annotation set CATITPSSet for each reference.

[0075] The third step is to obtain the set of annotation views and the set of annotation text in the annotation set using the GetViews and GetTPS methods in CATITPSSet.

[0076] The fourth step is to retrieve the names of the elements in the collection one by one, check if their prefix is ​​PrjNumb3D_, and if so, delete them using the Delete method in DataCommonProtocolServices.

[0077] Fifth, repeat steps one through four for each reference.

[0078] It should be noted that if the part attributes are updated in batches or re-imported, you can use the batch deletion function to delete the already created 3D annotation planes and annotation text, and then automatically batch generate the 3D annotations for the model again.

[0079] In one example, after the part reference attribute information is annotated on the annotation plane, two-dimensional annotation is also required, such as... Figure 5 As shown, two-dimensional annotation includes the following steps: Step SS1: Obtain the projected view elements and their associated properties.

[0080] Iterate through all the projected views in the 2D engineering drawing corresponding to the CATIA assembly model. For each projected view, obtain all the 2D geometric elements in the projected view and the 3D part instances associated with each 2D geometric element. Obtain the corresponding 3D part reference based on the 3D part instances. Step SS2: Categorize the associated attributes of view elements.

[0081] Two-dimensional geometric elements are classified into the first level according to the three-dimensional part reference. When the three-dimensional part references are the same, they are classified into the second level according to the three-dimensional part instances, and the number of three-dimensional part instances corresponding to the same three-dimensional part reference is counted.

[0082] Step SS3: Determine the marked line segments.

[0083] For multiple two-dimensional geometric elements in the second-level category, select the longest two-dimensional line segment as the label line segment, and find the center point of the label line segment; Step SS4: Determine the annotation text.

[0084] The two-dimensional annotation content text is determined based on the three-dimensional part instance corresponding to the annotation line segment and the part reference attribute information of the corresponding three-dimensional part reference. A two-dimensional text annotation guide line is created pointing to the center point of the annotation line segment. The annotation function of CATIA is enabled so that the part reference attribute information is batch-annotated on the corresponding annotation line segment.

[0085] In one example, after the part reference attribute information is annotated on the annotation line segment, the details column also needs to be annotated. That is, when the details column has been created in the 2D engineering drawing, the corresponding part reference attribute information is selected according to the details column format, the part reference attribute information is used as the details column content text, the details column content style is set, and then the details column content is filled in. The text style of the 2D annotation content text is determined according to the preset annotation style configuration table, and the text style of the details column content text is determined according to the preset details column style configuration table.

[0086] like Figure 6 As shown, the specific implementation steps for two-dimensional batch annotation are as follows: The first step is to select all projected views in a single 2D annotation drawing, or to annotate an active projected view sequentially.

[0087] The second step is to obtain the currently active view, CATIDftView, through get_ActiveObject in CATIAEditor.

[0088] The third step is to obtain the application extension interface CATIDftGenGeomAccess of the view through GetApplicativeExtension in CATIDftView, and then obtain the collection of all two-dimensional geometric elements generated by the projection (such as the collection of lines that constitute the two-dimensional projection) through the GetAllGeneratedItems method of the interface. For each two-dimensional geometric element, the 3D shape instance is obtained by using the GetRepInstance method of the CATIDftGenGeom interface, and then the part instance corresponding to the 3D shape instance is obtained according to the context. With the part instance, the part reference and attributes, such as the item number, can be obtained.

[0089] The fourth step involves assigning a corresponding instance number and reference number to each 2D projection line in the view. Assuming the annotation represents a minimal subassembly, instance numbers are globally unique, while reference numbers may be duplicated. The 2D projection lines are then categorized by reference number to obtain set one. Under the same reference, they are further categorized by different instances to obtain set two, and the number of instances is counted.

[0090] The fifth step is to measure the length of each object in set two, i.e., the multiple two-dimensional line segments corresponding to different instances of the same reference, find the longest side, and find the midpoint.

[0091] Step 6: Use CATIDftBaseAnnotationFactory to create two-dimensional text annotations, the content of which is the referenced attribute, such as the item number.

[0092] Step 7: Use CATIDftElementWithLeader to create guide lines for the 2D text annotations. One end of the guide line points to the midpoint in step 5, and the other end points to the lower left anchor point of the annotation text. The same text code has one reference, and there are as many guide lines as there are instances.

[0093] Step 8: Compare the positions of several midpoints, select the point with the middle coordinate value as a reference for the text position, determine the direction of the guide line based on the position of this point relative to the center of the view, and adjust the position of the text.

[0094] Step 9: Read the annotation styles in the configuration file, including but not limited to font, color, font size, whether a text box is needed and the text box color, etc., and use the text property interface CATIDrwTextProperties to set the properties of the annotation text CATIDftText.

[0095] Step 10: For the two-dimensional labeled text created by the program, you can add a prefix such as PrjNumb2D_ to make it easier for the program to recognize.

[0096] Step 11: Repeat steps 2 through 10 above to batch annotate multiple views in the engineering drawing.

[0097] Step 12: Update the view or the entire drawing; the new annotations will then appear in the view or drawing.

[0098] One example also includes batch deletion of two-dimensional annotations, as follows: The first step is to annotate all the projected views in the engineering drawing at once in two dimensions, or to annotate an active projected view one by one in sequence.

[0099] The second step is to obtain the currently active view, CATIDftView, through get_ActiveObject in CATIAEditor.

[0100] The third step is to obtain GetComponents of type CATIDftText through the above view CATIDftView, which contains all the annotation text.

[0101] The fourth step is to obtain the name of the labeled text. If it has the prefix PrjNumb2D_, then delete it in batches. The deletion method used is Delete in DataCommonProtocolServices.

[0102] It should be noted that if the part attributes are updated or re-imported, you can use the batch delete method to delete the already created 2D annotation text, and then automatically generate new 2D annotations in batches.

[0103] In one example, when a user needs to perform a single 2D annotation, such as Figure 7 As shown, this can be done through the following steps: The first step is to click on the 2D projection line segment that needs to be annotated in the current view. This will automatically obtain the 3D shape associated with the projection line, the parent node of the 3D shape, the part instance, and then obtain the part reference from the part instance. The attribute content that needs to be annotated can then be obtained from the reference.

[0104] The second step is to measure the selected two-dimensional projection line segment and obtain its midpoint.

[0105] Third, click on the blank space next to the selected line segment to use as the bottom left anchor point of the text.

[0106] The fourth step is to automatically create a two-dimensional annotation text in the clicked blank space, with the content being reference attribute information such as the project number.

[0107] Fifth, add a text guide line pointing to the center point, and set the style according to the configuration table.

[0108] Step 6: Rename the text by adding the prefix PrjNumb2D_ to unify all two-dimensional annotations.

[0109] Step 7: Update the view or the entire drawing.

[0110] For example, attribute export and import involves parsing the assembly model in CATIA V5 or V6, recursively searching for all part instances, obtaining the corresponding references for each instance, and creating an Excel report with the instance name, reference name, and automatically generated part number in three columns. This report can be exported to a specified path. Instance names and reference names are obtained from parsing the assembly model. Instance names are unique, while reference names may be duplicated. The part number, also known as the item number, is automatically generated, such as using Arabic numerals. In the Excel report, rows with different instance names and different reference names correspond to different part numbers, while rows with different instance names and the same reference name correspond to the same part number. After exporting to Excel, the content of the column containing the part number can be modified. After modification, the part number will be added to the description attribute of the part reference in the assembly model. If modifications are made after importing, the previously exported report can be modified and then imported again. Alternatively, a new report can be exported first (i.e., obtaining the instance name, reference name, and existing part number of the model), then modified, and finally imported to batch update part attribute information. When there are multiple instances of the same reference, you only need to add the attribute information once in the description of the reference.

[0111] The 3D annotation of a part first involves parsing the assembly model in CATIA V5 or V6, recursively searching for all part instances, obtaining the corresponding references for each instance, and recording the instance name, reference name, part code, or project number. All unique part references are then obtained. For each part reference, all bodies under its 3DShape are retrieved, and the topological faces of all bodies are obtained. The topological face with the largest area is found, and its center point and the normal at the center point are obtained for use in 3D annotation.

[0112] To perform 3D annotation on each part, the process involves first creating an annotation set, then creating an annotation plane, followed by creating annotation content such as part designation text within the annotation plane, and finally adjusting the position and style of the annotations. Annotation planes can be created using the same plane, such as the XY plane, YZ plane, or XZ plane; alternatively, each part can have its own plane, such as using the center point and the normal at that point to construct a plane. The annotation position is indicated by arrows pointing to the center point, with text positioned at a certain distance (45° to the lower right). Annotation text styles, such as font color, border presence and color, and font size, can be uniformly configured in a configuration file for easy user modification.

[0113] The 2D annotation and detail column entry for engineering drawings offer two modes: traversing all views in the drawing and retrieving the currently active view. The former can annotate all views, while the latter can only annotate the current view. For a given view, all lines are retrieved, and then the associated 3D part instances are obtained. All lines are categorized into first-level classes based on instance number. The parts corresponding to different references for different instances are retrieved, and then the corresponding reference for each instance is retrieved. Based on the first-level classification, the second-level classification curves corresponding to parts with the same reference but different instances are found. For each group of second-level classification curves, the longest edge in the curve corresponding to each instance is found, and the midpoint of the edge is obtained. For the same reference, N instances will have N longest edges and N midpoints. A 2D annotation is created, containing attribute information from the part reference, such as part code and number of instances. N leader lines are created, each pointing to one of the N midpoints. The position and style of the 2D annotation can also be adjusted. For annotation positions, first calculate the center point of the view. Divide the view into four quadrants with the center point as the origin. Determine which quadrant the midpoint falls into. For the first quadrant, the text position is calculated by increasing both the x-coordinate and y-coordinate by the same value from the midpoint. For the second quadrant, the text position is calculated by decreasing the x-coordinate and increasing the y-coordinate by the same value from the midpoint. For the third quadrant, both the x-coordinate and y-coordinate are decreased by the same value from the midpoint. For the fourth quadrant, the text position is calculated by increasing the x-coordinate and decreasing the y-coordinate by the same value from the midpoint. Annotation text styles, such as font color, border presence and color, and font size, can be uniformly configured in the configuration file for easy user modification.

[0114] The generation of individual 2D annotations is designed to allow users to more flexibly adjust the entire engineering drawing page. By selecting a 2D projection line segment in a view, the system first automatically obtains the corresponding 3D part instance information and reference information, and then obtains the attribute information. Users only need to click the mouse twice to automatically fill the annotation attribute content in the specified position. The annotation style is also set according to the configuration file. Based on the corresponding instance, information such as weight, quantity, part number, part code, and remarks can be entered into the details column.

[0115] The update mechanism for 2D and 3D is similar. A special prefix such as "PrjNumb3D_" or "PrjNumb2D_" is added to the names of the created 3D views, 3D annotations, 2D annotations, 2D detail column text, and attribute tabs. Before one-click annotation, you can traverse the related 2D and 3D views and annotation objects. If this prefix exists, it will be deleted and then re-annotated.

[0116] This embodiment significantly improves the efficiency and quality of annotation and drawing output by quickly exporting and importing attribute information of 3D models, such as part codes, and enabling rapid batch automatic annotation and updating of attribute information in 3D models, as well as in 2D engineering drawings. It also allows for single quick annotation of attribute information in 2D engineering drawings. This saves labor costs. Unified 3D and 2D annotations facilitate multi-angle viewing of the model and provide an update function, eliminating the tedious process of deleting old annotations. One-click updates of attributes, 3D annotations, and 2D annotations are possible. Single quick 2D annotations allow users to selectively add annotations to individual models across multiple views, enabling more flexible adjustments to the entire engineering drawing. The style configuration of annotation placement makes the overall drawing more aesthetically pleasing.

[0117] The second embodiment of the present invention provides a batch automatic annotation system for parts based on CATIA assembly models, including a model parsing module, an annotation surface determination module, and an annotation text determination module.

[0118] The model parsing module is used to perform hierarchical parsing of the CATIA 3D assembly model by recursively traversing the structure tree. It collects all part instances in the CATIA 3D assembly model that have been traversed. For each part instance, it sequentially obtains the part reference corresponding to the part instance and stores the part instance and part reference in the part instance set and part reference set respectively. The annotation surface determination module is used to traverse each part reference in the part reference set, obtain part reference attribute information and all topological surfaces, select the topological surface with the largest area from all topological surfaces as the annotation topological surface, and locate the center point of the annotation topological surface. The annotation text determination module is used to create annotation sets and determine annotation planes. It determines the 3D annotation content text based on the part instance and the corresponding part reference attribute information, and determines the annotation position based on the center point of the annotation topology plane, so that the leader arrow of the annotation text points to the center point of the annotation topology plane. It enables CATIA's annotation function so that the part reference attribute information is batch-annotated on the corresponding annotation plane.

[0119] Since the first embodiment corresponds to this embodiment, this embodiment can be implemented in conjunction with the first embodiment. The relevant technical details mentioned in the first embodiment remain valid in this embodiment, and the technical effects achievable in the first embodiment can also be achieved in this embodiment. To reduce repetition, they will not be repeated here. Correspondingly, the relevant technical details mentioned in this embodiment can also be applied to the first embodiment.

[0120] A third embodiment of the present invention provides an electronic device, including a processor, a memory, and a computer program, wherein the computer program, when executed by the processor, is used to implement the method described in the first embodiment.

[0121] A fourth embodiment of the present invention provides a computer-readable storage medium storing a computer program, which, when executed by a processor, is used to implement the method described in the first embodiment.

[0122] The preferred embodiments of the present invention have been described in detail above. It should be understood that those skilled in the art can make numerous modifications and variations based on the concept of the present invention without creative effort. Therefore, all technical solutions that can be obtained by those skilled in the art based on the concept of the present invention through logical analysis, reasoning, or limited experimentation on the basis of existing technology should be within the scope of protection defined by the claims.

Claims

1. A method for batch automatic annotation of parts based on CATIA assembly models, characterized in that, Includes the following steps: The CATIA 3D assembly model is hierarchically parsed by recursively traversing the structure tree. All part instances in the CATIA 3D assembly model are collected. For each part instance, the corresponding part reference is obtained in turn. The part instance and part reference are stored in the part instance set and part reference set respectively. Traverse each part reference in the part reference set, obtain the part reference attribute information and all topological surfaces, select the topological surface with the largest area from all topological surfaces as the annotation topological surface, and locate the center point of the annotation topological surface; Create a set of annotations and determine the annotation plane. Determine the 3D annotation content text based on the part instance and the corresponding part reference attribute information. Determine the annotation position based on the center point of the annotation topology plane, so that the leader arrow of the annotation text points to the center point of the annotation topology plane. Enable CATIA's annotation function so that the part reference attribute information is batch-annotated on the corresponding annotation plane.

2. The method for batch automatic annotation of parts based on CATIA assembly model according to claim 1, characterized in that, After the part reference attribute information is annotated on the annotation plane, the method further includes: Iterate through all the projected views in the 2D engineering drawing corresponding to the CATIA assembly model. For each projected view, obtain all the 2D geometric elements in the projected view and the 3D part instances associated with each 2D geometric element. Obtain the corresponding 3D part reference based on the 3D part instances. Two-dimensional geometric elements are classified into the first level according to the three-dimensional part reference. When the three-dimensional part references are the same, they are classified into the second level according to the three-dimensional part instances, and the number of three-dimensional part instances corresponding to the same three-dimensional part reference is counted. For multiple two-dimensional geometric elements in the second-level category, select the longest two-dimensional line segment as the label line segment, and find the center point of the label line segment; The two-dimensional annotation content text is determined based on the three-dimensional part instance corresponding to the annotation line segment and the part reference attribute information of the corresponding three-dimensional part reference. A two-dimensional text annotation guide line is created pointing to the center point of the annotation line segment. The annotation function of CATIA is enabled so that the part reference attribute information is batch-annotated on the corresponding annotation line segment.

3. The method for batch automatic annotation of parts based on CATIA assembly model according to claim 2, characterized in that, After the part reference attribute information is annotated on the annotation line segment, the method further includes: When a detail column has been created in a 2D engineering drawing, select the corresponding part reference attribute information according to the detail column format, use the part reference attribute information and the number of corresponding instances as the detail column content text, set the detail column content style, and then complete the detail column content filling.

4. The method for batch automatic annotation of parts based on CATIA assembly model according to claim 3, characterized in that, The text style of the two-dimensional annotation content text is determined according to a preset annotation style configuration table, and the text style of the detail column content text is determined according to a preset detail column style configuration table.

5. The method for batch automatic annotation of parts based on CATIA assembly model according to claim 2, characterized in that, After the part reference attribute information is annotated, the method further includes: A preset two-dimensional prefix string is added to the two-dimensional annotation content text. When it is necessary to delete two-dimensional annotations in batches, the two-dimensional prefix string is identified and deleted in batches. A preset 3D prefix string is added to the 3D annotation text. When it is necessary to delete 3D annotations in batches, the 3D prefix string is identified and deleted in batches.

6. The method for batch automatic annotation of parts based on CATIA assembly model according to claim 1, characterized in that, Before performing hierarchical parsing on the CATIA 3D assembly model, the method further includes: Open the CATIA 3D assembly model, obtain the root node object of the model, and obtain all child node objects under the root node object by recursively traversing. For each child node object whose object type is part, obtain the tree structure node, part instance and part reference of the child node object. Based on the part instance and part reference, retrieve the corresponding part instance attributes and part reference attributes from the structure tree node, integrate the part instance attributes and part reference attributes to form a report and export it; Open and edit the specified column representing the specified attribute content in the report. After editing is complete, import the report into the CATIA 3D assembly model so that the specified attribute content in the CATIA 3D assembly model is updated in batches.

7. The method for batch automatic annotation of parts based on CATIA assembly model according to claim 6, characterized in that, The report is an Excel file, and the specified column is the item number in the part reference attribute information.

8. A batch automatic part annotation system based on CATIA assembly models, characterized in that, Includes the following modules: The model parsing module is used to perform hierarchical parsing of the CATIA 3D assembly model by recursively traversing the structure tree. It collects all part instances in the CATIA 3D assembly model that have been traversed. For each part instance, it sequentially obtains the part reference corresponding to the part instance and stores the part instance and part reference in the part instance set and part reference set respectively. The annotation surface determination module is used to traverse each part reference in the part reference set, obtain part reference attribute information and all topological surfaces, select the topological surface with the largest area from all topological surfaces as the annotation topological surface, and locate the center point of the annotation topological surface. The annotation text determination module is used to create annotation sets and determine annotation planes. It determines the 3D annotation content text based on part instances and corresponding part reference attribute information, determines the annotation position based on the center point of the annotation topology plane, and makes the leader arrow of the annotation text point to the center point of the annotation topology plane. It enables CATIA's annotation function so that the part reference attribute information is batch-annotated on the corresponding annotation plane.

9. An electronic device, characterized in that, It includes one or more processors, a memory, and a computer program, which, when executed by the processor, is used to implement the automatic batch annotation method for parts based on the CATIA assembly model as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, which, when executed by a processor, is used to implement the automatic batch annotation method for parts based on the CATIA assembly model as described in any one of claims 1 to 7.