How to import certain nodes (Revit>Views>AxonometricView) into python?

I’m trying to find which library to import into python to use AxnometricView node.

Also, in general, what is the best way to find the library to import to use certain nodes in python? I found this page which shows the import for ProtoGeometry, DSCoreNodes, Tessellation, and DSOffice; but, I’m not sure where to find others. Do I search the Dynamo github?

Thank you for any feedback!

The nomenclature is a bit confusing, but you actually have access to the Views nodes through importing everything from Revit.Elements:

import clr
clr.AddReference('RevitNodes')
from Revit.Elements import *

pt_eye = IN[0]
pt_target = IN[1]
name = IN[2]

newview = Views.AxonometricView.ByEyePointAndTarget(pt_eye, pt_target, name)

You would think that importing everything from Revit.Elements would only give you access to the Elements nodes under Revit.

2 Likes

Excellent, that works! How about Point.ByCoordinates? That doesn’t seem to be working for me either.

That would be from the ProtoGeometry library. Here is a modified version of the above script which does everything internally:

import clr

clr.AddReference('ProtoGeometry')
import Autodesk.DesignScript.Geometry as DS

clr.AddReference('RevitNodes')
from Revit.Elements import *

pt_eye = DS.Point.ByCoordinates(2, 1, 1)
pt_target = DS.Point.ByCoordinates(10, 1, 1)
name = 'new view'
new_view = Views.AxonometricView.ByEyePointAndTarget(pt_eye, pt_target, name)
3 Likes

I had the correct library, the “as DS” part is what I was missing. I was getting the error ‘type’ doesn’t have ByCoordinates(), but assigning the import a variable allowed me to reference the correct Point.

Thanks for your help! I really appreciate it.

1 Like

Heya,

For future reference this might help you work out where to dig around…

Revit Nodes>Elements>Views

And some other handy tips :slight_smile:

https://forum.dynamobim.com/t/autodesk-designscript-runtime-interface-geometry/24177/5?u=mark.ackerley

Cheers,

Mark

3 Likes