hi there,
we discovered this phenomenon that after converting vray materials to rhino materials all materials get a slash “/” in front. the next thing happens by saving it to a windows folder, then the slash ist automatically replaced by a “_”.
we need the same namings because of replacing materials with newer settings in scenes with a lot of materials, e.g. by just drag and drop objects with the same material name with adjusted settings and using materials from our own team shared material library in a windows network folder.
is there a solution to tell rhino not to rename materials with this slash?
or if not, is it possible to rename multiple materials at once? (search & replace)
(renaming manually is a very timeconsuming option, because it has to be done in more than 300 scene files)
i tried to modify it by my self, on my side it looks like its doing its job:
(replace “x” and “y” values for your needs)
if a errormessage comes up, be shure, that the asterixes " are the same as show below!
import scriptcontext as sc
mats = sc.doc.Materials
for m in mats:
m.Name = m.Name.replace("x", "y")
m.CommitChanges()
to use it in a button you have to implement it like this in the command section:
(on my side it works also with multiple changes at once: / to none and # to _)
-_RunPythonScript (
import scriptcontext as sc
mats = sc.doc.Materials
for m in mats:
m.Name = m.Name.replace("/", "")
m.Name = m.Name.replace("#", "_")
m.CommitChanges()
)