Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
mblaptok
in reply to: JamieVJohnson2

Thank You, it works, i need to add :

WriteOutPropertySets

but.... can't this be done easier? i got just a few property to read/set from know one general drawing.

Read/set from model is much more easier.

SyntaxEditor Code Snippet

iProperties.Value("Project", "Part Number") = iProperties.Value("assembly.iam","Project", "Part Number")

I wonder why it can't be like this :

SyntaxEditor Code Snippet

iProperties.Value("assembly1.dwg","Summary", "Manager")= iProperties.Value("assembly2.dwg","Summary", "Manager")

 

SyntaxEditor Code Snippet

Class ThisRule

Shared my_title As String

Sub Main()

Dim docBase As Inventor.Document = ThisApplication.Documents.Open("f:\.......\ProjectName\Drawing1.dwg") 
Dim docChild As Inventor.Document = ThisApplication.Documents.Open("f:\.........\ProjectName\subassembly\Drawing2.dwg")


ReadOutPropertySets(docBase)
WriteOutPropertySets(docChild)

End Sub	


Public Sub ReadOutPropertySets(invDoc As Inventor.Document)
        Try
            Dim strPropertySets As String = "Inventor Property Sets" & vbCrLf & "{Property Set Name}" & vbCrLf & "{Property.DisplayName, Property.Name, Property.ID, Property.Type, Property.Expression, Property.Value}"
            For Each pset As PropertySet In invDoc.PropertySets
                strPropertySets += vbCrLf & pset.Name
                For Each prop As [Property] In pset
                    Try
                        strPropertySets += vbCrLf & "      " & prop.Name & prop.Value
						If prop.Name = "Title" Then my_title = prop.Value
											
                    Catch ex As Exception
                    End Try
                Next
            Next
            'MsgBox(strPropertySets)
        Catch ex As Exception
        End Try
    End Sub
	
	
Public Sub WriteOutPropertySets(invDoc As Inventor.Document)
        Try
            Dim strPropertySets As String = "Inventor Property Sets" & vbCrLf & "{Property Set Name}" & vbCrLf & "{Property.DisplayName, Property.Name, Property.ID, Property.Type, Property.Expression, Property.Value}"
            For Each pset As PropertySet In invDoc.PropertySets
                strPropertySets += vbCrLf & pset.Name
                For Each prop As [Property] In pset
                    Try
                        strPropertySets += vbCrLf & "      " & prop.Name & prop.Value
						If prop.Name = "Title" Then prop.Value=my_title
																		
                    Catch ex As Exception
                    End Try
                Next
            Next
            'MsgBox(strPropertySets)
        Catch ex As Exception
        End Try
    End Sub
	
End Class