View Analysis

Hi Mostapha,

See attached. Trying, after the thread in the Comment section, to build a simple example for view analysis.

I get this error:

  1. Solution exception:global name ‘viewPoints’ is not defined

And don’t know how to move forward. It is strange. Before this error i get another one related to (unfortunately didn’t copied the error and now can’t reproduce) “JoinMesh”. After this one i input a new ViewAnalysis component and then the error shifted to ViewPoints.

The Ladybug is flying free :slight_smile:

Any ideas?


-A. (65.8 KB)

Hi Abraham,

There should be a reason that I always release the view analysis with a bug! I forgot an underline.

customHeading = ‘\n\nView Analysis’ + '\n#View Points = ’ + len(****_****viewPoints)

Now it is fixed and running. I will update the source code and the download link shortly:

Whenever you get an error that says “lb_preparation has no method called joinMesh” it means there is an older version of ladybug flying on your system. You just need to let the new Ladybug fly to overwrite the old version! :slight_smile:


Mostapha (67.2 KB)

Funny :slight_smile:


Is there a way to get the % for each of the points, instead of the weighted %?


Sure thing! Leave the viewPtsWeights input empty and viewStudyResult output should give you that for each test point.

Hmmm …

I meant that for each of the viewing points i want to know the % average they see the Geometry. The ViewResult shows the % for each patch on the geometry. The AverageView is giving only one value (even when i disconnected the viewPtsWeights.



Hi Abraham,

I see your point now. You are changing the test point and the target points in your question. Pretty interesting indeed! I’ve never thought of it this way! [I feel stupid now! Hahaha. Of course you should be able to so this.] I’ll modify the component later today so you can either input a point or a surface for test.

Even though the component is not designed for what you are looking for, it is still possible to get what you want out of it by creating some fake test surfaces. Checked the attached file!

Mostapha (72.7 KB)

Still funny :slight_smile:

Well. This is not what i meant at all but the results is the same. When i said “point” i always intended them to be the ViewPoints, as in the component. Now, you check if you see from each of those point a Geometry (say, a surface). So according to the grid size you have more or less of those. The thing a was asking is if it is possible to average those values, so i can know that viewPoint1 sees 80% of the geometry. What you did above gives the value but “backwards”. I think it should be simpler to average the values (less work for you, i suppose …, right?).

I think, but not sure, that you are doing something like this in the averageView output, but for all ViewPoints. I’m asking for this but for each VP.

I’m getting messy in this one.



Thanks for the comment. It reminded me that I actually considered this! I added an output to viewAnalysis component (“ptIsVisible”) at the last minute to let the users do stuff like this. :slight_smile:

It is similar to intersectionMtx: A list of 0s and 1s that shows if the test point is visible. You need to flip the matrix and count the number of 1s and divide it by the length of the list. Here is how you can set it up:

The result is 1% different from the last example. I think it happens because the test points are not exactly the same.

Hopefully I get it right this time! :slight_smile:

MostaphaMostapha (65.4 KB)

And this is really it!!! Great and thanks!!

In your “spare” time please explain the logic of the viewPtsWeights. I don’t get it. When all are 0 you get the average (~78 in this case), when all 1 i thought you should get the same … but i’m not. I get 100 (probably because one of the VP sees 100%).

Sorry to be such a pain today …


Nice! No problem. Thank you for bringing it up.

Weights define the importance of the view point. Just an input to give some freedom to user to use the component as they wish.

Let’s say you are testing for 4 viewPoints. In that case normally each viewPoint has the importance of 1/4 (25%), however in some cases you want to consider 100% view if you can see any of the points. You can use the weights input in cases similar to this. If you put 1 as the weight you are telling the component that if a testPoint sees this point it has 100% view. There is no true or false method in assigning the weights. It is all about your definition of view.

Hope it explains the idea to some extents. I owe you a video on this anyways! :slight_smile:


Hi Mostapha,

Thanks for the explanation. I’ll let you rest on this one … for now :-). Mainly because it is not so critical.


4 posts were split to a new topic: View Analysis ptsVisible

Hi. How can I have access to the files of this discussion? as I click on them and I get the error that this discussion is in the old forum.

This is not an error. It is/was an old discussion in the previous forum. You can find it here.


thank you @AbrahamYezioro

@AbrahamYezioro Hello! I have a problem similar to this, I would greatly appreciate some feedback!

Here is the link to the topic: