Element.IsVisibleInViews node is too slow

Hi,
No I didn’t know it. I’m gonna try it.
I am also trying the script in another files to see if this is related to the file but it does not seem to be the case.

Hi @MVE1112,

I tested the Tune Up app and voilà the results.
image

@JC.Moreno, try:

@MVE1112. Thank you for the proposal. I’m gonna try this option it seems to be faster.

That was somebody else :slight_smile: @Vladimir

Yes. Sorry, I meant @Vladimir.

Hi Vladimir,

It seems that the time has been shortened by half. I assume this is because it is only looking at the specific view types. However, these are the view types we use.

I imagine these nodes search all types of categories. I would really only need it to look for modelling categories and not annotation categories.
One thing I have noticed is that the execution speed changes completely when I do the following :
I choose an element in a view
I run the script (it takes 6 minutes)
I select another element in the same view
I run the script (0.1 seconds)
I select another element in another view
The script takes 6 minutes again

Hi @Vladimir,

Thank you for your answer.
I get this error.

How many sheets do you have in project?
Try:
001.dyn (32.5 KB)

Hi,
I have 200.
Thank you. I’m gonna try.

Hi @Vladimir,

I made a test with your approach. The “AllElementsInView” node are still too slow. It takes about 8 minutes.
image
I saw that this node is using the “FilteredElementCollector” class and the “ToElements” method.
image
If I’m not wrong this filter is iterating every element either 2d or 3d. Maybe there are methods iterating only 3d elements. I’m not familliar with this aspects.

Just saw this. All about the same, maybe it will be faster?

My last attempt with previous code:
002.dyn (31.8 KB)
Python processes 64 views in 315 milliseconds in my project.

Hi,
It takes about 7.8 minutes.
image
I have 1526 views.
image

Hi @Vladimir,

I tried to reduce the number of view as much as possible but it still takes several minutes. I’m trying to figure out what part of the code is making it so slow. I’m guessing it’s the collector that has to go through each view. Even when it collects only a single category it is very slow.
I estimate about 300ms per view.

image

Is there a way to collect the elements even faster?

Maybe some specific type of view is slower than others?
Try to split and measure:

@JC.Moreno ,
I wonder if this is slow. 1500 views is a lot…

How many revit links are there in your model?
As far as I know, dynamo is also working on that behind the scenes without using them.

Hi @jw.vanasselt,

Very good point.
I think I have about 20 models in linked whose worksets are not open and therefore not loaded. I will check if this is what is causing the problem.

1 Like

Hi @jw.vanasselt,

I have tested the script on a smaller project with 300 views and the result is still slow. It takes 2 minutes to tell me in which views or sheet a selected element appears.
For me anything longer than 30 seconds starts to be a bit slow if I want my team to use it on a daily basis.

Is there a faster collector or filter?

Hi,

FilteredElementCollector(doc, view.Id) may be use a lot of resources, because if the view is not open, Revit regenerates the view in the background.

except if the search elements depend on a view (tag, detail, etc…), I don’t think there is a better solution