Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Getting the views from a ViewSheetSet takes forever!

8 REPLIES 8
Reply
Message 1 of 9
hzamani
862 Views, 8 Replies

Getting the views from a ViewSheetSet takes forever!

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?

 

viewset.jpg

8 REPLIES 8
Message 2 of 9
jeremytammik
in reply to: hzamani

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

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 3 of 9
hzamani
in reply to: jeremytammik

Thanks Jeremy,

 

Created a repo here: https://github.com/HossZamani/RevitAPISamples/tree/master/FetchingViewsOfViewSheetSets

 

This is a result I'm getting on my machine:

 

sample.jpg

Message 4 of 9
jeremytammik
in reply to: hzamani

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:

  

ViewSheetSet.Views Benchmark.png

   

 Best regards,

 

Jeremy

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 5 of 9
hzamani
in reply to: jeremytammik

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.

Message 6 of 9
hzamani
in reply to: hzamani

@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? 

Message 7 of 9
jeremytammik
in reply to: hzamani

You have unusually lazy electrons.

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 8 of 9
hzamani
in reply to: jeremytammik

Yep. Weird that they are lazy only for this specific property.

Message 9 of 9
RPTHOMAS108
in reply to: hzamani

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.

Post to forums  

Rail Community


Autodesk Design & Make Report