Method for endowing self-defined attributes to parts in batches based on Catia secondary development

Through Catia secondary development and Excel table management, batch assignment of custom attributes for parts is realized, which solves the problem of tedious and error-prone addition of part attributes, and improves efficiency and quality.

CN118734433APending Publication Date: 2024-10-01ANHUI JEE AUTOMATION EQUIP CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410730775.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-06
Publication Date
2024-10-01

AI Technical Summary

Technical Problem

When adding custom attributes to parts in Catia software, manual operations are cumbersome and easy to omit or make mistakes. Especially when assigning multiple attributes in batches, it is easy to cause attribute loss due to misoperation.

Method used

Through the secondary development method based on Catia, create a custom attribute list file for parts, read and traverse the part document path list, use attribute names and value lists to assign attributes to part objects in batches, and use Excel tables for attribute value management to achieve batch assignment of parts. Custom attribute functionality.

Benefits of technology

It simplifies the process of adding part attributes, avoids errors and omissions in manual operations, and improves work efficiency and quality. The attribute updates of multiple parts can be completed with one modification.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118734433A_ABST
    Figure CN118734433A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a method for endowing self-defined attributes to parts in batches based on Catia secondary development, and belongs to the technical field of computer application. The method comprises the following steps: creating a part custom attribute list file according to a current to-be-developed part object; acquiring a folder where a part document of the Catia software is located; reading all files in the CATPart format from the folder, and adding the files in the CATPart format into a preset part document path list; reading the attribute name of the part from the part custom attribute list file, and adding the attribute name into a preset attribute name list; reading the attribute value of the part from the self-defined attribute list file of the part, and adding the attribute value into a preset two-dimensional list; and traversing each part document in the part document path list, and searching corresponding attribute information in the attribute name list and the two-dimensional list so as to carry out attribute assignment operation on the part object in each part document. The method is easy to operate, and a secondary development interface of Catia is utilized, so that the function of endowing the parts with the user-defined attributes in batches is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer application technology, and in particular to a method for batch-assigning customized attributes to parts based on Catia secondary development. Background Art

[0002] At present, Dassault's 3D design software Catia has been widely used in tooling design of automotive equipment integrators and surface design of automobiles and aircraft. In the process of automobile production, we often need to give parts additional custom attributes when designing parts, such as brand, surface properties, heat treatment, etc.

[0003] The existing method of adding custom properties to parts requires many steps, and we often need to assign multiple custom properties to a batch of parts. Manual operation will be more cumbersome and very easy to make omissions or errors. In the process of adding custom properties, since the previously added custom properties have been displayed in the property window, the user can easily accidentally touch the "Close" button in the window, resulting in the loss of the previously added properties without knowing it. Summary of the invention

[0004] The purpose of the embodiment of the present invention is to provide a method for batch assigning custom attributes to parts based on Catia secondary development, which solves the problem that manual operation is cumbersome and easy to miss when assigning attributes to part objects in Catia software.

[0005] In order to achieve the above object, an embodiment of the present invention provides a method for batch-assigning customized attributes to parts based on Catia secondary development, the method comprising:

[0006] Optionally, create a part custom attribute list file based on the part object currently to be developed;

[0007] Get the folder where the part documents of Catia software are located;

[0008] Read all CATPart format files from the folder and add them to the preset part document path list;

[0009] Reading the attribute name of the part from the part custom attribute list file and adding it to the preset attribute name list;

[0010] Reading the attribute value of the part from the part custom attribute list file and adding it to the preset two-dimensional list;

[0011] Each part document in the part document path list is traversed, and corresponding attribute information is searched in the attribute name list and the two-dimensional list to perform attribute assignment operation on the part object in each part document.

[0012] Optionally, create a part custom attribute list file based on the part object to be developed, including:

[0013] Get the attribute name, attribute value and specification model value of the part object to be developed;

[0014] Add the attribute name, attribute value and specification model value to a preset Excel attribute table, wherein the value of a single specification model corresponds to multiple attribute values, and the value of a single specification model and the multiple attribute values ​​corresponding to the value of the single specification model are located in the same row;

[0015] Save the attribute table as csv format.

[0016] Optionally, traversing each part document in the part document path list, searching for corresponding attribute information in the attribute name list and the two-dimensional list to perform an attribute assignment operation on the part object in each part document, includes:

[0017] Determine whether the value of the specification model is the same as the name of the part document;

[0018] When it is determined that the value of the specification model is the same as the name of the part document, all attribute values ​​of the row where the value of the specification model is located are assigned to the part object;

[0019] When it is determined that the value of the specification model is not the same as the name of the part document, the row where the value of the specification model is located is skipped.

[0020] Optionally, when it is determined that the value of the specification model is the same as the name of the part document, all attribute values ​​of the row where the value of the specification model is located are assigned to the part object, including:

[0021] Obtain the property interface of the part object;

[0022] Obtain the publishing parameter interface and parameter factory interface from the attribute interface;

[0023] Iterate over the list of attribute names.

[0024] Optionally, the attribute name list is traversed, including:

[0025] Obtaining a list of attribute parameters of the part object through the publishing parameter interface;

[0026] Traverse the attribute parameter list.

[0027] Optionally, traversing the attribute parameter list includes:

[0028] Obtaining the alias of the attribute parameter in the attribute parameter list;

[0029] Get the substring after the last backslash in the alias;

[0030] Determine whether the substring is the same as the attribute name;

[0031] In the case where it is determined that the substring is identical to the attribute name, the publishing parameter interface removes the attribute parameter;

[0032] When it is determined that the substring is not the same as the attribute name, the attribute parameter is skipped.

[0033] Optionally, the attribute name list is traversed, including:

[0034] The parameter factory interface generates attribute parameters according to the attribute values ​​of the row where the value of the specification model is located;

[0035] Add the attribute parameters to the publishing parameter interface.

[0036] Through the above technical scheme, the present invention provides a method for batch assigning custom attributes to parts based on Catia secondary development, by traversing each part document in the part document path list, searching for corresponding attribute information in the attribute name list and the two-dimensional list, so as to assign attributes to the part objects in each part document. The present invention defines attributes for parts in the part custom attribute list file, and then adds multiple custom attributes to the corresponding parts in batches by reading the part custom attribute list file. Compared with the prior art, the present invention is simple to operate, and utilizes the secondary development interface of Catia to realize the function of batch assigning custom attributes to parts. By defining the custom attributes of all part objects in the part custom attribute list file, it is very convenient to check, and when batch modifying, only the table content needs to be modified, and the attribute modification of all part objects can be completed by re-assigning the attributes in batches, so that the possible errors and omissions when adding custom attributes manually can be effectively avoided, which greatly saves time and energy, and effectively improves work efficiency and quality.

[0037] Other features and advantages of the embodiments of the present invention will be described in detail in the subsequent detailed description. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] The accompanying drawings are used to provide a further understanding of the embodiments of the present invention and constitute a part of the specification. Together with the following specific implementations, they are used to explain the embodiments of the present invention, but do not constitute a limitation on the embodiments of the present invention. In the accompanying drawings:

[0039] Figure 1 is a flow chart of a method according to one embodiment of the present invention;

[0040] Figure 2is a flow chart of Catia operation according to one embodiment of the present invention;

[0041] Figure 3 is a flow chart of an attribute assignment operation according to one embodiment of the present invention;

[0042] Figure 4 is a schematic diagram of a user interface according to one embodiment of the present invention;

[0043] Figure 5 is a schematic diagram of a result of an attribute assignment operation according to an embodiment of the present invention;

[0044] Figure 6 is a flowchart of creating a part custom attribute list file according to one embodiment of the present invention;

[0045] Figure 7 is a schematic diagram of a part custom attribute list file according to one embodiment of the present invention;

[0046] Figure 8 is a partial flow chart of a method according to one embodiment of the present invention;

[0047] Fig. 9 is a partial flow chart of a method according to one embodiment of the present invention;

[0048] Fig.10 is a partial flow chart of a method according to one embodiment of the present invention. DETAILED DESCRIPTION

[0049] The specific implementation of the embodiment of the present invention is described in detail below in conjunction with the accompanying drawings. It should be understood that the specific implementation described here is only used to illustrate and explain the embodiment of the present invention, and is not used to limit the embodiment of the present invention.

[0050] Figure 1 is a flow chart of a method according to one embodiment of the present invention, Figure 2 is a flow chart of Catia operation according to one embodiment of the present invention. In this figure, the method includes:

[0051] In step S1, a part custom attribute list file is created according to the part object currently to be developed.

[0052] In step S2, the folder where the part document of Catia software is located is obtained. Figure 3 and Figure 4As shown, the user clicks the folder icon on the right side below the "SAP Standard Parts Folder" window, and a folder selection window will pop up. The user needs to select the folder where the part document to be assigned attributes is located, and then click "OK". The selected folder path will be displayed in the program window.

[0053] In step S3, all files in CATPart format are read from the folder and added to the preset part document path list.

[0054] In step S4, the attribute name of the part is read from the part custom attribute list file and added to the preset attribute name list.

[0055] In step S5, the attribute values ​​of the parts are read from the part custom attribute list file and added to the preset two-dimensional list.

[0056] In step S6, each part document in the part document path list is traversed, and corresponding attribute information is searched in the attribute name list and the two-dimensional list to perform attribute assignment operations on the part objects in each part document.

[0057] In the prior art, when adding custom attributes of part objects in Catia software, it is usually done manually, which requires a lot of time and energy, and is prone to errors and omissions. However, the present invention defines attributes for parts in a part custom attribute list file, and then adds multiple custom attributes to corresponding parts in batches by reading the part custom attribute list file. By defining the custom attributes of all part objects in the part custom attribute list file, it is very convenient to check, and when batch modifying, you only need to modify the table content, and then re-assign the attributes in batches to complete the attribute modification of all part objects. Therefore, it can effectively avoid the errors and omissions that may occur when adding custom attributes manually, greatly saving time and energy, and effectively improving work efficiency and quality.

[0058] In this implementation, the specific steps of creating a part custom attribute list file according to the part object to be developed can be various steps known to those skilled in the art. In one example of the present invention, for example Figure 6 As shown, this step may include:

[0059] In step S11, the attribute name, attribute value and specification model value of the part object to be developed are obtained. Among them, the types of attribute names of the part object to be developed can be various types known to those skilled in the art, such as brand, material and performance level, etc. In a preferred example of the present invention, it can be as follows Figure 7 shown.

[0060] In step S12, the attribute name, attribute value and specification model value are added to a preset Excel attribute table, a single specification model value corresponds to multiple attribute values, and a single specification model value and multiple attribute values ​​corresponding to the single specification model value are located in the same row.

[0061] In step S13, the Excel attribute table is saved as csv format. Figure 4 As shown in the figure, the user clicks the folder icon on the right side of the window "Attribute List CSV File", and a file selection window will pop up. The user needs to select the custom attribute list file of the part in CSV format, and then click "OK", and the selected CSV file path will be displayed in the program window. By using the Excel attribute table to batch assign attribute values, the efficiency of adding custom attributes to parts is improved, and the more parts there are, the more custom attributes to be added, and the higher the relative efficiency improvement.

[0062] In this implementation, the specific steps for assigning attributes to the part objects in each part document may be various steps known to those skilled in the art. In one example of the present invention, for example Figure 8 As shown, it may include:

[0063] In step S61, it is determined whether the value of the specification model is the same as the name of the part document. If it is determined that the value of the specification model is the same as the name of the part document, step S62 is executed, otherwise, step S63 is executed.

[0064] In step S62, all the attribute values ​​of the row where the specification model value is located are assigned to the part object.

[0065] In step S63, the row where the value of the specification model is located is skipped.

[0066] In this embodiment, the detailed steps for assigning different attribute values ​​to a single part object may be various steps known to those skilled in the art. In one example of the present invention, in order to sequentially add attribute values ​​to the custom attributes of the part object, the detailed steps may be as follows: Figure 8 Specifically, it may include:

[0067] In step S64, the property interface of the part object is obtained.

[0068] In step S65, the publishing parameter interface and the parameter factory interface are acquired from the attribute interface.

[0069] In step S66, the attribute name list is traversed.

[0070] In this implementation, considering the need to delete the existing attribute values ​​of the part object in order to re-assign the attribute values, in one example of the present invention, Fig. 9As shown, the method may include the following steps:

[0071] In step S661, the attribute parameter list of the part object is obtained by publishing the parameter interface.

[0072] In step S662, the attribute parameter list is traversed.

[0073] In this implementation, there may be many ways known to those skilled in the art to delete the custom attributes in the part object. In one example of the present invention, for example, Fig.10 As shown, it may include:

[0074] In step S6621, the alias of the attribute parameter in the attribute parameter list is obtained.

[0075] In step S6622, the substring following the last backslash in the alias is obtained.

[0076] In step S6623, it is determined whether the substring is identical to the attribute name. If it is determined that the substring is identical to the attribute name, step S6624 is executed, otherwise, step S6625 is executed.

[0077] In step S6624, the parameter interface is published to remove the attribute parameters.

[0078] In step S6625, the attribute parameter is skipped.

[0079] In this implementation, there may be many ways to add attribute values ​​to the part object known to those skilled in the art. In one example of the present invention, for example Fig. 9 As shown, traversing the attribute name list may include the following steps:

[0080] In step S663, the parameter factory interface generates attribute parameters according to the attribute values ​​of the row where the value of the specification model is located.

[0081] In step S664, the attribute parameters are added to the publishing parameter interface. The present invention realizes the function of batch-assigning custom attributes to parts by utilizing the secondary development interface of Catia.

[0082] Through the above technical scheme, the present invention provides a method for batch assigning custom attributes to parts based on Catia secondary development, by traversing each part document in the part document path list, searching for corresponding attribute information in the attribute name list and the two-dimensional list, so as to assign attributes to the part objects in each part document. The present invention defines attributes for parts in the part custom attribute list file, and then adds multiple custom attributes to the corresponding parts in batches by reading the part custom attribute list file. Compared with the prior art, the present invention is simple to operate, and utilizes the secondary development interface of Catia to realize the function of batch assigning custom attributes to parts. By defining the custom attributes of all part objects in the part custom attribute list file, it is very convenient to check, and when batch modifying, only the table content needs to be modified, and the attribute modification of all part objects can be completed by re-assigning the attributes in batches, so it can effectively avoid the possible errors and omissions when adding custom attributes manually, greatly saving time and energy, and effectively improving work efficiency and quality.

[0083] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0084] The above are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included within the scope of the claims of the present application.

Claims

1. A method for batch-assigning custom attributes to parts based on Catia secondary development. It is characterized in that The method comprises: Create a part custom attribute list file based on the part object currently to be developed; Get the folder where the part documents of Catia software are located; Read all CATPart format files from the folder and add them to the preset part document path list; Reading the attribute name of the part from the part custom attribute list file and adding it to the preset attribute name list; Reading the attribute value of the part from the part custom attribute list file and adding it to the preset two-dimensional list; Each part document in the part document path list is traversed, and corresponding attribute information is searched in the attribute name list and the two-dimensional list to perform attribute assignment operation on the part object in each part document.

2. The method according to claim 1, It is characterized in that Create a custom part attribute list file based on the part object to be developed, including: Get the attribute name, attribute value and specification model value of the part object to be developed; Add the attribute name, attribute value and specification model value to a preset Excel attribute table, wherein the value of a single specification model corresponds to multiple attribute values, and the value of a single specification model and the multiple attribute values ​​corresponding to the value of the single specification model are located in the same row; Save the attribute table as csv format.

3. The method according to claim 2, It is characterized in that Traversing each part document in the part document path list, searching for corresponding attribute information in the attribute name list and the two-dimensional list, so as to assign attributes to the part objects in each part document, including: Determine whether the value of the specification model is the same as the name of the part document; When it is determined that the value of the specification model is the same as the name of the part document, all attribute values ​​of the row where the value of the specification model is located are assigned to the part object; When it is determined that the value of the specification model is not the same as the name of the part document, the row where the value of the specification model is located is skipped.

4. The method according to claim 3, It is characterized in that When it is determined that the value of the specification model is the same as the name of the part document, all attribute values ​​of the row where the value of the specification model is located are assigned to the part object, including: Obtain the property interface of the part object; Obtain the publishing parameter interface and parameter factory interface from the attribute interface; Iterate over the list of attribute names.

5. The method according to claim 4, It is characterized in that Traverse the attribute name list, including: Obtaining a list of attribute parameters of the part object through the publishing parameter interface; Traverse the attribute parameter list.

6. The method according to claim 5, It is characterized in that Traverse the attribute parameter list, including: Obtaining the alias of the attribute parameter in the attribute parameter list; Get the substring after the last backslash in the alias; Determine whether the substring is the same as the attribute name; In the case where it is determined that the substring is identical to the attribute name, the publishing parameter interface removes the attribute parameter; When it is determined that the substring is not the same as the attribute name, the attribute parameter is skipped.

7. The method according to claim 5, It is characterized in that Traverse the attribute name list, including: The parameter factory interface generates attribute parameters according to the attribute values ​​of the row where the value of the specification model is located; Add the attribute parameters to the publishing parameter interface.

Citation Information

Cited By

  • Structural tree batch renaming method based on CATIA V6 secondary development

    CN119645389A