View classes in sheets and view templates.

View classes in sheets and view templates.

franjavigarciavalencia
Enthusiast Enthusiast
796 Views
3 Replies
Message 1 of 4

View classes in sheets and view templates.

franjavigarciavalencia
Enthusiast
Enthusiast

Hi, I have a couple of questions I'd need some help with:

 

-First, how would you check if any kind of view is being used already in a sheet (for instance, a ViewPlan or a View class)? This would be mainly to check if you are trying to create a sheet with a view already in use.

 

-Second, what is the class or how do you access view templates? I'd like to apply one to a View but I do not know what to use and can't seem to find anything clear.

 

Thank you in advance for your help!

0 Likes
Accepted solutions (1)
797 Views
3 Replies
Replies (3)
Message 2 of 4

jeremytammik
Autodesk
Autodesk
Accepted solution

To answer the first question, you can use the ViewSheet GetAllPlacedViews method:

 

https://www.revitapidocs.com/2020/816db942-4e9c-7278-7f59-53048becc46a.htm

 

If it gives you the opposite of what you need, you can invert the relationship (post from 2008!):

 

http://thebuildingcoder.typepad.com/blog/2008/10/relationship-in.html 

 



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

Message 3 of 4

jeremytammik
Autodesk
Autodesk

To answer the second, do these two recent threads help?

 

   



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

Message 4 of 4

franjavigarciavalencia
Enthusiast
Enthusiast

Thank you for the help.

For the first issue I had I used the method you suggested and it worked like a charm.

 

For the second one, I solved it using RevitLookup and used the ViewTemplateId and IsTemplate properties of the View class, in case anyone needs or wants to know. Thank you for your suggestions anyway!

0 Likes