For the iproperties I would use All Referenced Documents (1) This targets only the single file even if used in multiple sub assemblies so is the shortest route to target each documents. Then next is to loop through the documents and then actually retrieve the iproperties (2). I have left a document filter in there in case you want to filter for part/assembly documents using "kPartDocumentObject" / "kAssemblyDocumentObject".
.
Dim oAssyDoc As AssemblyDocument
oAssyDoc = ThisApplication.ActiveDocument
' Get the Design Tracking property set.
Dim AssyDesignPropSet As PropertySet
AssyDesignPropSet = oAssyDoc.PropertySets.Item("Design Tracking Properties")
' Get the Description property.
Dim AssyProj As Inventor.Property
AssyProj = AssyDesignPropSet.Item("Project")
'Get all of the referenced documents.
Dim oRefDocs As DocumentsEnumerator
oRefDocs = oAssyDoc.AllReferencedDocuments
'Iterate through the list of documents.
Dim oRefDoc As Document
For Each oRefDoc In oRefDocs
' If oRefDoc.DocumentType = DocumentTypeEnum.kPartDocumentObject Then
' Logger.Info("DisplayName: "& oRefDoc.DisplayName)'FileName
' Logger.Info("FullFileName: "& oRefDoc.FullFileName)'FilePath
' Get the Design Tracking property set.
Dim DesignTrackPropSet As PropertySet
DesignTrackPropSet = oRefDoc.PropertySets.Item("Design Tracking Properties")
' Get the Description property.
Dim RefProj As Inventor.Property
RefProj = DesignTrackPropSet.Item("Project")
Try
RefProj.Value = AssyProj.Value
Catch
Logger.Info("Read Only - "& oRefDoc.DisplayName )
End Try
'End If
Next
Also you can use a function with Vb.Net to reduce extra lines required and to also work with other iproperties easily.
Sub Main
Dim oAssyDoc As AssemblyDocument
oAssyDoc = ThisApplication.ActiveDocument
Dim oAssyProj As [Property]
oAssyProj= GetiProp(oAssyDoc,"Project")
Logger.Info(oAssyProj.Value)
'Get all of the referenced documents.
Dim oRefDocs As DocumentsEnumerator
oRefDocs = oAssyDoc.AllReferencedDocuments
'Iterate through the list of documents.
Dim oRefDoc As Document
For Each oRefDoc In oRefDocs
' If oRefDoc.DocumentType = DocumentTypeEnum.kPartDocumentObject Then
'Logger.Info("DisplayName: "& oRefDoc.DisplayName)'FileName
'Logger.Info("FullDocumentName: "& oRefDoc.FullDocumentName)'FilePath
Dim oRefProjNo As [Property]
oRefProjNo = GetiProp(oRefDoc,"Project")
Try
oRefProjNo.Value = oAssyProj.Value
Catch
Logger.Info("Read Only - "& oRefDoc.DisplayName )
End Try
'End If
Next
End Sub
Function GetiProp(oDoc As Document,iPropName As String)As [Property]
' Get the Design Tracking property set.
Dim DesignTrackPropSet As PropertySet
DesignTrackPropSet = oDoc.PropertySets.Item("Design Tracking Properties")
' Get the Description property.
Dim oProjProp As Inventor.Property
oProjProp = DesignTrackPropSet.Item(iPropName)
Return oProjProp
End Function
If this solved a problem, please click (accept) as solution.
Or if this helped you, please, click (like)
Regards
Alan