Method and device for automatically sequencing structure trees
By automatically classifying structure tree nodes and processing attribute information, automatic sorting of structure trees in fixture design is realized, solving the problems of cumbersome and inefficient manual sorting in the existing technology, improving design efficiency and reducing costs.
Patent Information
- Application Number
- CN202510215820.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-26
- Publication Date
- 2025-06-13
AI Technical Summary
In fixture design, the existing technology requires designers to manually select the root node and sort the sub-nodes under it, resulting in complex operations, large workload and low efficiency.
A method and device for automatic sorting of structure trees is proposed. By traversing the structure tree nodes, the parent node and child nodes at the same level under the root node are classified, the attribute information of the node is obtained, the number and instance name are identified, and the number is automatically sorted according to the overlap of the number and the instance name.
Simplify the sorting operation steps, reduce the workload of designers, improve work efficiency, and reduce design costs.
Smart Images

Figure CN120144830A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of automated design, and particularly relates to a method and device for automatically sorting a structure tree. Background Art
[0002] Currently, when designing fixtures through software, it is necessary to name and sort each node of the created tooling according to the basic project information to ensure that the designed product can meet the requirements of customers. When designers sort the nodes in a multi-node and multi-level structure tree, they need to expand the nodes layer by layer and then manually judge the characteristics of the numbering information. They rename the existing nodes by modifying the attributes. According to the node naming rules, they use commands such as "re-sorting the graphic tree" or commands with the same function to manually adjust the positions of the nodes in a certain order.
[0003] The above traditional operation method has certain deficiencies. It is necessary to manually select the root node to sort its subordinate child nodes; according to its naming rules and node positions, through commands such as "re-sorting the graphic tree" or commands with the same function, manually adjust the node order on the interface. In the situation where the structure tree has many levels and the naming is irregular, relying solely on manual sorting by humans, users need to repeatedly perform a large number of tasks of selecting the root nodes of the structure tree and judging and sorting the nodes under different root nodes. Not only is the operation complicated, the workload is large, but the work efficiency is also relatively low. Summary of the Invention
[0004] The present invention provides a method and device for automatically sorting a structure tree, which simplifies the sorting operation steps, greatly reduces the workload, and improves the work efficiency.
[0005] To achieve the above object, the technical solution of the present invention is implemented as follows:
[0006] A method for automatically sorting a structure tree includes:
[0007] S1. Traverse the nodes of the structure tree, and classify all the sibling parent nodes under the root node and all the sibling child nodes under the parent node.
[0008] S2. Respectively obtain the attribute information of the classified nodes, and identify the number and instance name.
[0009] S3. Compare the numbers of the same type of nodes, sort them according to the coincidence degree of the numbers, and sort the nodes with exactly the same numbers according to the instance name.
[0010] Further, step S1 specifically includes: traversing the nodes of the structure tree, classifying them according to different part attributes, identifying the nodes under the assembly, and classifying all the sibling parent nodes under the root node and all the sibling child nodes under the parent node according to the creation characteristics of each classified node.
[0011] Further, the calculation method of the coincidence degree in step S3 includes: sequentially comparing the number of identical characters in the fields according to the front-back order of the fields in the numbers of the same type of nodes. If the current field is completely the same, continue to compare the next field. If the current field is partially the same or completely different, stop the comparison, and use the number of identical characters obtained from the comparison as the coincidence degree.
[0012] Furthermore, step S3 further includes: when the numbers of the same type of nodes are not completely the same but the coincidence degrees are the same, identifying the different parts in the numbers, and sorting them according to the characteristic characters with a sequential order in the different parts; if there are no such characteristic characters in the different parts, sort them according to the sequential order of the first characters of the different parts.
[0013] Further, the method of sorting according to the instance name in step S3 includes: sorting according to the characteristic fields with a sequential order in the instance name, and if there are no such characteristic fields, sorting according to the sequential order of the first characters of the instance name.
[0014] On the other hand, the present invention also proposes a device for automatically sorting a structure tree, including:
[0015] Classification module: traversing the structure tree nodes, and classifying all the sibling parent nodes under the root node and all the sibling child nodes under the parent node.
[0016] Information module: respectively obtaining the attribute information of the classified nodes, and identifying the number and the instance name.
[0017] Sorting module: comparing the numbers of the same type of nodes, sorting according to the coincidence degree of the numbers, and sorting the nodes with completely identical numbers according to the instance name.
[0018] Further, the classification module includes: traversing the structure tree nodes, classifying according to different part attributes, identifying the nodes under the assembly, and classifying all the sibling parent nodes under the root node and all the sibling child nodes under the parent node according to the creation characteristics of each classified node.
[0019] Further, the sorting module includes a coincidence degree calculation unit, and the coincidence degree calculation unit includes: sequentially comparing the number of identical characters in the fields according to the front-back order of the fields in the numbers of the same type of nodes. If the current field is completely the same, continue to compare the next field. If the current field is partially the same or completely different, stop the comparison, and use the number of identical characters obtained from the comparison as the coincidence degree.
[0020] Further, the sorting module further includes a difference comparison unit, and the difference comparison unit includes: when the numbers of the same type of nodes are not exactly the same but the coincidence degree is the same, identifying the different parts in the numbers, and sorting them according to the characteristic characters with a sequential order in the different parts; if there are no such characteristic characters in the different parts, sorting them according to the sequential order of the first characters of the different parts.
[0021] Further, the sorting module includes an instance sorting unit, and the instance sorting unit includes: sorting according to the characteristic fields with a sequential order in the instance name, and if there are no such characteristic fields, sorting according to the sequential order of the first characters of the instance name.
[0022] Compared with the prior art, the present invention has the following beneficial effects:
[0023] The present invention simplifies the operation steps of sorting. By reading the number information in the attribute information of all nodes at one time through software and sorting them according to the set rules, the automatic re - sorting of the structure tree can be achieved with one key, greatly reducing the workload of designers, improving work efficiency at the same time, and reducing design costs. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] Figure 1 is a schematic flow chart of the present invention;
[0025] Figure 2 is a schematic diagram of the automatic sorting execution logic of Embodiment 1 of the present invention;
[0026] Figure 3 is a schematic diagram of the node attribute classification of Embodiment 1 of the present invention;
[0027] Figure 4 is a schematic diagram of the node attribute information of Embodiment 1 of the present invention;
[0028] Figure 5 is a schematic diagram of the part number sorting of Embodiment 1 of the present invention;
[0029] Figure 6 is a schematic diagram of the device structure of Embodiment 2 of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0030] It should be noted that, without conflict, the embodiments in the present invention and the features in the embodiments can be combined with each other.
[0031] The method for automatic sorting of the structure tree proposed by the present invention, as Figure 1 shown, includes:
[0032] S1. Traverse the nodes of the structure tree, and classify all the sibling parent nodes under the root node and all the sibling child nodes under the parent node;
[0033] S2. Obtain the attribute information, identification numbers, and instance names of the classified nodes respectively;
[0034] S3. Compare the numbers of the nodes of the same category, sort them according to the coincidence degree of the numbers, and sort the nodes with exactly the same numbers according to the instance names.
[0035] Based on the above method, the present invention will be further described below in conjunction with the accompanying drawings and specific embodiments.
[0036] Embodiment 1:
[0037] In this embodiment, taking Catia as an example, the fixture design software develops a function software for automatic sorting, calls the Catia interface, and realizes the automatic sorting of each node of the structure tree on the Catia side. The specific execution logic is as Figure 2 shown, including:
[0038] Invoke the interface CATIDocID of Catia through a function to obtain the part attributes in the structure tree.
[0039] Traverse the nodes of the structure tree, classify them according to different part attributes, and classify them into products, components, and parts. As Figure 3 shown, the manifestations of these three types of products, components, and parts on the structure tree are respectively. Identify the nodes under the assembly, and classify all the sibling parent nodes under the root node and all the sibling child nodes under the parent node according to the creation characteristics of the product, component, and part nodes.
[0040] Obtain the attribute information of the classified nodes respectively, identify their part number information and instance names. The part numbers mentioned here do not only refer to the part type, but are uniformly called part numbers in the Catia node attribute information. As Figure 4 shown in a simple example, for the node df, the classification type is product, its part number is "df", and the instance name is "df.1".
[0041] After obtaining the attribute information, first compare the part numbers and sort them preferentially according to the coincidence degree of the part numbers of the nodes of the same category.
[0042] Generally, the format of the part number is as Figure 5As shown, it is field - divided, with each field separated by "-". For example, "0 - NW01 - W613 - B65 - U01 - 00(U01)". Based on this, the method for calculating the coincidence degree includes: comparing the number of identical characters in the fields in the order of the fields in the part number one by one. If the current field is completely the same, continue to compare the next field; if the current field is partially the same or completely different, stop the comparison, and take the number of identical characters obtained from the comparison as the coincidence degree. If the part number is not field - divided and is a complete number, the complete number can also be regarded as a field, and the above method is used to calculate the coincidence degree.
[0043] When sorting according to the coincidence degree, the part numbers with higher coincidence degrees are placed in the front positions of the structure tree. Taking "0 - NW01 - W613 - B65 - U01 - 00(U01)" as an example, if there are two part numbers "0 - NW01 - W614 - B66 - U02 - 00(U02)" and "0 - NW01 - W613 - B78 - U01 - 00(U01)", then when sorting, the one with a higher coincidence degree, "0 - NW01 - W613 - B78 - U01 - 00(U01)", is placed in the front position of the structure tree.
[0044] If it encounters part number information with the maximum coincidence degree, that is, completely identical, the instance name can be read. If there are characteristic fields with a certain arrangement rule (sequence) in the instance name, such as the sequence of numbers 1, 2, 3... or letters a, b, c..., then it is sorted in ascending order according to the characteristic fields (numbers or letters) in the instance name. If there are no characteristic fields with a sequence, it is sorted according to the sequence of the first characters of the instance name.
[0045] For nodes with the same coincidence degree (not the maximum), identify the different parts in the part number content. If there are characteristic fields with a certain sequence in the different parts, such as the sequence of numbers or letters, the nodes are sorted in ascending order according to the content of the different parts. If there are no characteristic fields with a sequence in the different parts, they are sorted according to the sequence of the first characters of the non - overlapping parts in the number information.
[0046] Compared with the prior art, the method described in this embodiment simplifies the operation steps, can re - sort the structure tree with one key, greatly reduces the workload of designers, improves work efficiency, and reduces design costs at the same time.
[0047] Embodiment 2:
[0048] Embodiment 2 proposes a device for automatic sorting of the structure tree, as Figure 6 shown, including:
[0049] Classification module: Traverse the structure tree nodes, and classify all sibling parent nodes under the root node and all sibling child nodes under the parent node.
[0050] Information module: Obtain the attribute information, identification number, and instance name of the classified nodes respectively.
[0051] Sorting module: Compare the numbers of the same type of nodes and sort them according to the coincidence degree of the numbers. Nodes with exactly the same number are sorted according to the instance name.
[0052] Among them, the classification module includes: Traverse the structure tree nodes, classify them according to different part attributes, identify the nodes under the assembly, and classify all sibling parent nodes under the root node and all sibling child nodes under the parent node according to the creation characteristics of each classified node.
[0053] The sorting module includes a coincidence calculation unit, and the coincidence calculation unit includes: Compare the number of identical characters in the fields of the numbers of the same type of nodes in sequence according to the front-back order of the fields. If the current field is exactly the same, continue to compare the next field. If the current field is partially the same or completely different, stop the comparison, and use the number of identical characters obtained from the comparison as the coincidence degree.
[0054] The sorting module also includes a difference comparison unit, and the difference comparison unit includes: When the numbers of the same type of nodes are not exactly the same but the coincidence degrees are the same, identify the different parts in the numbers and sort them according to the characteristic characters with a sequence in the different parts; if there are no such characteristic characters in the different parts, sort them according to the sequence of the first characters of the different parts.
[0055] The sorting module includes an instance sorting unit, and the instance sorting unit includes: Sort according to the characteristic fields with a sequence in the instance name. If there are no such characteristic fields, sort according to the sequence of the first characters of the instance name.
[0056] The device proposed in this Embodiment 2 can implement the method for automatically sorting the structure tree described in Embodiment 1, and has the same technical effects as the method described in Embodiment 1.
[0057] The above are only the preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for automatically sorting a structure tree, characterized in that: include: S1, traverse the structure tree nodes, and classify all the parent nodes of the same level under the root node and all the child nodes of the same level under the parent node; S2. Obtain attribute information, identification numbers and instance names of the classified nodes respectively; S3. Compare the numbers of the same type of nodes and sort them according to the overlap of the numbers. Nodes with exactly the same numbers are sorted according to the instance names.
2. The method for automatic sorting of structure tree according to claim 1, characterized in that: Step S1 specifically includes: traversing the structure tree nodes, classifying according to different part attributes, identifying the nodes under the assembly, and classifying all parent nodes of the same level under the root node and all child nodes of the same level under the parent node according to the creation features of each classification node.
3. The method for automatic sorting of structure tree according to claim 1, characterized in that: The calculation method of the overlap degree in step S3 includes: comparing the number of identical characters in the fields in turn according to the order of the fields in the numbering of the same type of nodes; if the current field is exactly the same, continue to compare the next field; if the current field is partially the same or completely different, stop comparing, and use the number of identical characters obtained by comparison as the overlap degree.
4. The method for automatic sorting of structure tree according to claim 3, characterized in that: Step S3 also includes: when the numbers of the same type of nodes are not exactly the same but the overlap is the same, identifying the difference in the numbering and sorting it according to the characteristic characters in the difference in sequence; if the difference does not have the characteristic characters, sorting it according to the sequence of the first characters of the difference.
5. The method for automatic sorting of structure tree according to claim 1, characterized in that: The method of sorting according to the instance name in step S3 includes: sorting according to the characteristic fields in the instance name that have a certain order, and if there is no such characteristic field, sorting according to the order of the first characters of the instance name.
6. A device for automatically sorting a structure tree, characterized in that: include: Classification module: traverses the structure tree nodes and classifies all parent nodes of the same level under the root node and all child nodes of the same level under the parent node; Information module: obtains attribute information, identification number and instance name of the classified nodes respectively; Sorting module: compares the numbers of similar nodes and sorts them according to the overlap of the numbers. Nodes with exactly the same numbers are sorted according to the instance names.
7. The device for automatically sorting a structure tree according to claim 6, characterized in that: The classification module includes: traversing the structure tree nodes, classifying according to different part attributes, identifying the nodes under the assembly, and classifying all the parent nodes of the same level under the root node and all the child nodes of the same level under the parent node according to the creation features of each classification node.
8. The device for automatically sorting a structure tree according to claim 6, characterized in that: The sorting module includes an overlap calculation unit, which includes: comparing the number of identical characters in the fields in sequence according to the order of the fields in the numbering of the same type of nodes, if the current fields are exactly the same, continue to compare the next field, if the current fields are partially the same or completely different, stop comparing, and use the number of identical characters obtained by comparison as the overlap.
9. The device for automatically sorting a structure tree according to claim 8, characterized in that: The sorting module also includes a difference comparison unit, which includes: when the numbers of the same type of nodes are not exactly the same but the overlap is the same, identifying the difference part in the numbering, and sorting according to the characteristic characters in the difference part that exist in a certain order; if the difference part does not have the characteristic characters, sorting according to the order of the first characters of the difference part.
10. The device for automatically sorting a structure tree according to claim 6, characterized in that: The sorting module includes an instance sorting unit, which includes: sorting according to the characteristic fields in the instance names that have a sequence, and if there is no such characteristic field, sorting according to the sequence of the first characters of the instance names.