Search&Replace in 3dsmax

Hi there.

I’m not a max user at all but i have to prepare some stuff in max.
Is there an easy way to search an replace numbers or letters in Object/Material Names.

I would like to eliminate whiteSpace and special Character etc…

Do i need a script or is there something built-in?

Thxs :wink:

Hi!
never used that script but seems to do the job you need:
http://www.scriptspot.com/3ds-max/scripts/rp-renametools

but give a look at this page too, maybe you’ll find more scripts suitable for your needs:
http://www.scriptspot.com/3ds-max/scripts/tags/rename

Tried that script. Seems that it only supports objects. No Materials etc…

here’s an old one that will replace all ‘invalid’ chars (IE: Charachters that wouldn’t work in a filename) with a _ in materials and object names



toolTip="remove invalid chars (obj.name obj.mat.name)"
buttonText="remove invalid chars (obj.name obj.mat.name)"

--start macro

dno_regexreplace = (dotNetObject "System.Text.RegularExpressions.Regex" "[^\w]").Replace

ReplaceChar = "_"

fn replaceIt mat =
(
	if (mat != undefined) do
	(
		mat.name = dno_regexreplace mat.name ReplaceChar
		mat.name = dno_regexreplace mat.name ReplaceChar
	)
)--end function

sel = selection as array
for n = 1 to sel.count do 
(
	sel[n].name = dno_regexreplace  sel[n].name ReplaceChar
	
	if classof sel[n].material ==  Multimaterial then 
	(
		for i in 1 to sel[n].material.numsubs do
		(
			replaceIt sel[n].material.materiallist[i]
		)
	)
	else 
	(
		replaceIt sel[n].material
	)
)

Not the prettiest code, but its always worked well.