I used “Rhino.MaterialName” method in RhinoScript to modify the material names. Those changes shows up in layer panel, but not in material editor. And when I save and reopen the file. All changes are gone.
Here is my code:
`
Sub AddPrefixToAllMaterials()
Dim arrMaterials, strMaterial, intIndex, strNewName, strPrefix
arrMaterials = Rhino.MaterialIds
strPrefix = Rhino.GetString("Prefix to add")
If IsArray(arrMaterials) Then
For Each strMaterial In arrMaterials
intIndex = Rhino.MaterialIndex(strMaterial)
strNewName = strPrefix + Rhino.MaterialName(intIndex)
If IsNull(strPrefix) Then
Rhino.Print("NewName is Null")
Else
Rhino.Print(strNewName)
Rhino.MaterialName intIndex, strNewName
End If
Next
End If
End Sub
Can somebody help? Thank you!