How can I change the Sun's position (Date & Time) in Revit with Dynamo?

Hi,

if you use solar study like this:
obraz

you can change the active frame via python:

import clr

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

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

#The inputs to this node will be stored as a list in the IN variables.
view = UnwrapElement(IN[0])
frame = IN[1]

doc = DocumentManager.Instance.CurrentDBDocument
sunSettings = view.SunAndShadowSettings

TransactionManager.Instance.EnsureInTransaction(doc)

sunSettings.ActiveFrame = frame

TransactionManager.Instance.TransactionTaskDone()

#Assign your output to the OUT variable.
OUT = 0

obraz

1 Like