Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
tcaG6GZK
534 Views, 6 Replies

Change BOM-Structure of files in a Folder

Hi Guys

 

Since we are switching to VAULT soon, we need to change the BOM structure of many components. The best way to do this is with iLogic i asume.
We have in our assemblies the purchased parts in the structure tree stored in folders - now an iLogic rule should be created, which changes the content of a certain folder - best ask for the folder name with a query-box - from "standard" to "purchase".
Can someone create me such a rule???
thank you very much!!!

 

Tom

Tags (1)

Hi @tcaG6GZK,

 

Something like this should work:

 

 

oPane = ThisApplication.ActiveDocument.BrowserPanes("Model")
oFolder = oPane.TopNode.BrowserFolders.Item("My_Folder")

'look at each item in the folder
For Each oNode As BrowserNode In oFolder.BrowserNode.BrowserNodes
	oComp = oNode.NativeObject
	oComp.BOMStructure = BOMStructureEnum.kPurchasedBOMStructure
Next

 

 

 

Curtis_Waguespack_0-1687359860272.png

 

 

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

tcaG6GZK
in reply to: tcaG6GZK

Hi Curtis

I´m sorry -but that does not work - there is an error message

but i cant declare the name of the folder in the routine - so there should be a different way to do the job

 

thx anyway!!

cheers

Tom

 

Hi @tcaG6GZK ,

 

See this updated example. This will cycle through all of the browser folders, strip off BOM structure overrides, and set the component BOM structure to Purchased.

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

oPane = ThisApplication.ActiveDocument.BrowserPanes("Model")

For Each oFolder In oPane.TopNode.BrowserFolders
	'look at each item in the folder
	For Each oNode As BrowserNode In oFolder.BrowserNode.BrowserNodes			
		oComp = oNode.NativeObject
		oComp.BOMStructure = BOMStructureEnum.kDefaultBOMStructure 'remove BOMStructure override if present
		oComp.Definition.BOMStructure = BOMStructureEnum.kPurchasedBOMStructure			
	Next
Next

 

tcaG6GZK
in reply to: tcaG6GZK

 Hi Curtis

it works so far!! thx a lot.

But as i said - it needs to be done on specific folders, not on every folder.

Is it possible to choose a folder by mousclick and then start the routine??

thx in advance

Tom

Hi @tcaG6GZK 

 

See this updated example.

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

Dim oSelected As ObjectCollection
oSelected = ThisApplication.TransientObjects.CreateObjectCollection

For Each oItem In ThisDoc.Document.SelectSet
	If oItem.Type = ObjectTypeEnum.kBrowserFolderObject Then oSelected.Add(oItem)
Next

'Check that at least 1 is selected
If oSelected.Count = 0 Then
	MsgBox("no folder selected", , "iLogic") 
	Exit Sub 'exit rule
End if

oPane = ThisApplication.ActiveDocument.BrowserPanes("Model")

For Each oItem In oSelected
	oFolder = oPane.TopNode.BrowserFolders.Item(oItem.name)
	For Each oNode As BrowserNode In oFolder.BrowserNode.BrowserNodes
		oComp = oNode.NativeObject
		oComp.BOMStructure = BOMStructureEnum.kDefaultBOMStructure 'remove BOMStructure override if present
		oComp.Definition.BOMStructure = BOMStructureEnum.kPurchasedBOMStructure
	Next
Next

 

Ey Curtis

 

you made my day!!! it works perfect!!!

 

thx man!!!!

 

Cheers

Tom