ScriptSpot

Forum topic · General Scripting

How to rename without white spaces in 3dmax objects

By johnsu6616 · 2018-05-04

Description

May I ask if I want to remove all white space form objects name.
I am a beginner and don't know how to do.
and thanks for answer.

fn FindAndReplaceAll str fnd rpl =
(
local addpos, fndcount = fnd.count
while ((addpos = findString str fnd) != undefined) do ( str = replace str addpos fndCount rpl )
)
sel=objects as array
for str in sel do FindAndReplaceAll str.name " " ""

Comments (4)

using this String Parser

fajar · 2018-05-09

using this


String Parser Methods : isSpace " MAXScript" --first character is space

.

johnsu6616 · 2018-05-10

Thank you for sharing the information.

.

johnsu6616 · 2018-05-07

thank you so much.
great example for me!
fix all object name without space and tab
and thanks again


sel=objects as array
for s in sel do
s.name = RemoveAllWhiteSpace s.name

.

jahman · 2018-05-05


fn RemoveAllWhiteSpace inputString = (

	local outputString = StringStream ""
	for x in filterString inputString " \t\r\n" do format "%" x to:outputString
	outputString as string

)

RemoveAllWhiteSpace " <- Space And Tab ->	"