FilePropertySets - Iterate through all of the documents referenced by the assembly - ModelStates

FilePropertySets - Iterate through all of the documents referenced by the assembly - ModelStates

Marcus_Chong
Contributor Contributor
327 Views
2 Replies
Message 1 of 3

FilePropertySets - Iterate through all of the documents referenced by the assembly - ModelStates

Marcus_Chong
Contributor
Contributor

Hi,

 

I am trying to link up the value of filepropertysets from assembly to all other referenced documents. And at the same time, avoiding reference document that is ipart or library files. Some of my sub assemblies and parts are done with model states.

 

Is there a way to do it?

 

My code looks like this, but it is not working. is there anything that i have missed out.

 

Sub Main()

Dim oDoc As AssemblyDocument = ThisDoc.Document

Dim oRefDocs As DocumentsEnumerator = oDoc.AllReferencedDocuments

Dim oRefDoc As Document

For Each oRefDoc In oRefDocs

	oRefDoc.FilePropertySets.Item(3).Item("Project").Value = iProperties.Value("Project", "Project")

Next

End Sub

 

Please advise.

 

0 Likes
Accepted solutions (1)
328 Views
2 Replies
Replies (2)
Message 2 of 3

bradeneuropeArthur
Mentor
Mentor
Accepted solution

Try it this way:

 

Sub Main()

Dim oDoc As AssemblyDocument = ThisDoc.Document

Dim oRefDocs As DocumentsEnumerator = oDoc.AllReferencedDocuments

Dim oRefDoc As Inventor.Document

For Each oRefDoc In oRefDocs
Try
	oRefDoc.FilePropertySets.Item(3).Item("Project").Value = iProperties.Value("Project", "Project")
	Catch
	End Try
	

Next

End Sub

Regards,

 

Arthur Knoors

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 3 of 3

Marcus_Chong
Contributor
Contributor

That works perfectly!

 

Thank you Arthur for your great help!

0 Likes