uniquename + suffix

Hello!

I wonder how can i have uniquename and suffix in a single line code.
For instance if you run this line:

for points = 1 to 3 do (point size:1 name:(uniquename "Spine_"+"_helper"))

the output will be:

$Point_Helper:Spine001__helper @ [0.000000,0.000000,0.000000]
$Point_Helper:Spine001__helper @ [0.000000,0.000000,0.000000]
$Point_Helper:Spine001__helper @ [0.000000,0.000000,0.000000]

Notice that the objects in the scene don't have unique names at all. Objects has the same name!
I tried this line, but is not quite correct..

for points = 1 to 3 do (point size:1 name:(uniquename "Spine_") + "_helper")

the output is:

-- Unable to convert: "_helper" to type:

Long story short, it is possible in a single mxs line code, the final result to be:

$Point_Helper:Spine_001_helper
$Point_Helper:Spine_002_helper
$Point_Helper:Spine_003_helper

?

Thanks in advance,
-E.

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
jahman's picture

.

I wonder how can i have uniquename and suffix in a single line code.
Note that your last approach has nothing to do with a uniquename.

Eek's picture

Well, i found an easier way

Well, i found an easier way to do it.

for p = 1 to 3 do point size:20 name:("BaseName_" + p as string + "_suffix")

Thank you for the help,
-M.

jahman's picture

onliner

for p in (for i=1 to 3 collect point name:(uniqueName "point_")) do p.name += "_helper"

Eek's picture

Yap. This is another good

Yap. This is another good solution. Thanks!

miauu's picture

I don't know why you need one

I don't know why you need one line solution, but:

(
	pointsArr = for points = 1 to 3 collect(point size:1 name:(uniquename "Spine_"));for p in pointsArr do p.name += "_helper";
)

I prefere this way of coding:

(
	pointsArr = for points = 1 to 3 collect
	(
		point size:1 name:(uniquename "Spine_")
	)
	for p in pointsArr do p.name += "_helper"
)
Eek's picture

Thanks for the help miauu!

Thanks for the help miauu!

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.