Select all objects visible from a cameraview

I want to write a script that lists all of the objects visible from a certain camera. Is there a command that does this already(or easily), if not any suggestions would be greatly welcomed.

Hi,

I can't seem to find any MEL command that does that.

However, there is this MGlobal method in the API that does selection based on a rectangular bounding box:

MGlobal::selectFromScreen(x\_min, y\_min, x\_max, y\_max, MGlobal::kReplaceList);

(refer to the LassoTool plugin example)

I've tried this out and it selects all the objects visible in the *active* viewport (you could use setFocus to make the viewport you want active though). One thing to note is that what is visible in a viewport may not be what is seen by the camera (try adjusting the size of the viewport and do a render and you would understand what I mean). So, I guess there is still work to do and the MGlobal::selectFromScreen function may serve as a starting point.

rgds,
pipit

Thanks very much for the reply. I thought that was the case. I am trying to write a script for my company that counts only the triangles visible from a certain camera so that we can make sure we stay within our triangle budget. The Display Polygon Count option is useless for this, because it counts all of the faces on any object that is visible, even if only 8 faces out of 2000 are on the screen at once. I thought I needed to look into the API for the solution, but like all art majors, I find programming a bit daunting. No one seems to be able to tell me where to start. I have some C and Basic background from Grad School, but I have to acquire a compiler and learn C++ if I want to play with this stuff, and don't know where to look first. Or if my boss will front the $$$. Thanks for the tips though.