Element.IsVisibleInViews node is too slow

I’m sorry but I don’t understand your question @MVE1112 . This node is in your script too.

I am afraid there’s not a faster way to do this as far as I know.

You need Dynamo to iterate over all your views and check every single element in the view to match it to the selected element. This takes time, especially with 700 views…

Someone more experienced might have a better suggestion but i dont think you can improve this speed that much…

Ok @MVE1112. I know that sometimes there are methods in the API faster than others. However, as you said, maybe someone else has the answer.
Thank you for helping.

@JC.Moreno, can you share rvt and dyn files? Have some idea to check.

Hello @Vladimir,

I’m not allowed to share the rvt file but only the dyn. Is it a problem to find out the solution?
Please find in attached the dyn file.
element_in_sheets_v1.dyn (51.9 KB)

try python from:

Hi @Vladimir
Thank you for helping. I used your script but it also takes a long time to run.

Hi JC,

Have you looked at what is taking the most time in your script with the Tuneup package?

I think it’s save to say what is causing the slow runtime here but it’s always good to check :slight_smile: It times the runtime of all nodes in your script

Also, archilab has a node “Element. FindAllViewsWhereElementIsVisible” and his own variant of the node you are using.

I am not too sure which package that is from.

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.