Announcements

Community notifications may experience intermittent interruptions between 10–12 November during scheduled maintenance. We appreciate your patience.

The order of the Model Tree in Assembly is incorrect

The order of the Model Tree in Assembly is incorrect

duy.nguyenJYSF4
Contributor Contributor
831 Views
10 Replies
Message 1 of 11

The order of the Model Tree in Assembly is incorrect

duy.nguyenJYSF4
Contributor
Contributor

In my assembly, the order of the parts in my models tree is incorrect. I am very sure it's a Inventor bug. I tried to restart Inventor, my computer, but it still shows incorrectly.

 

I have a API to use to constrain the newest part to the first part (skeleton) in my Assembly. Suddenly, it keeps picking the wrong first part, even though on the model tree, it showed as the first part , but it's not. My newest part keeps constraining to a random part on the model tree.

When I tried to drag my first part above itself (all the way to the top), it jumped down in the middle of the tree, not showed as the first, but then my API functions normally, which means it is the first part (skeleton) on top of the tree, even though it now shows in the middle of the tree, it is actually is the first part in model tree.

 

I need a way to reset/rebuild/refresh the model tree, so all of the parts show in the correct order.

 

duynguyenJYSF4_0-1666924890464.png

duynguyenJYSF4_1-1666925045745.png

 

0 Likes
Accepted solutions (1)
832 Views
10 Replies
Replies (10)
Message 2 of 11

blandb
Mentor
Mentor

When this assembly was made, are you sure that the part you are targeting was actually placed first? I mean the components are able to be moved in the browser to place them in any order. If you click on Bill of Materials and look at the model data tab, does it show you part of interest as the very first item?

Autodesk Certified Professional
0 Likes
Message 3 of 11

duy.nguyenJYSF4
Contributor
Contributor

I was working on it for awhile before it suddenly happened. The BOM and the order on the tree are not matched. I tried.

0 Likes
Message 4 of 11

blandb
Mentor
Mentor

If you notice, you cannot sort the model data tab in the BOM. In my mind the model data tab shows you the order in which things were placed. Even if you drag and sort the model browser, the Model Data tab in the BOM stays the same. Now, you can sort the Structured and parts only, but not the model data. So if your api is just looking for the first part, then it is probably targeting the first part shown in the model data tab right? You might need to alter it to search for other criteria, or maybe rebuild this assembly and make sure that the part you need is placed first.

Autodesk Certified Professional
0 Likes
Message 5 of 11

duy.nguyenJYSF4
Contributor
Contributor

Thanks for replied. That's what I am trying to figure it out. On the Manage Panel, there is a "Rebuild" but it doesn't do any with this bug on the model tree. 

0 Likes
Message 6 of 11

blandb
Mentor
Mentor

The rebuild all will not restructure the model browser. This is intended to make sure all edits are updated in the model for a part file, or regenerates constraints, or sketches that might be at the assembly level or regens adaptive components.

Autodesk Certified Professional
0 Likes
Message 7 of 11

duy.nguyenJYSF4
Contributor
Contributor

I came up with a simple code to find the name of the first part:

Dim Asmdoc As Document
Asmdoc = ThisDoc.Document

Dim oAsyComp As Inventor.AssemblyComponentDefinition
oAsyComp = Asmdoc.ComponentDefinition

Dim occ1 As ComponentOccurrence
occ1 = oAsyComp.Occurrences.Item(1)

Dim docFName As String
docFName = occ1.Name

MessageBox.Show(docFName, "Title")

You can see in the photo, they are not matching:

duynguyenJYSF4_0-1666977689703.png

Then I dragged the part to the top, even though it's on the top, but it showed different part.

duynguyenJYSF4_1-1666977752726.png

 

I tried with other projects, and the code is good:

duynguyenJYSF4_2-1666977802273.png

 

duynguyenJYSF4_3-1666977835512.png

 

I submitted a ticket to Autodesk, some guy called, told me to try "Ground and Root", but still the same. They asked for pack and go, and then blame the code. They are not really helpful, so I dont know what to do.

 

0 Likes
Message 8 of 11

blandb
Mentor
Mentor

Can you please show the Model Data tab for me. Maybe I wasn't too clear on what I was stating before, but just incase there are images attached. I just want to make sure we are talking apples to apples here lol:

 

Image below is 2 components placed in, just 1 after the other:

 

blandb_0-1666979188087.png

 

Next, opening the BOM to see they are in the same order as when initially placed:

 

blandb_1-1666979245447.png

 

Then, I manually re-arranged the parts in the assembly:

 

blandb_2-1666979283202.png

 

Finally, checking the Model data tab, but doesn't swap the order:

 

blandb_3-1666979316019.png

 

So, with the ones that work for you, does the Model data tab match the model browser for those assemblies?

Also, for the one that doesn't work,  does the model data tab show a different order and what you are seeing in your messages boxes is what is listed as the first item in the model data tab?

 

I know this may seem redundant, just wanting images for proof is all.

 

Autodesk Certified Professional
Message 9 of 11

johnsonshiue
Community Manager
Community Manager
Accepted solution

Hi! Just a quick test. Please open the assembly and go to Productivity section -> Alpha Sort Components. For the grounded part in the middle. Try "Ground and Root." Does it work?

Many thanks!



Johnson Shiue (johnson.shiue@autodesk.com)
Software Test Engineer
0 Likes
Message 10 of 11

duy.nguyenJYSF4
Contributor
Contributor
Ground and Root didn't work.

However, I tried the Alpha Soft, and then pull the part up to the top. It seems like reset the model tree.
It should be a "quick fix" trick for now.
Message 11 of 11

duy.nguyenJYSF4
Contributor
Contributor

@blandb 

 

Thanks for your replied, but the Model Data has nothing to do with the order on the model tree to what I am trying to achieve.

0 Likes