Selecting objects by "displayed" color

Hi,
I’m trying to figure a way of quickly flipping dir of faces in large projects.

Is there a way of selecting faces by their displayed color ? I mean : not “display color” but actual “displayed color”.

This way I could give a single color to backfaces in shaded view and select in a view all faces with that same color and then flip all of them at once. This would be of course view dependent.

Perhaps one of these scripts might help here:
UnifyNormalsView.py (1.3 KB)
UnifyNormalsZ.py (1.4 KB)

Thanks a lot ! I did try those scripts that I found in other similar topics, but in my case they are not working on all the surfaces…


some gets flipped and some not, I even tried to select a single surface from the top view. As you see in the attached file the green surfaces are backfaces, I tried to run both the Z script and the View script but no success.
I also work on very large files with thousands of surfaces and they can get very small, a “selby displayed color” would really be the solution for me

Can you post a Rhino file with a few surfaces and a view that are not responding to the script? Maybe I can figure out why. It’s clear that these scripts are intended for mostly planar surfaces as the surface direction is calculated using the normal at one point - the surface mid-domain. If the surface is more radically curved, that particular measurement spot may not be a reliable place based on the view.

Thanks, see the attached file, just a few surfaces but I have many like this, not many planar surfaces in my work.
unifynormals.3dm (619.0 KB)

(Note you do have one bad (invalid) object in the file you posted.)

In looking at the original script, I see that I specifically excluded non-planar surfaces from being selected, so obviously it will not work on your posted surfaces. Below is another version that works with non-planar surfaces - results may still be unpredictable, but try it out.

UnifyNormalsViewNP.py (1.9 KB)

Where this will fail is obviously where the “average” vector is parallel to the view vector. In the file below as a simple example, the script will fail to do anything in the Top or Front views because the proportions of visible front and back faces are equal. It does work in the Perspective or Right views.

HalfCyl45.3dm (55.9 KB)

Thanks so much, I’ll try and let you know !