Hi everyone,
I trying to rotate a linked model using some code of python but I’m really newbie and I don’t understand the problem with the code.
starting from an other tread Moving a linked RVT file along the vector X and Y with Dynamo I modified the code to rotate instead of translate the linked model.
I try two different solution but with both I have some problems, can someone please help me.
Solution1:
"
import clr
clr.AddReference(‘ProtoGeometry’)
from Autodesk.DesignScript.Geometry import *clr.AddReference(‘RevitServices’)
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManagerclr.AddReference(‘RevitNodes’)
import Revit
clr.ImportExtensions(Revit.GeometryConversion)l = UnwrapElement(IN[0])
p1= UnwrapElement(IN[1]).ToXyz()
p2= UnwrapElement(IN[2]).ToXyz()
a = UnwrapElement(IN[3])
Ln= Line.CreateBound(p1, p2)doc = DocumentManager.Instance.CurrentDBDocument
TransactionManager.Instance.EnsureInTransaction(doc)
OUT = l.Location.Rotate(Ln, a)
TransactionManager.Instance.TransactionTaskDone()
";
Solution2:
"
import clr
clr.AddReference(‘ProtoGeometry’)
from Autodesk.DesignScript.Geometry import *clr.AddReference(‘RevitServices’)
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManagerclr.AddReference(‘RevitNodes’)
import Revit
clr.ImportExtensions(Revit.GeometryConversion)l = UnwrapElement(IN[0])
v = UnwrapElement(IN[1])
a = UnwrapElement(IN[2])doc = DocumentManager.Instance.CurrentDBDocument
TransactionManager.Instance.EnsureInTransaction(doc)
OUT = l.Location.Rotate(v, a)
TransactionManager.Instance.TransactionTaskDone()
";