Ok i spent some additional thinking on HOW id explain this to you because clealy the answer is out of the scope in what you think, the best way i came up with is this:
Your thinking selection is a mode that preculdes all the other modes. As a analogy your thinking is like the following gui. Please execute it to see the idea.
CODE
window -width 150;
columnLayout -adjustableColumn true;
radioCollection;
text -align "left" -l "Polygon:";
separator -style "single";
radioButton -label "Vertex" -align "left";
radioButton -label "VertexFace" -align "left";
radioButton -label "Face" -align "left";
radioButton -label "UV" -align "left";
radioButton -label "Edge" -align "left";
radioCollection;
separator -style "single";
text -align "left" -l "nurbs:";
separator -style "single";
radioButton -label "ControlVertex" -align "left";
radioButton -label "SurfacePatch" -align "left";
radioButton -label "SurfacePoint" -align "left";
radioButton -label "SurfaceUV" -align "left";
radioButton -label "Hull" -align "left";
radioButton -label "Isoparam" -align "left";
separator -style "single";
text -align "left" -l "and so on...";
showWindow;
Fine, you may think that way. But thats not what maya is doing, and thats not what you are asking maya because you MUST ask one of the things maya understands other wise the answer is ambigious.
Its like your thinking what color is that car? And proceed asking is it red? is it white? But your assuming a car is allways of ONE color but it isnt a car can be BOTH red and white. Now in realitry mayas selection TYPE is not a aexclusive mode it is a list of unrelated switches.
On top of this maya has modes, controlled by selectMode now they are rather flexible you can have many intermixed modes. Theres only 2 things that can select components, the other is the selectMode -component; mode which is globally defined. But then inorder to faciliate mixed modes may has a objectComponent pseudo mode. Wich has a different set of selections.
Now simply to ask if selection is in isoparam mode you could ask:
selectType -q -isoparm;
and youd get the right answer, but unknown to you this is the right aswer FOR selectMode -component; if on the otherhand were to ask:
selectType -q -ocm -isoparm;
Now this would yield the answer for the pseudo mode objectComponent and it is NOT necceserily in the same mode as the above because its a different question. So to faciliate this querry youd need to ask:
CODE
$isoparam=false;
if (selectMode -q -component
)
{
$isoparam=selectType -q -isoparm
;
}
else
{
$isoparam=selectType -q -isoparm
;
}
A bit more reliable but this only defeats asking right question at right time, alas its not enough. Why because having in isoparam type on has ABSOLUTELY no correlation to if control vertex is on or not. in fact they can both be ON at the same time, and BOTH be pick able in the object at same time. Now at quick glance polygon cant be in 2 modes ate the same time. So your assumption applies to polygons unless your using a highhly specialized maya environment or old maya (theres might be scriptjob that governs this). So as a last closing let me show how the analogy gui could be assumed to look like looks like:
CODE
window -width 400 demonstrateTheApparent;
columnLayout;
$opt=optionMenu
;
menuItem -label "Component";
menuItem -label "ObjectComponent";
setParent..;
rowLayout -numberOfColumns 2
-columnWidth2 200 200
-adjustableColumn 2;
$com=columnLayout
;
radioCollection;
text -align "left" -l "Polygon:";
separator -style "single";
radioButton -label "Vertex" -align "left";
radioButton -label "VertexFace" -align "left";
radioButton -label "Face" -align "left";
radioButton -label "UV" -align "left";
radioButton -label "Edge" -align "left";
separator -style "single";
text -align "left" -l "nurbs:";
separator -style "single";
checkBox -label "ControlVertex" -align "left";
checkBox -label "SurfacePatch" -align "left";
checkBox -label "SurfacePoint" -align "left";
checkBox -label "SurfaceUV" -align "left";
checkBox -label "Hull" -align "left";
checkBox -label "Isoparam" -align "left";
separator -style "single";
text -align "left" -l "and so on...";
setParent..;
$ocom=columnLayout
;
radioCollection;
text -align "left" -l "Polygon:";
separator -style "single";
radioButton -label "Vertex" -align "left";
radioButton -label "VertexFace" -align "left";
radioButton -label "Face" -align "left";
radioButton -label "UV" -align "left";
radioButton -label "Edge" -align "left";
separator -style "single";
text -align "left" -l "nurbs:";
separator -style "single";
checkBox -label "ControlVertex" -align "left";
checkBox -label "SurfacePatch" -align "left";
checkBox -label "SurfacePoint" -align "left";
checkBox -label "SurfaceUV" -align "left";
checkBox -label "Hull" -align "left";
checkBox -label "Isoparam" -align "left";
separator -style "single";
text -align "left" -l "and so on...";
optionMenu -e -cc ("if (\"#1\"==\"Component\"){ layout -e -en 0 "+
$ocom+";layout -e -en 1 "+
$com+";}else{ layout -e -en 1 "+
$ocom+";layout -e -en 0 "+$com+";}") $opt;
layout -e -en 0 $ocom;
layout -e -en 1 $com;
showWindow;
In actuality even the optionbox group is a bunch of checkboxes.
PS: you have same conceptual (even worse) problem within the api too because ist how maya stores the info and your trying to make out of the sytem information that it does represent a subset of what the actual info is.
PPS: one fo the reasons you feel its slow iois possibly related to the fact that its inside a scriptjob and they are deferred by design better hook to the actuall commands.