Hi there,
I'm making a simple call to the Views property of a ViewSheetSet and each sheet set is taking around 1.5 seconds to return the views! Is this normal? Any workaround to get the views quicker?
Sounds like a lot of time to me.
You might want to share a complete minimal reproducible case so other people can check what you are doing:
https://thebuildingcoder.typepad.com/blog/about-the-author.html#1b
Thanks Jeremy,
Created a repo here: https://github.com/HossZamani/RevitAPISamples/tree/master/FetchingViewsOfViewSheetSets
This is a result I'm getting on my machine:
Thank you for the sample code.
I integrated it into The Building Coder samples release 2020.0.148.3 to test it for you:
https://github.com/jeremytammik/the_building_coder_samples/compare/2020.0.148.2...2020.0.148.3
It took a long time to update to 2020 and save and produced six warnings that I could ignore.
I cannot reproduce the extremely long times that you report:
Best regards,
Jeremy
Thanks Jeremy. I tested this on Revit 2018, 2019 & 2020 (with latest bug fix installed) using different files and I'm still getting the same slow results I have been getting. These results are from a computer which I'm remote-desktopping into (vpn & remote connection). Could this have anything to do with how fast Revit can process some API calls?
Strangely, I tested this directly (without using remote desktop) on two different computers and the results are fine.
I'll investigate this further and will get back if I can find the problem.
@jeremytammik Today I tested this on the same computer(A) in three different scenarios:
1- Opening Revit locally on computer(A) : Average loop iteration ~60ms
2- Using another computer(B) on the same local network to remote desktop into the target computer(A) and running Revit on computer(A): Average loop iteration ~400ms
3- Using a computer(C) 30km away from computer(A), to connect to computer(A) using vpn and remote desktop and running Revit on computer(A): Average loop iteration ~1800ms
How weird is that?
You have unusually lazy electrons.
ViewSet can be enumerated directly without calling .GetEnumerator, it implements IEnumerable and .GetEnumerator is the required method to implement that.
There is a GetForwardIterator which seems to return a RevitAPI specific object i.e. IEnumerable doesn't require the implementation of a method called GetForwardIterator. So I don't know what that was added specifically for?
My experience is that if you've recently opened/printed views then those return quicker than ones you haven't.
Can't find what you're looking for? Ask the community or share your knowledge.