Rotate a Revit Element — Digitteck
Rotate a Revit Element
revit-api-dot-net·6 February 2018·2 min read

Rotate a Revit Element

Description

If you want to rotate an element (but not passing a value to the rotate parameter) you can use the transform util provided by Revit. Just make sure that the passed line is an Autodesk.Revit.DB.Line.

Solution

python
import re;
clr.AddReference("RevitAPI");
from Autodesk.Revit.DB import ElementId as DBElementId
from Autodesk.Revit.DB import ElementTransformUtils as DBElementTransformUtils
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument
TransactionManager.Instance.EnsureInTransaction(doc)

# _line is an Autodesk.Revit.DB.Line element

def rotateElement(element, _line, _angle):
    try:
        DBElementTransformUtils.RotateElement(doc, DBElementId(element.Id), _line, _angle);
        return element;
    except:
        return "Error Rotating";

OUT = rotateElement(IN[0], IN[1])

Tags

DynamoPythonVisual Programming
digitteck

© 2026 Digitteck