How do you propose to determine the 'material' to be used for the [selected front-faces?]
I think the simplest way is for the user to be required to pre-select the color they want to use by choosing a color in the Materials windows.
Then run the script.
A. The script would use the color chosen by the user and create new color by copying it and adding a custom suffix or prefix to the name so it could later be identified to assist in reverting all surfaces with that color, if desired, back to the default front face color.
B. I would be happy to manually turn on monochrome style before running the script to assure the front faces are oriented properly, but I suppose if you want to build that in as feature when the script is run that would be up to you.
C. Perhaps the Paint Bucket cursor would appear and the user could paint the selection
or the script would just automatically apply the color to the pre-selection
Is this tool used on a selection of components/groups, or more globally on all such 'containers ?
The user would have to do a pre-selection of geometry (if there was nothing selected a message would occur to notify the user to make a selection and run the script again). The script would disregard components/sub-components found in a pre-selection. If inside an entity which contains subgroups, then a pre-selection of objects would still be required and pertain only to that pre-selection and its subgroups.
D. Hopefully, the user could use Ctrl-Z to undo the changes immediately after the script has run.
What about badly modeled geometry with textured back-faces etc ?
They would not be considered. Note: Trimble Connect currently can not render texture or patterns with transparency either.
As far as the logic for nested components goes I see why it would be very tricky.
I'm thinking that I could get by with only the un-painted front faces within nested groups being affected. I not sure, now that I have read your posting, that we want to include the faces of nested components as it could have unexpected results. Perhaps that is something that could wait for later on and add in if really needed.
For reverting the painted front faces back to the default front face color, could a script then search recursively for any geometry with the custom color name (mentioned above in Step "A.") and replace them with the default front face color? The user could then manually purge the custom color.