Rotate 3d isometric View

Hey,

So, we can change a 3D view by vector like this… (thanks to RIE)

I suspect that you want more control, in which case you need 3 things… An origin, a direction to look and an Up direction…

Unfortunately we can’t extract a ‘target’ from a 3D view, I don’t think… we can’t find the ‘centre’.

So if we change the direction, we will look at something else… which isn’t what you want…

For an animation, that might not be a problem, you would naturally get a location point, create your Eye, Look Direction and Up, then use the location point to create new Eye and Directions…

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

import clr

clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *

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

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

doc = DocumentManager.Instance.CurrentDBDocument

#we need to unwrap Dynamo 'elements'
view = UnwrapElement(IN[0])
#we need to convert Dynamo Vectors & Points to Revit XYZs
forward = IN[1].ToRevitType()
eye = IN[2].ToRevitType()
up = IN[3].ToRevitType()

#start transaction
TransactionManager.Instance.EnsureInTransaction(doc)
#unlock view
view.Unlock()
#get up direction
#up = view.GetOrientation().UpDirection
#create a new orientation object based on our modified info
viewOrientation = ViewOrientation3D(eye, up, forward)
view.SetOrientation(viewOrientation)
#finish transaction
TransactionManager.Instance.TransactionTaskDone()

OUT = view

Hope that helps,

Mark

7 Likes