getFaceSelection doesn't work as expected
I'm trying to select only faces with material ID = 1 in my object.
512 is the total number of the object
381 is the number of faces with mat ID = 2
131 is the number of faces with mat ID = 3
so I wrote this:
$.selectByMaterial 2
polyList = getFaceSelection $
print polyList.count
What I obtain is "512"...but with the object still selected, if I click the polygon subselection button, there are 381 faces selected.
So, where I'm wrong?
From Maxscript help:
getFaceSelection [ ] [name: ]
getFaceSelection
Retrieves the face selection set, or the specified named selection set if the optional name: parameter is specified, as a BitArray. See the getVertSelection() method for more information.
Comments
..
Your code works properly, but at the end the polyList is bitarray and not array. So, to get the count of the faces you have to use
print polyList.numberset
and not .count. Go to bitarray topic in maxscript help file and you will see the difference between .count and .numberset properties.
You can use this instead of your code.
Tools and Scripts for Autodesk 3dsMax