Hello. I am starting with two trees that share the same structure and number of elements. One tree contains geometry, and the other contains text associated with that geometry.
I have performed a series of modifications to the text tree (thanks to the members of this forum) to organize it. This organization results in a tree where each branch represents modules with the same associated text, and the sub-branches represent the different branches of the initial text tree.
My goal is to reorder the geometry tree in exactly the same way. However, I’ve run into a problem: in the text organization process, I assign a value of ‘0’ to certain text elements that are missing. In the geometry tree (surfaces), those elements simply do not exist. Consequently, the geometry tree results in 60 elements, while the text tree results in 69 (because it accounts for the non-existent surfaces).
I am unsure if this is a tree management issue or if my logic within the routine is flawed. Could you please help me?"
Your count of 60 items comes from (15 branches) * (4 unique labels). I don’t see why you expect it to match the geometry count since that tree doesn’t generally have 4 items per branch.
I agree with you that, given how the script is currently set up, achieving equivalence between the final trees isn’t possible. However, I’d like to know if there is a way to reach equivalence at the end if the input trees are identical. Perhaps I should remove the text that contributes 0, since it doesn’t have an equivalent surface. Also, I could sort the list of layers and surfaces so that the layers aren’t summed, but rather listed one after another in the identification. What do you think?
You have 15 branches with each 3 to 5 surfaces. (total 69 items)
You also have 15 brances with textlabels. If I would counts the number in each branch/row, the total will also be 69 items.
Completely logical correct, as I understand. I guess there is confusion, because in the first tree you have a listnumber per item, and in the second tree the numbers are added in 1 list item.
You could:
add a last textitem (with contatenate): LTotal= (listlength for every branch of first tree). (if that helps).
Insert a check if number is 0; dispatch so this part of text is skipped.