Hello,
at first sorry for my bad English. I found an ilogic who is working very well but I have one problem:
It is changing my material in librarys too. I like to change code in this way that it changes only parts which are in the
folder of the iam. Maybe something with ThisDoc.PathAndFileName(False)?
Here is the Code I use:
For Each ComponentOccurrence In ThisApplication.ActiveDocument.ComponentDefinition.Occurrences
If iProperties.Value ("Custom", "Werkstoff") = "1.4301" Then
If iProperties.MaterialOfComponent (ComponentOccurrence.Name) = "St 37-2" Then
iProperties.MaterialOfComponent (ComponentOccurrence.Name) = "1.4301"
End If
End If
If iProperties.Value("Custom", "Werkstoff") = "St 37-2" Then
If iProperties.MaterialOfComponent (ComponentOccurrence.Name) = "1.4301" Then
iProperties.MaterialOfComponent(ComponentOccurrence.Name) = "St 37-2"
End If
End If
Next
--------------------------------
Best Regards
Michael
Solved! Go to Solution.
Solved by rossano_praderi. Go to Solution.
Hi Michael,
if i understand your requirements you will solve your issue with something like this.
oDoc = ThisDoc.Document aPath = ThisDoc.Path For Each cOcc In oDoc.ComponentDefinition.Occurrences oPath = Replace(cOcc.Definition.Document.File.FullFileName, _ "\" & cOcc.Definition.Document.DisplayName, "") If oPath = aPath Then If iProperties.Value ("Custom", "Werkstoff") = "1.4301" Then If iProperties.MaterialOfComponent (cOcc.Name) = "St 37-2" Then iProperties.MaterialOfComponent (cOcc.Name) = "1.4301" End If End If If iProperties.Value("Custom", "Werkstoff") = "St 37-2" Then If iProperties.MaterialOfComponent (cOcc.Name) = "1.4301" Then iProperties.MaterialOfComponent(cOcc.Name) = "St 37-2" End If End If End If Next
Bregs
Rossano Praderi