Hello,
My question is not new, here is link to discussion and solution looks good. But I have the issue like on picture below. The problem that I don’t know how to fix that, according apidocs this method still available.
import clr
import math
clr.AddReference("ProtoGeometry")
from Autodesk.DesignScript.Geometry import *
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
app = DocumentManager.Instance.CurrentUIApplication.Application
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)
clr.AddReference("RevitAPI")
from Autodesk.Revit.DB import *
def tolist(obj1):
if hasattr(obj1,"__iter__"): return obj1
else: return [obj1]
run = tolist(IN[0])[0]
elems = tolist(UnwrapElement(IN[1]))
axis = tolist(IN[2])
rot = tolist(IN[3])
outList = []
if run:
for e, a, r in zip(elems, axis, rot):
trans = e.GetTransform()
transRot = trans.CreateRotationAtPoint(a.ToXyz(),math.radians(r), trans.Origin)
try:
TransactionManager.Instance.EnsureInTransaction(doc)
e.SetTransform(transRot)
TransactionManager.Instance.TransactionTaskDone()
outList.append(e)
except Exception:
outList.append(e.message)
OUT = outList
else:
OUT = "Please set Run to True"