Rotate 3d isometric View

Hello everyone! Is there any way to rotate an existing 3d isometric view?. I have found the means to modify perspective views, but it doesn’t suit me.

It seems like the solution lies somewhere in DesignScript language or in Python. But i couldn’t find any specifications with system functions to set values in (view3d.orientation. etc.), either i noticed, sometimes people are using such functions in code blocks and it works.

Here i found some API, but i don’t understand how to translate it to Dynamo languages.
https://thebuildingcoder.typepad.com/blog/2013/04/setting-up-your-vieworientation3d.html

It seems to be a solution, but what if I need my view to be set by specified vector? For instance, if i’ve got a set of coordinates (i am not fluent in Python :upside_down_face:)

This should be very useful for creation animations. Thanks for any help :smiley:

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

Woooooooooow this is great, thank you! maybe you’ve got some specification with all commands and systm functions?

Umm… there’s a few places… Maybe these are useful?

https://apidocs.co/apps/revit/2019/d795a238-fc24-1875-e64f-a2bef56ae949.htm

1 Like

Why dynamo give IndexError: list Index out of range ['File "<string>", line25, in <module>\n']