Community
3ds Max Programming
Welcome to Autodesk’s 3ds Max Forums. Share your knowledge, ask questions, and explore popular 3ds Max SDK, Maxscript and Python topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Select CatParent in MaxScript

6 REPLIES 6
Reply
Message 1 of 7
wagnerdesouza
486 Views, 6 Replies

Select CatParent in MaxScript

How i can check if my object in the selection is a CatParent and not a CatBone?

 

Thanks

 

6 REPLIES 6
Message 2 of 7

Assuming a single object selected:-
if classof selection[1] == CatParent then
   -- it's a cat parent
else
   -- it's not

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

Message 3 of 7

Yes! I have just one object selected. 

 

Great, i will try this!

 

Thanks

Message 4 of 7

Works fine! Thanks!

 

What is the number 1 inside of selection[] ?

And, do you know the diference between Cat_Parent and CatParent?

 

 

 

Message 5 of 7

Selection is an inbuilt array (well, technically a collection, but...) so if there's only 1 item selected it is in the 1st element of the array. [1] is an array index. Essentially the same using "$" i.e. classof $

Select an object, open the Maxscript Listener and type in "classof $" - if the selected object is a CatParent then that is what is displayed - literally. Also, the help has no entries for "Cat_Parent" but does for "CatParent" which is a bit of a clue 🙂

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

Message 6 of 7

Cool, 

 

I understood, i was using $.

 

I tryed different ways ex.:

if $.category == CatParent then

if $.category == Cat_Parent then

if $category... etc

 

But the key was classOf 🙂

 

Next step is to parse the string of layer name of cat to set the timeline range 🙂

 

Iam very newbie in maxscript, so i have some doubts

 

Thanks for help!

Message 7 of 7

Category is a somewhat different animal. Think of them as "groups" of objects of a similar type. A Box is part of the "#Standard_Primitives" category, a CatParent is part of the "#CAT_Objects" category and so on. Categories have their uses (they're used by the Display Panel "Hide by Category" for example) but aren't really specific enough for what you need in this instance.

Usage would be :- if $.category == #Standard_Primitives then...

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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums