Hi,
I want to control my BOM with ilogic for cutom user inputs.
I already got the sort function and show function to work.
Only problem i got is that the ilogic code does not work when there is a manual sort on any collumn.
Well the code works, but it does nothing.
To clear this you have to click rmb on the collumn that is manually sorted, and then click clear sort.
After this the code works fine.
Is there a way to built in a safety in ilogic that clears manual sorts?
Dim oAssem As AssemblyDocument = ThisDoc.Document Dim oBOM As BOM = oAssem.ComponentDefinition.BOM oBOM.StructuredViewEnabled = True oBOM.StructuredViewFirstLevelOnly = True Dim oBOMview As BOMView = oBOM.BOMViews.Item("structured")
'sort bom on base QTY Call oBOMview.Sort("Base QTY", False)
'show bom
Dim oCM As CommandManager = ThisApplication.CommandManager Dim oCD As ControlDefinitions = oCM.ControlDefinitions Dim ShowBom As ControlDefinition = oCD.Item("AssemblyBillOfMaterialsCmd") ShowBom.Execute2(True)
'sort on item after bom closes Call oBOMview.Sort("Item", True) 'MsgBox("done") to check if the excecute2 fucntion is working.
Solved! Go to Solution.
Solved by A.Acheson. Go to Solution.
Have you tried clearing all manual sorts by placing nothing or “” in place of a sort if you have only 2 columns sorting?
Syntax
BOMView.Sort( PrimaryColumnTitle As String, [PrimaryColumnAscending] As Boolean, [SecondaryColumnTitle] As String, [SecondaryColumnAscending] As Boolean, [TertiaryColumnTitle] As String, [TertiaryColumnAscending] As Boolean )
Call oBOMview.Sort("Base QTY", False,”Item”,True,””,True)
just tried it but that does not work.
then i get an error, because there is no property with an empty string.
Call oBOMview.Sort("", False,)
the secondary en tertiary sorts are optional, so input is not required there.
Hi The sort is removing all manual sort criteria in Inventor 2020.
Before Rule Running:
After Rule Running:
Dim oAssem As AssemblyDocument = ThisDoc.Document Dim oBOM As BOM = oAssem.ComponentDefinition.BOM oBOM.StructuredViewEnabled = True oBOM.StructuredViewFirstLevelOnly = True Dim oBOMview As BOMView = oBOM.BOMViews.Item("structured") 'Sort bom on Item Call oBOMview.Sort("Item", True) 'show bom Dim oCM As CommandManager = ThisApplication.CommandManager Dim oCD As ControlDefinitions = oCM.ControlDefinitions Dim ShowBom As ControlDefinition = oCD.Item("AssemblyBillOfMaterialsCmd") ShowBom.Execute2(True)
the problem is when you have the bom open.
when you click part number an arrow appears.
when this arrow is shown in any collumn the code doesn's work.
this arrow can be removed by right clicking the collumn tab and select clear sort.
but as far as i know there is no option to do this in code.
I see the missing functionality now. I have likely had this happen to me before and was unaware of the issue. I checked the API and the commands list and there seems to be no way to clear this Sort Ascending/Descending filter. What does work is to import a clean xml. Which may not be ideal if you have made changes.
oBOM.ImportBOMCustomization("C:\Users\ImportBOMColumnSettings.xml")
Issue: No way to clear a manual Sort Ascending/Descending activated in the editor.
Ow that's a workaround does the job perfectly!
now i just exported the bom without any customization to an xml, and override that with the bom.
Only thing is that you override the bom everytime you run the rule. i don't know how much impact it has on performance, but what i can see now it works very smooth.
Thanks!
Can't find what you're looking for? Ask the community or share your knowledge.