We are in process of migrating a recently acquired from SolidWorks into Inventor. We found we can open the SW files directly with Inventor 2020 and although they come in as un-constrained somewhat dumb solids it is very helpful. We have also found things like Recognize Features helps add some intelligence when needed. The thing we're finding is every assembly and parts in the assemblies we open come in as Default BOM Structure "Purchased".
Not sure if there is something we can do to change what BOM structure they come in as. Would be very interested in finding a way to change the BOM structure in multiple parts/assemblies quickly. Any hints or suggestions?
Solved! Go to Solution.
Solved by Curtis_Waguespack. Go to Solution.
Solved by GeorgK. Go to Solution.
Unless I'm missing something why can't you just change it through the assembly BOM
Then you could sort by that column and change as needed.
Or are you looking for more of an automated way?
Mark Lancaster
& Autodesk Services MarketPlace Provider
Autodesk Inventor Certified Professional & not an Autodesk Employee
Likes is much appreciated if the information I have shared is helpful to you and/or others
Did this resolve your issue? Please accept it "As a Solution" so others may benefit from it.
We have two major machine assemblies and each has dozens of sub-assemblies and over 1,000 parts in each. All the assemblies and all the parts in them has the BOM set to "Purchased" and needs to be set to "Normal". Could change it in the BOM of the sub-assemblies and the top level assembly if we had a spare few weeks but looking for a way to do something like select all the parts in an assembly and set them to Normal in one swing of the magic staff of BOM properties 💥
Hi! I think you will need to do that in individual files. One can write a script to set Tools -> Doc Setting -> BOM. You will need to do it for all affected parts.
Many thanks!
' set a reference to the assembly component definintion Dim oAsmCompDef As AssemblyComponentDefinition oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition 'Iterate through all of the occurrences Dim oOccurrence As ComponentOccurrence For Each oOccurrence In oAsmCompDef.Occurrences 'set BOM Structure oOccurrence.Definition.BOMStructure = 51970 'Normal Next 'kDefaultBOMStructure=51969 'The Default Structure type. 'kInseparableBOMStructure=51974 'The inseparable Structure type. 'kNormalBOMStructure=51970 'The normal Structure type. 'kPhantomBOMStructure=51971 'The phantom Structure type. 'kPurchasedBOMStructure=51973 ' The purchased Structure type. 'kReferenceBOMStructure=51972 'The reference Structure type. 'kVariesBOMStructure=51975 'The Structure type varies amongst references.
@phlyx You can use this iLogic code to update the bom.
Oh course within a little bit of celebrating the solution I stub my toe. I am not finding some sub-assemblies that are half purchased parts and half machined (normal) parts. So if I use this iLogic one way or another I end up manually changing the BOM status of half the parts. Don't want to overstep my bounds or impose, but is there any way to make this so it only changes the BOM property for selected items (parts and/or assemblies)?
You can combine the code with this one:
Sub Main() 'Make a ref to active doc Dim oDoc As Document oDoc = ThisApplication.ActiveDocument 'selected components collection Dim oSelected As ObjectCollection oSelected = ThisApplication.TransientObjects.CreateObjectCollection Dim oCount As Integer oCount = oDoc.SelectSet.Count 'Check that at least 1 is selected If oCount = 0 Then 'MessageBox.Show("Please select a component.", "iLogic") Exit Sub 'bail out End If 'add to Object Collection Dim i As Long For i = 1 To oCount If oDoc.SelectSet.Item(i).Type = _ ObjectTypeEnum.kComponentOccurrenceObject Then oSelected.Add (oDoc.selectSet.Item(i)) End If Next 'do stuff to the selected files here: 'get names item name from collection For Each oItem in oSelected oMsg = oMsg & vbLf & oItem.Name Next MessageBox.Show(oCount _ & " Component(s) selected." & vbLf & oMsg, "iLogic") End Sub
Wow, thanks and very much appreciate the help. And please excuse my iLogic ignorance but how do you "combine" the two routines? 🙄
Hi @phlyx ,
here are a couple quick versions (note I didn't really test them, but hopefully not errors)
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
here is a version of the first rule that only changes parts that currently set as "Purchased" to be Normal
' set a reference to the assembly component definintion Dim oAsmCompDef As AssemblyComponentDefinition oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition 'Iterate through all of the occurrences Dim oOccurrence As ComponentOccurrence For Each oOccurrence In oAsmCompDef.Occurrences 'set BOM Structure If oOccurrence.Definition.BOMStructure = BOMStructureEnum.kPurchasedBOMStructure Then oOccurrence.Definition.BOMStructure = BOMStructureEnum.kNormalBOMStructure End If Next
here are the combined rules which sets all selected occurrences to be Normal
Sub Main() 'Make a ref to active doc Dim oDoc As Document oDoc = ThisApplication.ActiveDocument 'selected components collection Dim oSelected As ObjectCollection oSelected = ThisApplication.TransientObjects.CreateObjectCollection Dim oCount As Integer oCount = oDoc.SelectSet.Count 'Check that at least 1 is selected If oCount = 0 Then MessageBox.Show("Please select a component.", "iLogic") Exit Sub 'bail out End If 'add to Object Collection Dim i As Long For i = 1 To oCount If oDoc.SelectSet.Item(i).Type = _ ObjectTypeEnum.kComponentOccurrenceObject Then oSelected.Add (oDoc.SelectSet.Item(i)) End If Next 'get names item name from collection For Each oItem In oSelected ' set a reference to the assembly component definintion Dim oAsmCompDef As AssemblyComponentDefinition oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition 'Iterate through all of the occurrences Dim oOccurrence As ComponentOccurrence For Each oOccurrence In oAsmCompDef.Occurrences 'set BOM Structure If oItem.Name = oOccurrence.Name Then oOccurrence.Definition.BOMStructure = BOMStructureEnum.kNormalBOMStructure End If Next Next End Sub
Copied and pasted wrong but figured out what I did. That second part was perfect. Also found we can change that final part to BOMStructureEnum.kPurchasedBOMStructure and change selected items to Purchased so we can make a rule for each type we want selected items to be changed to.
THANK YOU!!!!!!!!!!!!!!!!!!
I've copied the code and swapped out Normal with purchased. Then I get the "Please select a component" message. Where do I select the components?
My goal here is to apply the Purchased BOM structure to absolutely everything in the path C:\VaultWS\Purchased Parts\[113 subfolders with their respective parts and assemblies] preferably without having to open any of them. I just want to batch apply this to an entire subfolder (with more sub folders) in my Vault project folder.