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

Possible? I only find Query nodes with 0.7.5.

Adding nodes to allow changing would be easy to add but at this point, it’s just query. What are you looking to achieve?


Animate sun movement, of course:) Could be possible with Python and API?

any luck?

i’m currently turning Dynamo script on automatic mode and moving sun manually in Revit, can it be done via Dynamo and/or Python / C#? i mean automatically moving sun


if you use solar study like this:

you can change the active frame via python:

import clr

from Autodesk.Revit.DB import *

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


sunSettings.ActiveFrame = frame


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


1 Like

cool, thanks maciek.

the only problem is how to integrate into existing Dynamo, i used frame list so for each frame, modification of Revit element is desired to be seen, in short, very similar to Revit OOTB Preview Solar Study.

1 Like

I am not sure if I understood you correctly, but maybe you can delay the code after each frame iteration. Smth like that:

Don’t know though, how it will work in Dynamo.

right, but it will only work if i convert all Dynamo nodes into Python code, hope i’m wrong

I don’t know any other way…
Also it might be necessary to commit a transaction after each sun position shift to see the results…

I am not sure what you’re exactly after but maybe it would be easier to take image snapshots at each frame?

thanks maciek, didn’t work even if i added transaction inside frame loop, there’s no way to “synchronize” w/ Dynamo nodes, as i said before, element modification needs to be done inside Python