Orient an existing 3D view in a Revit project to an isometric direction

Hello all,

I would like to orient an existing 3D view in a Revit project to an isometric southeast direction, for example, as the Home Orientation of the view cube of a 3D view.


It looks simple in Revit but I don’t find the way to do it using Dynamo.

If found the custom node “3DView Set Orientation” in the Package geniusloci, it works but I have to use an existing view as a reference to replicate the same orientation to a list of different 3D views. That means that I have to edit manually the orientation of one 3D view in Revit to make it work.

How can I set from Dynamo the orientation of a 3D view as the available in Revit: Orient to Direction, Orient to View, Orient to Plane…?

This node says it is based of the Ben Osborne script:

#From Ben Osborne
#http://dynamobim.org/forums/topic/view-orientation-and-python-script-refresh/

import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import 

clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)

clr.AddReference("RevitAPI")
import Autodesk

clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

The entries made in this node are stored as a list in the IN variables.
doc = DocumentManager.Instance.CurrentDBDocument

def ProcessList(_func, _list):
    return map( lambda x: ProcessList(_func, x) if type(x)==list else _func(x), _list )

def Unwrap(item):
    return UnwrapElement(item)

if isinstance(IN[0], list):
    controlview = ProcessList(Unwrap, IN[0])
else:
    controlview = [Unwrap(IN[0])]

if isinstance(IN[1], list):
    views = ProcessList(Unwrap, IN[1])
else:
    views = [Unwrap(IN[1])]

TransactionManager.Instance.EnsureInTransaction(doc)
for control in controlview:
	control.Unlock()
	viewSetting = control.GetOrientation()
	control.SaveOrientationAndLock()
for view in views:
	view.Unlock()
	view.SetOrientation(viewSetting)
	view.SaveOrientationAndLock()
TransactionManager.Instance.TransactionTaskDone()

#Assign the output to the OUT variable.
OUT = (controlview,views)

If somebody knows the solution it would be very helpful.

Thanks

https://www.revitapidocs.com/2019/882f774b-b290-14b8-2664-8f86ec42f458.htm

use the Revit lookup add-in to see what the parameters are for the :
XYZ eyePosition,
XYZ upDirection,
XYZ forwardDirection

Create a ViewOrientation3D with these parameters, set them to the view you desire.
Adjust accordingly. The control cube option will automatically adjust the distance to accommodate for the object (building) size, at least it did in my tests.

This may be what you need

1 Like