View analysis for multiple buildings



I’m wondering what the best way is to run a view analysis over multiple buildings. By default the input to ‘geometry’ is flattened. I want to have a single legends, but separate average view values per building.

If I keep the geometry input flattened I somehow need to reverse engineer the meshes back into its constituent parts plus recalculate the average view etc. This is proving very difficult because as soon as I disjoint mesh, I’ve lost the corresponding view results.

If I don’t flatten the geometry input, the mesh and the average view is correct (I think) but then I get multiple legends and when I go to recolor the mesh the lists don’t match.

I’m sure there must be an easy way to do this. Any thoughts?


It will help to upload the file, but i will try to flatten the results and join the meshes before connecting to the recolorMesh.


@AbrahamYezioro @mostapha

I’ve attached the file for convenience.190313 View analysis (87.3 KB)

This is the output with flatten geometry. It looks correct but I need the average views on a per building basis.

This is the output with grafted geometry. The analysis results are different to the flatten geometry one. Not sure if they are wrong or if the colours just need to be remapped (recoloured) across all the buildings rather than on a per building basis.

Doing what you said about flattening the results and joining mesh gives very different (incorrect) results.

This is the same issues for radiation analysis and sunlight analysis too btw.

Any thoughts?


Case 3 is completely wrong. Flattening the results and joining mesh just mess up all.
Cases 1 and 2 are ok. The difference in results is that when you flatten the geometry it also serves as contex (case 1). When you graft the geometry the analysis is done per object and the others are not considered as context (case 2).
In your case the context input is empty (no geometry). So what you need to do in order to get the average per building is to connect your geometry also to the context and you will be set.



Thanks @AbrahamYezioro.

Using Case 2 I can get the correct results (including average view per building) from the original component. But the recolouring mesh is still a problem. The results and the analysis mesh are different data structures. How can I use the recolour mesh component here? Do I need to re-calculate the result using the point is visible output - @mostapha ?

I know that I can feed the LegendPar into the view analysis component itself but doing this means that it will re-run each time someone changes a colour scheme. Better to run the analysis first, then recolour to minimise compute time.

190313 View analysis (430.7 KB)


@AbrahamYezioro @mostapha @chris

Looking at this again, I don’t think grafted geometry as an input works. It looks correct but the ‘pts is visible’ output is not. It should have only 3 results per testPt (one for each view point).

It should be more like this…

But them I am back to the beginning. How to re-color mesh and get average view per building. If I flatten the input I can get the correct results. But then there is no way for me to maintain a parallel data structure when I join and disjoin meshes.

190313 View analysis (434.8 KB)


@PaulWintour ,

Here is a way to get what you are after:

190313 View analysis (397.2 KB)

The issue you encountered is because the results are returned on a face-by-face basis for input breps. This was done to give a finer level of control on the output results but it creates some difficulties for alignment with the mesh faces. In any case, if all that you plug into the component is breps with single faces, you will always be able to get out results that align with the output meshes.


@chris Thanks for the reply. I knew their was an easier way to do it! The mesh recolouring works well and is displaying as intended, but I don’t think the average view is correct.

In your example, you are getting the average of the average. Unless all the surfaces have the same number of analysis points - this is going to give false results. For example, if you run it on just one building brep, the average is 46.2%. (My model might be slightly different to the one previously uploaded). This sounds like the correct value.

If you re-run the analysis using the faces from the brep grafted, the average is 29.9%. This doesn’t look right as I believe it is the average of the average (as per your example).

Flattening the input, the average is 46.2%. This sounds like the correct value.

So to run over multiple breps, I think we need to do something like this. ‘Debrep’ to get the number of faces per brep. Flatten the input. Run analysis but then use ‘pointIsVisible’ output to reconstruct the results for the average view . The Ladybug output will be the average view per development (all breps). By partitioning the results first (based on the number of faces per brep), then working out the average, will give you results per building. Using this method we get 46.2% for the first building and the development average matches the ladybug output.

Do you agree with this logic?

Also, is it fair to say that the sunlight hours analysis and radiation analysis components behave in the same way in terms of geometry input and results?


@PaulWintour ,

Ah, good point! Man, this took a lot more list management than I ever imagined but I am sure that the attached script does what you want (I apologize that I just gave up at one point and added a small python component)

190313 View analysis (417.1 KB)

Calculating radiation per building


I ran you’re script on my geometry and it returned the same values. So I think either method does the trick. Thanks for your help.



I’ve run into another problem. Is it possible the ‘mesh’ and the ‘mesh colors’ outputs from ‘remesh’ are not in the same order? I’m trying to get a separate mesh, one for each color but I’m getting weird results.

190327 View (439.2 KB)



I ended up doing the following but I’m sure there is a more efficient way to do this.


@PaulWintour ,

Sorry for the late response. I am not sure why all of the extra components were necessary. I was able to get one mesh for each color by processing the input data like so:

190327 View (413.6 KB)