A method of batch renaming structure tree based on secondary development of CATIA V6
Through the structure tree batch renaming method based on CATIA V6 secondary development, the time-consuming and laborious problem of manually modifying object names in large-scale design projects is solved, and efficient batch modification of object names in structure trees is achieved, which improves design efficiency and quality.
Patent Information
- Application Number
- CN202510176659.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-18
- Publication Date
- 2025-05-02
- Estimated Expiration
- 2045-02-18
AI Technical Summary
In large-scale design projects, manually modifying a large number of object names in the structure tree is time-consuming and labor-intensive, affecting design efficiency and quality.
Through the structure tree batch renaming method based on CATIA V6 secondary development, CATIA's CAA component library is used to batch modify the object names in the structure tree, reducing the workload of manual operations by users.
This greatly reduces the burden of designers on manually renaming objects in the structure tree when handling large-scale design projects, improves the consistency and accuracy of naming, thereby improving the overall quality and efficiency of the design.
Smart Images

Figure CN119645389B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of CATIA three-dimensional modeling, and in particular relates to a structure tree batch renaming method based on CATIA V6 secondary development. Background Art
[0002] CATIA V6 is a 3D CAD / CAM / CAE (Computer-Aided Design, Computer-Aided Engineering, Computer-Aided Engineering / Computer-Aided Manufacturing) software. In recent years, it has been widely used in aerospace, automobile manufacturing, shipbuilding and machinery fields.
[0003] However, as the design project becomes increasingly large, the number of components in the view increases sharply. At this time, it is time-consuming and laborious to rename a large number of object names in the structure tree. The present invention uses the CAA (ComponentApplication Architecture) component library of CATIA itself for secondary development. In order to solve the above problems, a structure tree batch renaming method based on CATIA V6 secondary development is proposed, which strives to reduce the workload of users manually modifying the object names in the structure tree in large design projects, so as to improve the overall quality and efficiency of the design. Summary of the invention
[0004] The purpose of the present invention is to provide a structure tree batch renaming method based on CATIA V6 secondary development, which solves the problem of time-consuming and labor-intensive manual modification of a large number of object names in the structure tree.
[0005] The technical solution adopted by the present invention is: a structure tree batch renaming method based on CATIA V6 secondary development, comprising the following steps:
[0006] Step 1. Activate the rename function in the 3D view and select the component to be renamed;
[0007] Step 2: Select the filtering method and filtering type of the components to be renamed, and display the path information of the objects that meet the filtering conditions in the toolbar of the renaming workspace;
[0008] Step 3: In the Prefix, Name, and Suffix text boxes, define a unified prefix, name, and suffix text for the objects in the renaming workspace, concatenate the prefix, name, and suffix text to form a new name for the object and display it in the renaming workspace;
[0009] Step 4: Get the corresponding component in the 3D view by renaming the path information of the object in the workspace, and then set a new name for the object in the workspace according to the selected filtering method and filtering type.
[0010] The present invention is also characterized in that:
[0011] In step 1, after activating the rename function in the 3D view, define the global pointer of the CATPathElementAgent interface to point to the component to be renamed, and highlight the component by calling the GetHSO function of the CATFrmEditor interface, use the PathElementString function of the CCallTemplatesCommonFun interface to obtain the path information of the component, and then store the path information of the selected one or more components in the CATLISTP list of the global pointer CATPathElement interface, store the object information of the selected one or more components in the CATLISTV list of the global pointer CATBaseUnknown_var interface, and finally traverse the CATLISTP list of the global pointer CATPathElement interface and display the path information in the component toolbar through the SetLine function of the CATDlgSelectorList interface.
[0012] In step 1, if you need to delete the selected component to be renamed, first get the index of the component to be deleted through the GetSelect function of the CATDlgSelectorList interface, then delete the component corresponding to the index in the component toolbar through the ClearLine function, and at the same time delete the path and object information of the selected component in the CATLISTP list of the CATPathElement interface and the CATLISTV list of the CATBaseUnknown_var interface through the RemovePosition function.
[0013] The filtering methods in step 2 include "Rename only the selected object" or "Rename the selected object and its sub-objects".
[0014] If "Rename only selected objects" is selected in step 2, first determine whether the component to be renamed is a physical product. If the component to be renamed can be converted to a non-empty CATIPLMNavOccurrence_var type value, it is a physical product, otherwise it is not a physical product. If it is a physical product, determine and record the check status of the two filter types "Reference-Title" and "Instance-Title", and then display the path information of the component to be renamed in the toolbar of the renaming workspace. If it is not a physical product, obtain the type of the component to be renamed through the IsA function of the GetImpl function, and display the path information of the component to be renamed in the toolbar of the renaming workspace.
[0015] If you select "Rename only the selected object" in step 2 and the component to be renamed is a physical product, then step 4 is specifically: obtain the "Reference-Title" and "Instance-Title" objects of the physical product through the GetRelatedReference and GetRelatedInstance functions of the CATIPLMNavOccurrence_var interface respectively, and then modify the "V_Name" and "Name" properties of the object respectively through the SetValueWithString function of the CATCkeObjectAttrWriteServices interface to realize the renaming of the "Reference-Title" and "Instance-Title".
[0016] If "Rename only the selected object" is selected in step 2 and the component to be renamed is not a physical product, then step 4 is specifically as follows: first determine whether the component to be renamed is of the "MechanicalPart" or "VPMRepOccurrence" type; if it is of the "MechanicalPart" or "VPMRepOccurrence" type, convert the component type through the CATPLMComponentInterfacesServices interface and the CATIPLMNavRepReference_var interface in turn, and then call the SetValueWithString method of the CATCkeObjectAttrWriteServices class to modify the "V_Name" attribute of the current component to rename the current component; if it is not a "MechanicalPart" and is of the "VPMRepOccurrence" type, rename the object in the renaming workspace corresponding to the component through the SetAlias function of the CATIAlias_var interface.
[0017] If you select "Rename selected objects and sub-objects" in step 2, perform the following steps:
[0018] Step 2.1, obtain the component type of the selected component to be renamed through the IsA function of the GetImpl function. If it is empty, "geometry component" or "geometry component under the root product", go to step 2.2; if it is "geometry tool set", go to step 2.3; if it is "geometry graphics set", go to step 2.4; if it is a non-basic type, that is, "translation", "rotation", "symmetry", "scaling", "mapping", "positioning transformation", go to step 2.5; if it is a basic type, that is, "point", "line", "surface", "envelope", "UDF", go to step 2.6;
[0019] Step 2.2, obtain all geometric feature objects under the component to be renamed through the GetAllBodies function of the CATIPartRequest_var interface. If the geometric feature object is a "geometry tool set", go to step 2.3; if the geometric feature object is a "geometry graphics set", go to step 2.4; if the geometric feature object is a non-basic type, go to step 2.5; if the geometric feature object is a basic type, go to step 2.6;
[0020] Step 2.3, obtain the subcomponent of the component to be renamed through the Item function of the CATIAShapes_var interface, and convert it into a CATIABase_var type object to obtain all geometric feature objects under the geometric tool set. If the geometric feature object is a "geometry set", go to step 2.4; if the geometric feature object is a non-basic type, go to step 2.5; if the geometric feature object is a basic type, go to step 2.6;
[0021] Step 2.4, obtain all geometric feature objects under the geometric graphics set through the GetMechanicalFeatures function. If the geometric feature object is a non-basic type, go to step 2.5; if the geometric feature object is a basic type, go to step 2.6;
[0022] Step 2.5, use the IID_CATIMeasurablePoint interface, IID_CATIMeasurableLine interface, IID_CATIMeasurablePlane interface and IID_CATIMeasurableVolume interface in sequence to convert the component to be renamed into one of the basic types "point", "line", "surface", "envelope" and "UDF", and then go to step 2.6;
[0023] Step 2.6. Use the AddAnalyseNotificationCB function to monitor the check status of the five filter types of "point", "line", "surface", "envelope" and "UDF" of each object, and set the parameter of the SetState function of the CATDlgCheckButton interface to CATDlgCheck or CATDlgUncheck to check or cancel the filter type. For objects with the checked filter type, record the operation type as "Insert" and make corresponding records based on the checked filter type. Finally, display the path information in the component toolbar in the toolbar of the rename workspace and store it in the CATLISTV list of the global pointer CATBaseUnknown_var interface.
[0024] When the filter type is canceled in step 2.6, the operation type is recorded as "Delete" for the object whose filter type is canceled, the corresponding path information displayed in the toolbar of the renaming workspace is canceled, and the corresponding path information stored in the CATLISTV list of the global pointer CATBaseUnknown_var interface is deleted.
[0025] If you select "Rename selected objects and sub-objects" in step 2, step 4 is as follows: rename the objects of the selected filter type through the SetAlias function.
[0026] The beneficial effects of the present invention are as follows: the structure tree batch renaming method based on CATIA V6 secondary development of the present invention can batch modify the object names in the structure tree, greatly reducing the heavy burden of designers manually renaming objects in the structure tree when dealing with large-scale design projects, and greatly improving the overall quality and efficiency of the design by improving the consistency and accuracy of naming. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] Figure 1 It is a flow chart of a structure tree batch renaming method based on CATIA V6 secondary development of the present invention;
[0028] Figure 2 It is a user function interface schematic diagram when the structure tree batch renaming method of the present invention is applied based on the secondary development of CATIA V6. DETAILED DESCRIPTION
[0029] The present invention is described in detail below with reference to the accompanying drawings and specific embodiments.
[0030] Example 1
[0031] The present invention provides a structure tree batch renaming method based on CATIA V6 secondary development, comprising the following steps:
[0032] Step 1. Activate the rename function in the 3D view and select the component to be renamed.
[0033] Step 2: Select the filtering method and filtering type for the components to be renamed, and display the path information of the objects that meet the filtering conditions in the toolbar of the renaming workspace.
[0034] Step 3. In the Prefix, Name, and Suffix text boxes, define a unified prefix, name, and suffix text for the objects in the renaming workspace, concatenate the prefix, name, and suffix text to form a new name for the object and display it in the renaming workspace.
[0035] Step 4: Get the corresponding component in the 3D view by renaming the path information of the object in the workspace, and then set a new name for the object in the workspace according to the selected filtering method and filtering type.
[0036] Example 2
[0037] The present invention provides a structure tree batch renaming method based on CATIA V6 secondary development. On the basis of embodiment 1, after activating the renaming function in a three-dimensional view in step 1, a global pointer of a CATPathElementAgent interface can be defined to point to a component to be renamed, and the component is highlighted by calling the GetHSO function of a CATFrmEditor interface, and the path information of the component is obtained by using the PathElementString function of a CCallTemplatesCommonFun interface, and then the path information of one or more selected components is stored in a CATLISTP list of a global pointer CATPathElement interface, and the object information of one or more selected components is stored in a CATLISTV list of a global pointer CATBaseUnknown_var interface, and finally the CATLISTP list of a global pointer CATPathElement interface is traversed and the path information is displayed in a component toolbar by using the SetLine function of a CATDlgSelectorList interface.
[0038] If you need to delete the selected component to be renamed, first get the index of the component to be deleted through the GetSelect function of the CATDlgSelectorList interface, then delete the component corresponding to the index in the component toolbar through the ClearLine function, and at the same time delete the path and object information of the selected component in the CATLISTP list of the CATPathElement interface and the CATLISTV list of the CATBaseUnknown_var interface through the RemovePosition function.
[0039] Example 3
[0040] The present invention provides a structure tree batch renaming method based on CATIA V6 secondary development. Based on Example 1, the screening method in step 2 may include "renaming only the selected object" or "renaming the selected object and sub-objects".
[0041] If "Rename only selected objects" is selected, first determine whether the component to be renamed is a physical product. The judgment method is: if the component to be renamed can be converted to a non-empty CATIPLMNavOccurrence_var type value, it is a physical product, otherwise it is not a physical product. If it is a physical product, determine and record the check status of the two filter types "Reference-Title" and "Instance-Title", and then display the path information of the component to be renamed in the toolbar of the renaming workspace; if it is not a physical product, obtain the type of the component to be renamed through the IsA function of the GetImpl function, and display the path information of the component to be renamed in the toolbar of the renaming workspace.
[0042] If you select Rename Selected Object and Sub-Objects, perform the following steps:
[0043] Step 2.1, get the component type of the selected component to be renamed through the IsA function of the GetImpl function. If it is empty, "MechanicalPart" (geometric part, geometric feature type in CATIA V6) or "VPMRepOccurrence" (geometric part under the root product, geometric feature type in CATIA V6), go to step 2.2; if it is "MechanicalTool" (geometric tool set, geometric feature type in CATIA V6), go to step 2.3; if it is "GSMTool" (geometric graphics set, geometric feature type in CATIA V6), go to step 2.4; if it is a non-basic type, that is, "GSMTranslate" (translation, geometric feature type in CATIA V6), "GSMRotate" (rotation, geometric feature type in CATIA V6), "GSMSymmetry" (symmetry, geometric feature type in CATIA V6), "GSMScaling" (scaling, geometric feature type in CATIA V6), "GSMAffinity" (mapping, CATIA If it is a basic type, i.e., "point", "line", "surface", "volume", or "UDF", go to step 2.6.
[0044] Step 2.2, obtain all geometric feature objects under the component to be renamed through the GetAllBodies function of the CATIPartRequest_var interface. If the geometric feature object is a "geometry tool set", go to step 2.3; if the geometric feature object is a "geometry graphics set", go to step 2.4; if the geometric feature object is a non-basic type, go to step 2.5; if the geometric feature object is a basic type, go to step 2.6.
[0045] Step 2.3, obtain the subcomponent of the component to be renamed through the Item function of the CATIAShapes_var interface, and convert it into a CATIABase_var type object to obtain all geometric feature objects under the geometric tool set. If the geometric feature object is a "geometry set", go to step 2.4; if the geometric feature object is a non-basic type, go to step 2.5; if the geometric feature object is a basic type, go to step 2.6.
[0046] Step 2.4: Get all geometric feature objects under the geometric set through the GetMechanicalFeatures function. If the geometric feature object is a non-basic type, go to step 2.5; if the geometric feature object is a basic type, go to step 2.6.
[0047] Step 2.5: Use the IID_CATIMeasurablePoint interface, IID_CATIMeasurableLine interface, IID_CATIMeasurablePlane interface, and IID_CATIMeasurableVolume interface in sequence to convert the component to be renamed into one of the basic types "point", "line", "surface", "envelope", and "UDF", and then proceed to step 2.6.
[0048] Step 2.6, monitor the check status of the five filter types of "point", "line", "surface", "envelope" and "UDF" of each object through the AddAnalyseNotificationCB function, and set the parameter of the SetState function of the CATDlgCheckButton interface to CATDlgCheck or CATDlgUncheck to check or cancel the filter type, record the operation type as "Insert" for the objects of the checked filter type, and make corresponding records of "GSMPoint" (point, geometric feature type in CATIA V6), "GSMLine" (line, geometric feature type in CATIA V6), "GSMPlane" (surface, geometric feature type in CATIA V6), "GSMExtrude" (envelope, geometric feature type in CATIA V6), and "UdfFeature" (UDF, geometric feature type in CATIA V6) according to the checked filter type, and finally display the path information in the component toolbar in the toolbar of the renamed workspace and store it in the CATLISTV list of the global pointer CATBaseUnknown_var interface.
[0049] When the filter type is canceled in step 2.6, the operation type is recorded as "Delete" for the object whose filter type is canceled, the corresponding path information displayed in the toolbar of the renaming workspace is canceled, and the corresponding path information stored in the CATLISTV list of the global pointer CATBaseUnknown_var interface is deleted.
[0050] Example 4
[0051] The present invention provides a structure tree batch renaming method based on CATIA V6 secondary development. On the basis of Example 3, if "rename only the selected objects" is selected in step 2 and the component to be renamed is a physical product, then step 4 can specifically be: respectively obtain the "reference-title" and "instance-title" objects of the physical product through the GetRelatedReference and GetRelatedInstance functions of the CATIPLMNavOccurrence_var interface, and then respectively modify the "V_Name" and "Name" attributes of the object through the SetValueWithString function of the CATCkeObjectAttrWriteServices interface to realize the renaming of the "reference-title" and "instance-title".
[0052] If "Rename only the selected object" is selected in step 2 and the component to be renamed is not a physical product, step 4 can be specifically as follows: first determine whether the component to be renamed is of the "MechanicalPart" or "VPMRepOccurrence" type; if it is of the "MechanicalPart" or "VPMRepOccurrence" type, convert the component type through the CATPLMComponentInterfacesServices interface and the CATIPLMNavRepReference_var interface in turn, and then call the SetValueWithString method of the CATCkeObjectAttrWriteServices class to modify the "V_Name" attribute of the current component to rename the current component; if it is not a "MechanicalPart" and is of the "VPMRepOccurrence" type, rename the object in the renaming workspace corresponding to the component through the SetAlias function of the CATIAlias_var interface.
[0053] If "Rename selected objects and sub-objects" is selected in step 2, step 4 may specifically be: rename the objects of the selected filter type through the SetAlias function.
[0054] Example 5
[0055] The invention provides a structure tree batch renaming method based on CATIA V6 secondary development. The secondary development is carried out through the CAA component library of CATIA itself. The user first activates the renaming function in a three-dimensional view, and then selects one or more components to be renamed in the structure tree. Then the user selects the filtering mode of the renamed object (including two modes of "renaming only the selected object" and "renaming the selected object and sub-objects") and the filtering type (wherein the physical product filtering includes two modes of "reference-title" and "instance-title", and the named object filtering includes five types of points, lines, surfaces, envelopes and UDF) as required, and then customizes new names for the named objects by adding prefixes, suffixes, serial numbers and the like, and then executes the "preview name" function to generate user-defined new names of the renamed objects in a renaming workspace. If the new names meet the user's requirements, the "apply modification" function is executed to modify the corresponding object names in the structure tree.
[0056] Example 6
[0057] The present invention provides a structure tree batch renaming method based on CATIA V6 secondary development. Based on Example 5, Figure 1 and Figure 2 As shown, the preferred technical route is as follows:
[0058] 1. Activate the rename function and select the component
[0059] After activating the rename function in the 3D view, the system will first define a global pointer, which is used to point to the component to be selected. With this global pointer, the system can obtain the path and object information of the component. Then, the system will highlight the component in the 3D view so that the user can clearly see which component is currently selected. At the same time, the system will also display the complete path information of this component in the toolbar for users to view and manage.
[0060] If the user needs to select multiple components, this can be achieved by clicking the "Add Component" button. After clicking this button, the system will perform a series of logical judgments. Specifically, the system will obtain the component path information that has been displayed in the toolbar and compare it with the path information of the currently selected component. If it is found that the path information of the current component is not displayed in the toolbar, the system will add this new path information to the toolbar to ensure that the user can see the paths of all selected components. At the same time, the system will also store the path and object information of the currently selected component for subsequent use.
[0061] If the user needs to delete a component that has been displayed in the toolbar, he can click the "Delete Component" button. After that, the system will first obtain the index value of the component to be deleted in the toolbar. Then, the system will use this index to call the corresponding method to delete the corresponding component path information in the toolbar. At the same time, the system will also remove the relevant information of the component from the stored path and object information based on this index to ensure the accuracy and consistency of the data.
[0062] 2. Filter object type
[0063] This step provides two filtering methods: "Rename selected objects only" and "Rename selected objects and sub-objects".
[0064] If the user only needs to rename the selected object, the "Rename only selected object" function can be selected. The system will traverse the component list displayed in the component selection toolbar, obtain the path information of these components, and re-display this information in the toolbar of the renaming workspace. If the selected component contains a physical product type, the user is required to check the physical product filter type (including "Reference-Title" and "Instance-Title") to facilitate the subsequent renaming operation of the program.
[0065] If the user needs to rename the selected object and sub-objects, the user is required to check different filter types (including points, lines, surfaces, envelopes, and UDFs). The user can select one or more filter types as needed. The system will save the filter type selected by the user and start traversing the selected components. During the traversal process, the system will compare the object type of each component with the filter type selected by the user one by one to see if they are consistent. If they are consistent, the system will display the path information of the component in the toolbar of the renaming workspace. Next, the system will loop through the sub-objects of the component. During the traversal of the sub-objects, the system will also compare the type of each sub-object with the filter type selected by the user one by one to see if they are consistent. If they are consistent, the system will also display the path information of the sub-object in the toolbar of the renaming workspace.
[0066] If the user unchecks a filter type, the system will record this operation and delete the object path information related to the filter type in the toolbar of the rename workspace. At the same time, the system will also remove the relevant information of these objects from the storage objects to ensure data accuracy and consistency.
[0067] 3. Batch define object names
[0068] This step provides a variety of functions to help users customize object names in batches. In the Prefix, Name, and Suffix text boxes, users can set the prefix, name, and suffix text for objects in the renaming workspace.
[0069] Through the "Add Sequence Number" function, combined with the corresponding text box of the sequence number setting, users can add sequence numbers to objects. The sequence number will be replaced by "[C]" at the beginning, and will be replaced according to the actual sequence number when previewing the name later. In this way, users can add sequential numbers to objects as needed.
[0070] At the same time, the present invention provides a "current name" function, whereby the user can quickly restore the content in the name text box to "[N]" with one click, and then replace it with the original name when previewing the name, so that the user can quickly return to the initial name when modifying the name.
[0071] If the user needs to delete a specific object in the rename workspace, the "Remove Object" function can be used. After activating this function, the system will delete the corresponding object in the rename workspace according to the object index selected by the user, and remove the component information corresponding to the object from the storage object.
[0072] In addition, the present invention also provides a "clear list" function. Clicking this function can clear all objects in the rename workspace, restore the workspace to its initial state, and facilitate the user to perform a new rename operation.
[0073] Finally, through the "Preview Name" function, the system will concatenate the prefix, name, and suffix text to form the new name of the object and display it in the renaming workspace. In this way, users can intuitively see the effect of the new name of each object. If the user is not satisfied with the new name, they can redefine it in this step.
[0074] 4. Batch modify the names in the structure tree
[0075] In this step, after the user clicks "Apply Changes", the program will first check whether the new name of the object in the rename workspace is empty. If it is empty, the system will prompt the user to preview the name first.
[0076] If the user selects the "Rename only selected objects" filter method, the system will further determine the type of each selected object. If the object contains a physical product type, the system will prompt the user to select the physical product filter type and handle the renaming of the reference-title and instance-title separately. The specific method is: find the corresponding component in the 3D view through the path information of the object in the renaming workspace. Then, depending on whether the user has checked the reference-title and instance-title, set the new name in the renaming workspace to the reference-title or instance-title of the corresponding component. If the object is not a physical product, the system will directly set a new name for the object in the renaming workspace.
[0077] If the user selects "Rename selected objects and sub-objects", the system will judge based on the type of component. If the component is a basic type, such as point, line, surface, envelope or UDF, and these types are selected in the previously saved filter type, the system will find the corresponding component in the 3D view and rename it by renaming the object path information in the workspace.
[0078] If the component is a transformation type, such as translation, rotation, symmetry, scaling, mapping, or positioning transformation, the system will first convert these component types to basic types and then process them according to the renaming logic of the basic types.
[0079] If the component type is a geometry set or geometry tool set, the system will first obtain all the geometry features under the component, and then determine the type of each geometry feature one by one. Depending on whether the geometry feature is a basic type or a conversion type, the system will refer to the previous logic to perform the corresponding renaming operation.
[0080] If the component type is a 3D shape, the system will first obtain the geometry set and geometry tool set under the component, and then further obtain all the geometric features under these sets. Next, the system will determine the type of each geometric feature one by one, and perform the corresponding renaming operation based on its basic type or conversion type, referring to the previous logic. At this point, the renaming function of the structure tree is completed.
[0081] Through the above-mentioned method, the structure tree batch renaming method based on the secondary development of CATIA V6 of the present invention is characterized in that:
[0082] 1. Based on the secondary development of CAA component library of CATIA V6, the proposed structure tree batch renaming method can greatly reduce the workload of users to manually modify the object names in the structure tree in large design projects.
[0083] 2. Provide a method to display the selected component path in the toolbar, and provide methods to add and delete components already in the toolbar.
[0084] 3. Provide methods to highlight objects in the structure tree and cancel object highlighting.
[0085] 4. Provide methods to modify physical product instance object titles and reference object titles.
[0086] 5. Provide screening methods for points, lines, surfaces, envelopes, UDFs and their conversion types.
[0087] 6. Provide methods for selecting all filter object types and clearing the selected filter object types.
[0088] 7. Provide methods to obtain all geometric features under the geometry set and geometry tool set.
[0089] 8. Provides a method to batch add custom prefixes and suffixes to the object names in the toolbar.
[0090] 9. Provide a method to display the named objects to be modified in the renaming workspace according to different object filtering methods of the user.
[0091] 10. Provide a quick method to copy the original names of objects in the toolbar in batches multiple times.
[0092] 11. Provide a method to add a custom serial number (including custom starting value, step length, and number of digits) at any position of a custom name.
[0093] 12. Provides methods to clear all objects to be renamed in the renaming workspace, remove individual objects to be renamed, and highlight the selected objects to be renamed in the structure tree.
[0094] 13. Provide a preview function to generate a user-defined new name for the renamed object in the renaming workspace to ensure that the new name of the object meets the requirements.
[0095] 14. Provide a method to batch modify the object names in the structure tree according to the user-defined names in the toolbar.
Claims
1. A batch renaming method of structure tree based on secondary development of CATIA V6, characterized in that: The following steps are involved: Step 1. Activate the rename function in the 3D view and select the component to be renamed; Step 2: Select the filtering method and filtering type of the components to be renamed. The filtering methods include renaming only the selected object or renaming the selected object and its sub-objects. The path information of the objects that meet the filtering conditions is displayed in the toolbar of the renaming workspace. If you choose to rename the selected object and its sub-objects, follow these steps: Step 2.1, obtain the component type of the selected component to be renamed through the IsA function of the GetImpl function. If it is empty, a geometric component or a geometric component under the root product, go to step 2.2; if it is a geometric tool set, go to step 2.3; if it is a geometric graphics set, go to step 2.4; if it is a non-basic type, that is, translation, rotation, symmetry, scaling, mapping, positioning transformation, go to step 2.5; if it is a basic type, that is, point, line, surface, envelope, UDF, go to step 2.6; Step 2.2, obtain all geometric feature objects under the component to be renamed through the GetAllBodies function of the CATIPartRequest_var interface. If the geometric feature object is a geometric tool set, go to step 2.3; if the geometric feature object is a geometric graphics set, go to step 2.4; if the geometric feature object is a non-basic type, go to step 2.5; if the geometric feature object is a basic type, go to step 2.6; Step 2.3, obtain the subcomponent of the component to be renamed through the Item function of the CATIAShapes_var interface, and convert it into a CATIABase_var type object to obtain all geometric feature objects under the geometric tool set. If the geometric feature object is a geometric graphics set, go to step 2.4; if the geometric feature object is a non-basic type, go to step 2.5; if the geometric feature object is a basic type, go to step 2.6; Step 2.4, obtain all geometric feature objects under the geometric graphics set through the GetMechanicalFeatures function. If the geometric feature object is a non-basic type, go to step 2.5; if the geometric feature object is a basic type, go to step 2.6; Step 2.5, use the IID_CATIMeasurablePoint interface, IID_CATIMeasurableLine interface, IID_CATIMeasurablePlane interface and IID_CATIMeasurableVolume interface in sequence to convert the component to be renamed into one of the basic types, and then go to step 2.6; Step 2.6, monitor the check status of the five filter types of points, lines, surfaces, envelopes and UDFs of each object through the AddAnalyseNotificationCB function, and set the parameter of the SetState function of the CATDlgCheckButton interface to CATDlgCheck or CATDlgUncheck to check or cancel the filter type, record the operation type as Insert for the object of the checked filter type, and make corresponding records according to the checked filter type, finally display the path information in the component toolbar in the toolbar of the rename workspace, and store it in the CATLISTV list of the global pointer CATBaseUnknown_var interface; Step 3: In the Prefix, Name, and Suffix text boxes, define a unified prefix, name, and suffix text for the objects in the renaming workspace, concatenate the prefix, name, and suffix text to form a new name for the object and display it in the renaming workspace; Step 4: Get the corresponding component in the 3D view by renaming the path information of the object in the workspace, and then set a new name for the object in the workspace according to the selected filtering method and filtering type.
2. The method for batch renaming structure trees based on CATIA V6 secondary development as claimed in claim 1, characterized in that: In the step 1, after activating the rename function in the three-dimensional view, define the global pointer of the CATPathElementAgent interface to point to the component to be renamed, and highlight the component by calling the GetHSO function of the CATFrmEditor interface, use the PathElementString function of the CCallTemplatesCommonFun interface to obtain the path information of the component, and then store the path information of the selected one or more components in the CATLISTP list of the global pointer CATPathElement interface, store the object information of the selected one or more components in the CATLISTV list of the global pointer CATBaseUnknown_var interface, and finally traverse the CATLISTP list of the global pointer CATPathElement interface and display the path information in the component toolbar through the SetLine function of the CATDlgSelectorList interface.
3. The method for batch renaming structure trees based on CATIA V6 secondary development as claimed in claim 2, characterized in that: In step 1, if the selected component to be renamed needs to be deleted, first obtain the index of the component to be deleted through the GetSelect function of the CATDlgSelectorList interface, then delete the component corresponding to the index in the component toolbar through the ClearLine function, and at the same time delete the path and object information of the selected component in the CATLISTP list of the CATPathElement interface and the CATLISTV list of the CATBaseUnknown_var interface through the RemovePosition function.
4. The method for batch renaming structure trees based on CATIA V6 secondary development as claimed in claim 1, characterized in that: If you choose to rename only the selected object in step 2, first determine whether the component to be renamed is a physical product. If the component to be renamed can be converted to a non-empty CATIPLMNavOccurrence_var type value, it is a physical product, otherwise it is not a physical product. If it is a physical product, determine and record the check status of the two filter types of Reference-Title and Instance-Title, and then display the path information of the component to be renamed in the toolbar of the renaming workspace. If it is not a physical product, the type of the component to be renamed is obtained through the IsA function of the GetImpl function, and the path information of the component to be renamed is displayed in the toolbar of the renaming workspace.
5. The method for batch renaming structure trees based on CATIA V6 secondary development as claimed in claim 4 is characterized in that: If you choose to rename only the selected object in step 2 and the component to be renamed is a physical product, then step 4 is specifically: obtain the reference-title and instance-title objects of the physical product through the GetRelatedReference and GetRelatedInstance functions of the CATIPLMNavOccurrence_var interface respectively, and then modify the V_Name and Name attributes of the object respectively through the SetValueWithString function of the CATCkeObjectAttrWriteServices interface to realize the renaming of the reference-title and instance-title.
6. The method for batch renaming structure trees based on CATIA V6 secondary development as claimed in claim 4 is characterized in that: If in step 2, it is selected to rename only the selected object and the component to be renamed is not a physical product, then step 4 is specifically as follows: first determine whether the component to be renamed is of MechanicalPart or VPMRepOccurrence type; if it is of MechanicalPart or VPMRepOccurrence type, convert the component type through the CATPLMComponentInterfacesServices interface and the CATIPLMNavRepReference_var interface in turn, and then modify the V_Name attribute of the current component by calling the SetValueWithString method of the CATCkeObjectAttrWriteServices class to rename the current component; if it is not a MechanicalPart and is of VPMRepOccurrence type, rename the object in the renaming workspace corresponding to the component through the SetAlias function of the CATIAlias_var interface.
7. The method for batch renaming structure trees based on CATIA V6 secondary development as claimed in claim 1, characterized in that: When the filter type is canceled in step 2.6, the operation type is recorded as Delete for the object whose filter type is canceled, the corresponding path information displayed in the toolbar of the renaming workspace is canceled, and the corresponding path information stored in the CATLISTV list of the global pointer CATBaseUnknown_var interface is deleted.
8. The method for batch renaming structure trees based on CATIA V6 secondary development as claimed in claim 1, characterized in that: If you choose to rename the selected object and sub-objects in step 2, step 4 is specifically: rename the object of the selected filter type through the SetAlias function.
Citation Information
Patent Citations
Method for quickly reconstructing names and numbers of part instances in batches based on CATIA
CN117349916A