Hi there,
I’m trying to mirror elements (furniture to be more precise) about one of their origin planes.
There seems to be no OOTB node for this so I’m using the Element.Mirror node from Clockwork package.
However, the results have been incredibly unreliable. While the script works as intended in one Revit document, it places the mirrored copies in seemingly random locations in another document. Even weirder, the Dynamo graph displays the calculated insertion points and mirror planes correctly, while the actual objects get placed incorrectly. Does anyone have experience with this behaviour?
Use this;
import sys
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
from Autodesk.Revit.DB import *
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
uiApp = DocumentManager.Instance.CurrentUIApplication
uidoc = uiApp.ActiveUIDocument.Document
dataEnteringNode = IN
furniture = UnwrapElement(IN[0])
flipTheFacing = IN[1]
locationPoint = furniture.Location.Point
facingDirection = furniture.FacingOrientation
x = locationPoint.Add(facingDirection.CrossProduct(XYZ.BasisZ))
y = x.Negate()
frame = Frame(locationPoint, x, y, facingDirection)
frame.Origin = locationPoint
frame.BasisZ = facingDirection
plane = None
if flipTheFacing:
plane = Plane.CreateByNormalAndOrigin(facingDirection, locationPoint)
else:
plane = Plane.CreateByNormalAndOrigin(facingDirection.CrossProduct(XYZ(0,0,1)), locationPoint)
TransactionManager.Instance.EnsureInTransaction(uidoc)
ElementTransformUtils.MirrorElement(doc,furniture.Id, plane)
doc.Delete(furniture.Id)
TransactionManager.Instance.TransactionTaskDone()
OUT = 0