I have racked my brain trying to figure this one out. The attached script is for calculating the area of selected surfaces. I am having to use the paint method as per a previous post of mine, which seems to be a Revit glitch, when you select a face of an element that has an opening, Revit will randomly either only select the face or select the face and include the area of the opening in with the area of the face. I have not found a way to account for both conditions. Luckily when using the paint method, only the true area of the face is painted and not the area of the opening and I get the area of the material. So at least there is an alternative.
Now for my issue. For some reason, the Element.MaterialCollector node and the python script, which basically does the same thing, fires off before the surface is painted. So the painted area is not returned. I have tried passthrough as you can see and also transaction start and end nodes, but it still doesn’t work. Below is a clip of my graph. My script and a test project (Revit 2020) is attached. Any guidance would be greatly appreciated.
Area of Selected Faces Only.dyn (44.7 KB)
Face selection test.rvt (2.7 MB)