Notifications
Clear all
[Closed] Add object count to name string
Aug 08, 2009 6:26 pm
The following code is selecting objects and welding their verticies. I am also trying to name each object appending an i to the end of the string. Pretty simple but it keeps throwing this error.
Unable to convert: 1 to type: String
(
Objs = for o in objects collect o
for o in Objs do
(
for i = 1 to objs.count do
(
x = o
x.name = o.name + "_mesh" + i
select o
subobjectLevel = 1
actionMan.executeAction 0 "40021"
$.EditablePoly.SetSelection #Vertex #{1..76}
$.EditablePoly.weldFlaggedVertices ()
subobjectLevel = 0
)
)
)
Where am I going wrong here?
2 Replies
Aug 08, 2009 6:26 pm
Instead of
x.name = o.name + "_mesh" + i
use
x.name = o.name + "_mesh" + i as string
The problem is that you are trying to add string with integers, and, much like oranges and apples, they just don’t mix. By using “i as string” you ask maxscript to transform it into a string, thus enabling the addition to work.