Rotation of a TextNote

I know that this is an old post but I’m interested it trying to get the for loop to work. I’m confused as to where it needs to go to get lists to work. I’ve tried this with null results.

import clr
import math

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

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

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

doc = DocumentManager.Instance.CurrentDBDocument

#Preparing input from dynamo to revit
element = UnwrapElement(IN[0])
angle = IN[1]*math.pi/180

#calculte rotation axis:
#for angle in angle:
#	baseVector = element.BaseDirection
#	upVector = element.UpDirection
#	normalVector = baseVector.CrossProduct(upVector)
#	axis = Line.CreateUnbound(element.Coord, normalVector)

#Do some action in a Transaction
TransactionManager.Instance.EnsureInTransaction(doc)
for element,angle in (element,angle):
	baseVector = element.BaseDirection
	upVector = element.UpDirection
	normalVector = baseVector.CrossProduct(upVector)
	axis = Line.CreateUnbound(element.Coord, normalVector)
	ElementTransformUtils.RotateElement(doc, element.Id, axis, angle)
TransactionManager.Instance.TransactionTaskDone()

OUT = 0

I’ve also tried this: Still nothing, but I think I’m closer. From this thread using Kulkul’s example it seems like a need to used the for loop to create a list for the rotate command to use. In this case I would need three: element, axis, and angle.

https://forum.dynamobim.com/t/move-text-notes-by-cordinates/17113/13

import clr
import math

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

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

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

doc = DocumentManager.Instance.CurrentDBDocument

#Preparing input from dynamo to revit
element = UnwrapElement(IN[0])
angle = IN[1]

#element list
ids = list()
for element in element:
	ids.append(item.Id)
elementlist = List[ElementId](ids)

#angle list
anglelist = list()
for angle in angle:
	anglelist.append(angle*math.pi/180)

#calculte rotation axis:
axis = list()
for axis in angle:
	baseVector = element.BaseDirection
	upVector = element.UpDirection
	normalVector = baseVector.CrossProduct(upVector)
	axis.append(Line.CreateUnbound(element.Coord, normalVector))

#Do some action in a Transaction
TransactionManager.Instance.EnsureInTransaction(doc)
ElementTransformUtils.RotateElement(doc, elementlist, axis, anglelist)
TransactionManager.Instance.TransactionTaskDone()

OUT = 0

Here is what the custom node looks like:

rotate%20node%2001