Announcement

Collapse
No announcement yet.

Maxscript help changing name of objects

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Maxscript help changing name of objects

    Hi all

    I have an array of objects
    inside

    Code:
        countBB = 0
        for obj in bbObjsArr do
            
            obj.name = "sdgfdgf" + countBB
    countBB = countBB + 1
    
    )
    But its not working
    even if I say
    thisnumber = countBB as String
    and then change the naming to
    obj.name = "sdgfdgf" + thisnumber

    it still doesnt work
    Kind Regards,
    Morne

  • #2
    Using 'as string' should work.

    This works for me:
    Code:
    (
    	local objsAR = getCurrentSelection()
    	for i = 1 to objsAR.count do objsAR[i].name = "NewName" + i as string
    )
    Dan Brew

    Comment


    • #3
      You could also use UniqueName() then you don't have to add the numbering yourself.
      www.suurland.com
      www.cg-source.com
      www.hdri-locations.com

      Comment


      • #4
        Originally posted by suurland View Post
        You could also use UniqueName() then you don't have to add the numbering yourself.
        Could you elaborate a little on that one?

        How would I use it in my example code?
        Kind Regards,
        Morne

        Comment


        • #5
          With your code it would be something like:

          bbObjsArr = getCurrentSelection()
          for obj in bbObjsArr do
          obj.name = uniquename "Name"
          www.suurland.com
          www.cg-source.com
          www.hdri-locations.com

          Comment


          • #6
            Originally posted by DanielBrew View Post
            Using 'as string' should work.

            This works for me:
            Code:
            (
                local objsAR = getCurrentSelection()
                for i = 1 to objsAR.count do objsAR[i].name = "NewName" + i as string
            )
            Originally posted by suurland View Post
            With your code it would be something like:

            bbObjsArr = getCurrentSelection()
            for obj in bbObjsArr do
            obj.name = uniquename "Name"
            Both work great, but for the current situation, uniquename worked better
            Thanks guys
            Kind Regards,
            Morne

            Comment

            Working...
            X