Hide / Show Assembly BOM Column

Hide / Show Assembly BOM Column

KarlH_54321
Observer Observer
399 Views
2 Replies
Message 1 of 3

Hide / Show Assembly BOM Column

KarlH_54321
Observer
Observer

Hey all,

 

I've needed to generate and write unique sort tokens that are applied to a custom iProperty "sortOrder" for each part within my assembly, so that when I run the below code against the sortOrder column, the parts appear in the desired order.

 

Dim oBOM As BOM = ThisAssembly.Document.ComponentDefinition.BOM
oBOMView = oBOM.BOMViews.Item("Structured")
oBOMView.Sort("sortOrder", True)
oBOMView.Renumber()

 

Anyone who's tinkered with an Assembly BOM in iLogic has no doubt run this code snippet. But what I've discovered is that this code fails on a Custom iProperty if that iProperty is not activated within the BOM. The problem I have is that my sort Token is a mish-mash of calcs that would confuse users, so needs to be hidden and not in the final export.

Writing this post now though, I think I've discovered a workaround where if instead of a custom iProperty, I use a default stock iProperty - the script doesn't crash regardless of if that stock iProperty BOM column is displayed within the BOM or not.

Figured I'd double check though, is there any way to sort an Assembly BOM via a custom iProperty that's currently hidden within the Assembly BOM without crashing the iLogic rule and failing the BOM sort process?

0 Likes
400 Views
2 Replies
Replies (2)
Message 2 of 3

WCrihfield
Mentor
Mentor

Hi @KarlH_54321.  I have not tried that before, but an idea did come to mind after reading your post.  Do you utilize the BOM customization export & import process (BOM.ExportBOMCustomization & BOM.ImportBOMCustomization)?  I'm just guessing thinking that since we do not have direct control over showing or hiding columns of the BOM from iLogic/Inventor API, that you may be able to sort the BOM while that column is not hidden (one customization), then import the customization in which that column is either hidden, or not present, before exporting the view.  I don't think that would change your existing sort order, but I haven't tested in lately.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 3 of 3

KarlH_54321
Observer
Observer

In our user case, the BOM export is via API call, so that's not in my control unfortunately.

 

Thankfully, an iLogic BOM sort does execute upon standard out-of-the-box iProperties - regardless of whether the column is hidden/showing in the BOM, which thankfully allows my custom sort token code to work. And at least now we know iLogic crashes if a BOM sort is executed upon an assembly BOM that doesn't contain a column to represent the custom iProperties - and that it is indeed a limitation that BOM columns can't be either shown or hidden via iLogic.

0 Likes