Change BOM-Structure of files in a Folder

Change BOM-Structure of files in a Folder

tcaG6GZK
Contributor Contributor
808 Views
6 Replies
Message 1 of 7

Change BOM-Structure of files in a Folder

tcaG6GZK
Contributor
Contributor

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

0 Likes
Accepted solutions (1)
809 Views
6 Replies
Replies (6)
Message 2 of 7

Curtis_Waguespack
Consultant
Consultant

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

EESignature

0 Likes
Message 3 of 7

tcaG6GZK
Contributor
Contributor

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

 

0 Likes
Message 4 of 7

Curtis_Waguespack
Consultant
Consultant

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

 

EESignature

0 Likes
Message 5 of 7

tcaG6GZK
Contributor
Contributor

 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

0 Likes
Message 6 of 7

Curtis_Waguespack
Consultant
Consultant
Accepted solution

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

 

EESignature

0 Likes
Message 7 of 7

tcaG6GZK
Contributor
Contributor

Ey Curtis

 

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

 

thx man!!!!

 

Cheers

Tom