To output a View from View3D

To output a View from View3D

Anonymous
Not applicable
492 Views
3 Replies
Message 1 of 4

To output a View from View3D

Anonymous
Not applicable
This code: 
__revit__.ActiveUIDocument.ActiveView
 
 Output:
<Autodesk.Revit.DB.View3D object at 0x00000000000001BF [Autodesk.Revit.DB.View3D]>
 
But I want the result of 'Autodesk.Revit.DB.View'....
I need your advice...! Thanks:)
 
 
0 Likes
Accepted solutions (1)
493 Views
3 Replies
Replies (3)
Message 2 of 4

Moustafa_K
Collaborator
Collaborator

 

View asview = __revit__.ActiveUIDocument.ActiveView as View

try something like the above. VIew3D class is inherited from View, so casting that to its parent class should be possible

 

Moustafa Khalil
Cropped-Sharp-Bim-500x125-Autodesk-1
Message 3 of 4

Anonymous
Not applicable

Thank you for your reply..!!

But I'm using Python so I'm sorry I couldn't apply your reply...:(

If there's any way you can at Python, please answer again...!!

0 Likes
Message 4 of 4

jeremytammik
Autodesk
Autodesk
Accepted solution

You question is a basic Python question. 

 

You are trying to convert from a derived class to its base class.

 

This is normally never necessary, since it happens automatically when needed.

 

If you really want to do it explicitly, search the Internet for 'upcast in python':

 

https://duckduckgo.com/?q=upcast+in+python

 



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