Home Website Youtube GitHub

Simple Script Question

Hello. I haven’t done any script writing for 2 years now, and I’m just starting to get back into it. I am a little bit stuck so I hope its okay to ask my question here as I’m not too sure where else to turn to. I am trying to creat a simple script to count how many objects I have selected, for example I want to know how many locators I have selected in the viewport. Any suggestions?

You can do that with couple lines of code:

selection = cmds.ls(sl = 1)
print(len(selection))

1 Like

Thank you! I will try this out!

Edit: I just tried this and it worked perfectly! Thank you so much!

1 Like

You can also turn this option on to see how many objects you select interactively.
image
image

2 Likes