quick Noob question : search scene for object with string name

quick Noob question : search scene for object with string name

Anonymous
Not applicable
404 Views
5 Replies
Message 1 of 6

quick Noob question : search scene for object with string name

Anonymous
Not applicable
bit of a noob question,
I have an alphanumeric sting and i want to select the object in my scene with the same name as that string and xray it

objectString = "abc123"


--want to get this

$abc123.xray = on
0 Likes
405 Views
5 Replies
Replies (5)
Message 2 of 6

Steve_Curley
Mentor
Mentor

myObj = getNodeByName "abc123"
myObj.xray = True


See the Node Common Properties page in the Maxscript help for extra options.

Max 2016 (SP1/EXT1)
Win7Pro x64 (SP1). i5-3570K @ 4.4GHz, 8Gb Ram, DX11.
nVidia GTX760 (2GB) (Driver 430.86).

0 Likes
Message 3 of 6

Anonymous
Not applicable
Cool,
Thanks
that works better than the loop i was going to use

for obj in objects do
(
if obj.name == obj1 or obj.name == obj2 then
obj.xray = off

)
0 Likes
Message 4 of 6

Steve_Curley
Mentor
Mentor
If the names are consistent (box01, box02, box03 etc) then

for obj in $box* do
obj.xray = True


Look up "For Loops" - lots of possibilities there.

Max 2016 (SP1/EXT1)
Win7Pro x64 (SP1). i5-3570K @ 4.4GHz, 8Gb Ram, DX11.
nVidia GTX760 (2GB) (Driver 430.86).

0 Likes
Message 5 of 6

Anonymous
Not applicable
If the names are consistent (box01, box02, box03 etc) then

for obj in $box* do
obj.xray = True


Look up "For Loops" - lots of possibilities there.
If the names are consistent (box01, box02, box03 etc) then

for obj in $box* do
obj.xray = True


Look up "For Loops" - lots of possibilities there.


In fact, thanks to the fact property assignments are "mappable", one can even say

$box*.xray = true
0 Likes
Message 6 of 6

Steve_Curley
Mentor
Mentor

In fact, thanks to the fact property assignments are "mappable", one can even say

$box*.xray = true


Or even, if appropriate
geometry.xray = true

This thread is related, I believe, to this one where it did, in fact, seem appropriate - given the original code.

Max 2016 (SP1/EXT1)
Win7Pro x64 (SP1). i5-3570K @ 4.4GHz, 8Gb Ram, DX11.
nVidia GTX760 (2GB) (Driver 430.86).

0 Likes