Good afternoon,
I’m making a script to create 3D views with the node AxonometricView.ByEyePointAndTarget().
This creates a new 3D view in Revit; however, the view is locked.
There is a method for unlocking the view in the Revit API Docs; however, this is a method for a View3D Class. The type returned from the node I am using is an AxonometricView type so I cannot use this method to unlock the view.
Does anyone know how to convert a AxonometricView (Dynamo 3D View Type) to a View3D (Revit 3D View Type) so I can use the Revit API methods?
Any help is appreciated, thank you.
I also would like to set the view template in the same process which also requires this conversion.
You can unwrap the view to make it Revit-owned and then use any of the methods from the API:
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(11, 1, 1)
name = 'new view 2'
view_dyn = Views.AxonometricView.ByEyePointAndTarget(pt_eye, pt_target, name)
view = UnwrapElement(view_dyn)
view.Unlock()
view.SaveOrientationAndLock()
2 Likes
That makes a lot of sense. I knew about unwrapping but was only familiar with using it in the context of inputs.
Very cool, thank you!
In case you weren’t aware…
Hope that’s of interest,
Mark