Here’s some Jscript that shows how to find clusters hidden by ToggleVisibility.
Note that clusters can also be hidden by adding a visibility property (Property > Polygon Cluster Visibility).
Finding those would be a separate, but more straightforward, task
// Get a polygon cluster
//var oCluster = Dictionary.GetObject( "cube.polymsh.cls.Polygon" );
var oCluster = Selection(0);
// Get array of polygon indices
var a = oCluster.Elements.Array.toArray();
// Get [basically undocumented] invisible polygon cluster
var oGeometry = Dictionary.GetObject( "cube" ).ActivePrimitive.Geometry;
var l_polyVisCluster = oGeometry.Clusters( siInvisiblePolygonsClusterName );
// Check if a polygon in our cluster is hidden
// It is possible for a poly to be in multiple clusters
// Otherwise we could assume that if a[0] is hidden,
// then the whole cluster is hidden
for ( var i = 0; i < a.length; i++ )
{
if ( l_polyVisCluster.Elements.FindIndex( a[i] ) == -1 )
{
LogMessage( "poly[" + a[i] + "] : Visible" );
}
else
{
LogMessage( "poly[" + a[i] + "] : Hidden" );
}
}