Hello,
I am currently trying to amend the code with in the assembly python script.
at the moment i can select an assembly and chose its rotation. But i am trying to do this for every assembly within a project. I be leave it is the script at the very end that is the problem.
any help would be grateful.
Code within the python script:
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]
elems = tolist(UnwrapElement(IN[0]))
axis = tolist(IN[1])
rot = tolist(IN[2])
outList =
for e, a, r in zip(elems, axis, rot):
trans = e.GetTransform()
transRot = trans.CreateRotationAtPoint(a.ToXyz(),math.radians®, trans.Origin)
try:
TransactionManager.Instance.EnsureInTransaction(doc)
e.SetTransform(transRot)
TransactionManager.Instance.TransactionTaskDone()
outList.append(e)
except Exception, e:
outList.append(e.message)
OUT = outList
ChangeAssemblyTransform.dyn (6.0 KB)