Rotate Elevation Marker

I wasn’t sure how you were constructing your lines, etc. so I made a new code that constructs them within the Python script. In either case, the warning you got means it wanted an Autodesk.Revit.DB.Line and you were giving it a Dynamo Line so if you modify your axis input line to be UnwrapElement(IN[1]).ToRevitType() your code should work.

Here is the code I created; I haven’t modified it to handle lists yet but thought I would share now anyhow

import clr
import math

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

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

clr.AddReference('RevitServices')
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument

elev = UnwrapElement(IN[0])
angle_ = math.radians(IN[1])
view = UnwrapElement(IN[2])


TransactionManager.Instance.EnsureInTransaction(doc)

bbox = elev.BoundingBox[view]
diag = Line.CreateBound(bbox.Min,bbox.Max)
p1 = diag.Evaluate(0.5, True)
p2 = XYZ(p1.X, p1.Y,p1.Z+1)
axis_ = Line.CreateBound(p1, p2)
Autodesk.Revit.DB.ElementTransformUtils.RotateElement(doc, elev.Id, axis_, angle_)
	
TransactionManager.Instance.TransactionTaskDone()

OUT = elev

3 Likes