Enable BOM recursively. Error 0x80004005.

Enable BOM recursively. Error 0x80004005.

Anonymous
Not applicable
963 Views
6 Replies
Message 1 of 7

Enable BOM recursively. Error 0x80004005.

Anonymous
Not applicable

' Set a reference to the assembly document. ' This assumes an assembly document is active. Dim invDoc As Document invDoc = ThisApplication.ActiveDocument 'Set Reference Dim oBOM As BOM 'Check all sub-documents inside the active Inventor document For Each invDoc In invDoc.AllReferencedDocuments 'If a sub-document is an assembly... If invDoc.DocumentType = kAssemblyDocumentObject Then oBOM = invDoc.ComponentDefinition.BOM oBOM.StructuredViewEnabled = True oBOM.StructuredViewFirstLevelOnly = False oBOM.PartsOnlyViewEnabled = True End If Next 'update the files InventorVb.DocumentUpdate()

I used the code above and it worked on big assemblies before. But it doesn't seems to work anymore on big assemblies :(. Anyone knows why it doesn't work anymore?

 

I got the following error message:

Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL))

 

 

0 Likes
964 Views
6 Replies
Replies (6)
Message 2 of 7

Anonymous
Not applicable

edit:

 

This is not because of the size of the assembly. It works well on huge assemblies also!

It looks it cannot handle phantom assembly maybe?

Or spur gear created with design accelerator?

I'm trying to find out...

0 Likes
Message 3 of 7

Anonymous
Not applicable

Yes, its spur gear created with design accelerator. Can't enable view for document. Any idea how i can add some more code so it doesnt try do enable BOM for documents? Only assemblies!

0 Likes
Message 4 of 7

ekinsb
Alumni
Alumni

It looks like you're already checking for assemblies in your code.  Can you post a simple assembly and code that demonstrates the problem you're seeing?


Brian Ekins
Inventor and Fusion 360 API Expert
Mod the Machine blog
0 Likes
Message 5 of 7

Anonymous
Not applicable
It is because of the spur gear which was created with design accelerator which caused the problem. If i remove that, it works great. The spur gear looks like an assembly but is treated like a document by Inventor!?
0 Likes
Message 6 of 7

adam.nagy
Autodesk Support
Autodesk Support

Hi, 

 

Yes, the Spur Gears do look like an assembly and they are also set to Phantom in the BOM editor of the main assembly - maybe that's why you cannot enable structured BOM view for it?

But this is the same in the UI, so it's not an API issue.

 

Cheers,



Adam Nagy
Autodesk Platform Services
0 Likes
Message 7 of 7

Anonymous
Not applicable

Köszönöm 🙂

0 Likes