Inside Sabertooth
Learn how Sabertooth uses 3ds Max to create 3D interactive projects, including HBO Go’s Game of Thrones interactive experience
  • 1/3
You are here: Forum Home / Autodesk 3ds® Max® / MaxScript / selecting multiple objects by name
  RSS 2.0 ATOM  
4 pages: 1.2.3.4 last

selecting multiple objects by name
Rate this thread
 
33972
 
Permlink of this thread  
avatar
  • Location: Los Angeles CA
  • Total Posts: 99
  • Joined: 16 May 2008 02:40 AM

Hi,

I want to select all nodes in a scene that have “moveall” in their name.
The following code only selects 1, how do I get all of them?

getnodebyname "moveall"

thx,
Brian



MotionBuilder 7.5 thru ...
3dsMax 2.5 thru ...

Replies: 0
avatar
  • Location: West Midlands, England, UK
  • Total Posts: 14445
  • Joined: 06 August 2007 11:06 PM
  • Permlink of this post

select $*moveall*

getNodeByName “somename” returns a Node - it doesn’t select the node.
getNodeByName “somename” all:true returns an array of nodes. Still doesn’t select them though.



Max 4.2 through 2013.
XP-64 (SP2)
NVidia 9800GTX-512 (Driver 266.58).
Core 2 Quad Q6600 2.4GHz, 8Gb Ram, DX9.0c.

Replies: 1
/img/forum/dark/default_avatar.png

Hi Steve,

I’ve been browsing trying to work out a script and came across this thread. 

I’d also like to select all objects in a scene begining with the same characters but I’d like to loop this and extract the chacters from an array.

ie My array has ( obj,def,asd)

In my loop I’d like to select all obj and process, followed by all def and then all asd.
So something like.

for i in objlist do
(
selobj = objlist
select $*selobj*
blah blah.
)

The select seems to pick up my variable as a literal though. I’ve tried as name and as string but it never seems to pick it up.

Is it just a syntax issue I’m having?  As you have probably guessed already, I’m not very good at scripting and am trying to learn (albeit slowly) but struggle more with the syntax than the overall structure of what I am doing.

Any help would be greatly appreciated.

Regards

Tim

Author: El-d

Replied: 28 October 2009 02:16 AM  
avatar

ok, thx. i just need to put all of them in an array and then display them for now.

getNodeByName "Moveall" all:true
print x

doesn’t work

sorry for the newbie questions, this is my first maxscript.

brian



MotionBuilder 7.5 thru ...
3dsMax 2.5 thru ...

Replies: 0
avatar
  • Anubis
  • Posted: 02 September 2009 04:36 PM

= $*Moveall* as array
print 
x


Max 9 through 2009, XP-Pro x64 SP2
ASUS EAH3450 Series (Driver 8.470).
Core 2 Duo E8400 3GHz, 4Gb Ram, DX9.0c.

Replies: 0
avatar

wher d u guys lurn all thes scripts,that are realy helpful,but i m trying since one year,its beyond my understanding how to begin wid?



Replies: 0
avatar
  • Location: West Midlands, England, UK
  • Total Posts: 14445
  • Joined: 06 August 2007 11:06 PM
  • Permlink of this post

1: Try writing a script
2: Use the Maxscript help to work out what you did wrong
3: if if doesn’t work, GOTO 2.

In other words, there’s no easy way. You just have to learn how to use it the same way as you learn to do anything. Trial and error, read the help, the forums, books. Try again.



Max 4.2 through 2013.
XP-64 (SP2)
NVidia 9800GTX-512 (Driver 266.58).
Core 2 Quad Q6600 2.4GHz, 8Gb Ram, DX9.0c.

Replies: 0
avatar
  • pen
  • Posted: 03 September 2009 03:48 AM

select $moveAll*

And to learn script well how about starting with all of the tutorials that ship with Max in the Max script help. It will takes lots of time. I have been at it for about 13 years.



Paul Neale
PEN Productions Inc.
penproductions.ca / paulneale.com
Master Classes for Max, Mudbox and Composite
DotNet Tutorials

MX Driver Car and Trailer Rig On Sale!

Replies: 0
avatar

Learning about scripting requires alot of trial and error.
Just like the other parts of the 3d universe.

I started out with the Getting Started from the 3ds max help section.
After two years on my own i have a decent understanding of how to build your own tools and macros.
Still have far to go if i want to do advanced plugins and stuff…



Replies: 0
avatar

ok, thx.

so now i can find all of my nulls, load them into an array, index them, and print them, but when i try to trimleft the name, i get the message: 

-- Unable to convert: $Null:C-Ly_Sheppard_Ctrl_M_Moveall @ [-125.099236,2982.529541,346.006775] to type: String

i thought the items in my array were already strings?

thx
brian



MotionBuilder 7.5 thru ...
3dsMax 2.5 thru ...

Replies: 0
avatar
  • Location: West Midlands, England, UK
  • Total Posts: 14445
  • Joined: 06 August 2007 11:06 PM
  • Permlink of this post

That depends on what is in the array. If you selected them by “x=$MoveAll* as array” then you have nodes, not names.

Try “print x[1].name”. If that works, then so do the new batteries in my crystal ball…

You need to post the actual code, not just the results of it, for us to have any chance of working out what’s wrong.

If you used “select $MoveAll*” then you have no array other than the built-in “Selection” collection, in which case you need to iterate over the collection “for obj in selection do” and you still need “obj.name” to get at the name.



Max 4.2 through 2013.
XP-64 (SP2)
NVidia 9800GTX-512 (Driver 266.58).
Core 2 Quad Q6600 2.4GHz, 8Gb Ram, DX9.0c.

Replies: 0
avatar

ok, here is what i have so far:

$*Moveall* as array
$*
Moveall*.count
for i in $*Moveall* do
 
as string
 trimleft i 
"$Null:C-Ly_"
 
print i

and here is the output:

#($Null:C-Ly_Sheppard_Ctrl_M_Moveall @ [-125.099236,2982.529541,346.006775], $Null:C-Ly_KroganGrunt_Ctrl_M_Moveall @ [-127.410202,2940.678467,345.898529], $Null:C-Ly_Thane_Ctrl_M_Moveall @ [-123.750160,2953.046143,345.656494])
3
OK
-- Error occurred in anonymous codeblock; filename: C:\Documents and Settings\bmckee\Desktop\LayoutQC.ms; position: 178
-- Unable to convert: undefined to type: String
undefined
undefined
OK

thx
brian



MotionBuilder 7.5 thru ...
3dsMax 2.5 thru ...

Replies: 0
4 pages: 1.2.3.4 last