AllReferencedDocuments

AllReferencedDocuments

cadman777
Advisor Advisor
336 Views
1 Reply
Message 1 of 2

AllReferencedDocuments

cadman777
Advisor
Advisor

Hello,

I've struggled for over 2 hours trying to figure out how to access the iProperties in a part file from an assembly file.

So now I'm here inquiring from 'the experts'.

Would someone please educate me on how to access the iProperties using 'AllReferencedDocuments'?
Here's the code:

' Open and activate assembly file
Dim openDoc As Document = ThisDoc.Document
' Get the assembly filename
Dim oAssyFileName As String = ThisDoc.FileName(False)
'MessageBox.Show(oAssyFileName, "oAssyFileName")

' Access all part files in assembly
Dim docFile As Document
If openDoc.DocumentType = kAssemblyDocumentObject Then    
	For Each docFile In openDoc.AllReferencedDocuments

		' Access the part's properties and change the value of 'Authority' iProperty

	Next
	Else
		MessageBox.Show("You must have a valid Assembly document open before running this rule!", _
						"Wrong File Type!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
End If

Thanx! 

... Chris
Win 7 Pro 64 bit + IV 2010 Suite
ASUS X79 Deluxe
Intel i7 3820 4.4 O/C
64 Gig ADATA RAM
Nvidia Quadro M5000 8 Gig
3d Connexion Space Navigator
0 Likes
337 Views
1 Reply
Reply (1)
Message 2 of 2

cadman777
Advisor
Advisor

Never mine, I figured it out.

Here's the working code:

 

' Open and activate assembly file
Dim openDoc As Document = ThisDoc.Document

' Get the assembly filename
Dim oAssyFileName As String = ThisDoc.FileName(False)
'MessageBox.Show(oAssyFileName, "oAssyFileName")

' Access all part files in assembly
Dim docFile As Document
If openDoc.DocumentType = kAssemblyDocumentObject Then    
	For Each docFile In openDoc.AllReferencedDocuments
		' Access the part's properties and change the value of 'Authority' iProperty
         docFile.PropertySets("Design Tracking Properties").Item("Authority").Value = oAssyFileName
	Next
	Else
		MessageBox.Show("You must have a valid Assembly document open before running this rule!", _
						"Wrong File Type!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
End If

 

... Chris
Win 7 Pro 64 bit + IV 2010 Suite
ASUS X79 Deluxe
Intel i7 3820 4.4 O/C
64 Gig ADATA RAM
Nvidia Quadro M5000 8 Gig
3d Connexion Space Navigator
0 Likes