Community
Inventor Forum
Welcome to Autodesk’s Inventor Forums. Share your knowledge, ask questions, and explore popular Inventor topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

I can't change the type of a part in BOM window from reference to normal but only from tree window!

13 REPLIES 13
SOLVED
Reply
Message 1 of 14
stamy1
719 Views, 13 Replies

I can't change the type of a part in BOM window from reference to normal but only from tree window!

I try to change the state of a part from Reference to normal inside of a BOM window and that is automatic change back to Reference. I can only manage to change the state from tree window. Why is that? I don't have this issue with Inventor 2023.

After update to 2024 have issues with Ilogic constrains that i solve and now i find that many random parts appears as Reference instead as Normal. In complicate and big Assembly how to be sure that the BOM have all parts for construction and don't have many parts hided because of this issue?

It exists a way to correct it all massive without to search one by one in tree window?

In Ilogic when i suppress a part that affects the BOM structure of it?

13 REPLIES 13
Message 2 of 14
EdvinTailwind
in reply to: stamy1

I've had this issue too, and fixed it through Document Settings:

EdvinTailwind_0-1684494389698.png

 

Message 3 of 14
stamy1
in reply to: EdvinTailwind

In a BOM with over of 30 sub assembly's inside of other sub assembly's and over a 2000 parts in total how to find witch part is converted to Reference at they own? For now i had to search one by one  all the parts.... And i don't know what is going wrong in Inventor 2024. My BOM lists is ok in Previous version 2023.

Message 4 of 14
EdvinTailwind
in reply to: stamy1

Ah, sorry, I misinterpreted your question.

Message 5 of 14
A.Acheson
in reply to: stamy1

Hi @stamy1 

The browser bom structure sets the  occurrence from normal to reference in the context of that assembly. The BOM editor is a direct link to the document settings of that specific part/assembly. 

 

It is true that the occurrence should not be set to reference if you have not done so, this would be a bug if this is true. Would another person have set that in the assembly? 

 

If you want to batch set this you can do so with some ilogic code to avoid the one by one search. Here is an article for working with assemblies using code

 

Sub Main

Dim assyDoc As AssemblyDocument = ThisDoc.Document
' Call the function that does the recursion.
  TraverseAssembly(assyDoc.ComponentDefinition.Occurrences)
End Sub

Private Sub TraverseAssembly(occurrences As ComponentOccurrences)
    ' Iterate through all of the occurrence in this collection.  This
    ' represents the occurrences at the top level of an assembly.

    For Each occ As ComponentOccurrence In occurrences

' Set the Occurrence BOM Structure.

occ.BOMStructure = BOMStructureEnum.kNormalBOMStructure
       
        ' Check to see if this occurrence represents a subassembly
        ' and recursively call this function to traverse through it.
        If occ.DefinitionDocumentType = kAssemblyDocumentObject Then
            TraverseAssembly(occ.SubOccurrences)
        End If
    Next
End Sub

 

 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
Message 6 of 14
stamy1
in reply to: stamy1

Thanks a lot, That helps me to not searching one by one manually. What happens with parts mark as purchasing?

I think is a bug and also I want to have a confirmation from another user! So please reply to us if anyone has seen that!

Message 7 of 14
A.Acheson
in reply to: stamy1

Hi @stamy1 

 

I used the incorrect BOMStructureEnum it should look for Reference and change to Default. Normal is only available from within the document. 

AAcheson_0-1684513676933.png

Updated Code. 

Sub Main

    Dim assyDoc As AssemblyDocument = ThisDoc.Document

    ' Call the function that does the recursion.
    TraverseAssembly(assyDoc.ComponentDefinition.Occurrences)
End Sub

Private Sub TraverseAssembly(occurrences As ComponentOccurrences)
    ' Iterate through all of the occurrence in this collection.  This
    ' represents the occurrences at the top level of an assembly.
    For Each occ As ComponentOccurrence In occurrences
		'Check if BOM Structure set to reference
       If occ.BOMStructure = BOMStructureEnum.kReferenceBOMStructure Then
         ' Set the Occurrence BOM Structure to default.
          occ.BOMStructure = BOMStructureEnum.kDefaultBOMStructure
	  End If
        ' Check to see if this occurrence represents a subassembly
        ' and recursively call this function to traverse through it.
        If occ.DefinitionDocumentType = kAssemblyDocumentObject Then
            TraverseAssembly(occ.SubOccurrences)
        End If
    Next
End Sub

 

 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
Message 8 of 14
stamy1
in reply to: A.Acheson

I run the code and i get the error of

stamy1_0-1684839230673.png

 

pic 1

 

The code:

stamy1_1-1684839274950.png

 

Message 9 of 14
A.Acheson
in reply to: stamy1

Hi @stamy1 

I am not entirely sure what is happening here.

 

It may not like the k...object so try putting in DocumentTypeEnum before the object type.

 

If occ.DefinitionDocumentType = DocumentTypeEnum.kAssemblyDocumentObject Then
            TraverseAssembly(occ.SubOccurrences)
        End If

 Can you share the more info of that error message?

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
Message 10 of 14
stamy1
in reply to: A.Acheson

After the change in line 21 still get the same error: Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL))

Message 11 of 14
Frederick_Law
in reply to: stamy1
Message 12 of 14
A.Acheson
in reply to: stamy1

Hi @stamy1 

 

Have you any suppressed occurrences? Any empty assemblies?

Can you check the code in another assembly? 

 

If you know which line it fails on, wrap it in a try catch statement and use a logger line to display the occurrence this way you can narrow down to the exact occurence failing. 

Try
    'Enter line to test
    Logger.Info("Ok: " & occ.Name)
Catch
    Logger.Info("Fails: " & occ.Name)
End Try

 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
Message 13 of 14
stamy1
in reply to: A.Acheson

My code suppresses and  unsuppresses parts and assemblies in order to make the design according to the order that we got. 

Inventor 2023 changed the BOM structure when i suppressed a part or assembly as "reference" and when I unsuppressed, it changed back to "normal".

In Inventor 2024 it changes the structure to "reference" but in never reverts it back to normal when I unsuppress it and I have to do it manually. I have realized that this is happening to assemblies that are imported for the first time in Inventor 2024 from Inventor 2023.

Another "bug" is that in the 2024 version when, in the BOM window, when I change the structure from "reference" to "normal" it doesn't register and it goes back to reference without ever having saved the change. Only way to change it is from the file browser one by one, which is time-consuming.

Message 14 of 14
A.Acheson
in reply to: stamy1

Hi @stamy1  that definitely is an issue that behavior you describe.

 

Although the BOM not allowing changing reference to normal that seems like normal behavior (also in Inventor 2020 & 2022 when the occurrence has a local override.. It will change and change back like an elastic. It really should give a warning of what the behavior is because it can be confusing.  

Here is an updated code to deal with read only assemblies and suppressed parts/assemblies. 

Sub Main

    Dim assyDoc As AssemblyDocument = ThisDoc.Document

    ' Call the function that does the recursion.
    TraverseAssembly(assyDoc.ComponentDefinition.Occurrences)
End Sub

Private Sub TraverseAssembly(occurrences As ComponentOccurrences)
    ' Iterate through all of the occurrence in this collection.  This
    ' represents the occurrences at the top level of an assembly.
    For Each occ As ComponentOccurrence In occurrences
		'Check if BOM Structure set to reference
		Try
			'Logger.Info("Ok: " & occ.Name)
	       If occ.BOMStructure = BOMStructureEnum.kReferenceBOMStructure AndAlso Not occ.Suppressed Then
	         ' Set the Occurrence BOM Structure to default.
	          occ.BOMStructure = BOMStructureEnum.kDefaultBOMStructure
		  End If
	        ' Check to see if this occurrence represents a subassembly
	        ' and recursively call this function to traverse through it.
	        If occ.DefinitionDocumentType = kAssemblyDocumentObject AndAlso Not occ.Suppressed AndAlso occ.Definition.Document.IsModifiable Then
	            TraverseAssembly(occ.SubOccurrences)
	        End If
		Catch ex As Exception
			'Logger.Info("Fails: " & occ.Name)
		End Try
    Next
End Sub

 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report