MirrorElement Method


Creates a mirrored copy of an element about a given plane.

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 24.0.0.0 (24.0.0.0)
Since:  2012

Syntax

C#
public static void MirrorElement(
	Document document,
	ElementId elementToMirror,
	Plane plane
)
Visual Basic
Public Shared Sub MirrorElement ( _
	document As Document, _
	elementToMirror As ElementId, _
	plane As Plane _
)
Visual C++
public:
static void MirrorElement(
	Document^ document, 
	ElementId^ elementToMirror, 
	Plane^ plane
)

Parameters

document
Type: Autodesk.Revit.DBDocument
The document that owns the element.
elementToMirror
Type: Autodesk.Revit.DBElementId
The element to mirror.
plane
Type: Autodesk.Revit.DBPlane
The mirror plane.

Examples

CopyC#
public void MirrorWall(Autodesk.Revit.DB.Document document, Wall wall)
{
    Reference reference = HostObjectUtils.GetSideFaces(wall, ShellLayerType.Exterior).First();
    Face face = wall.GetGeometryObjectFromReference(reference) as Face; // get one of the wall's major side faces

    UV bboxMin = face.GetBoundingBox().Min;
    Plane plane = Plane.CreateByNormalAndOrigin(face.ComputeNormal(bboxMin), face.Evaluate(bboxMin).Add(new XYZ(10, 10, 0)));
    // create a plane based on this side face with an offset of 10 in the X & Y directions

    ElementTransformUtils.MirrorElement(document, wall.Id, plane);
}
CopyVB.NET
Public Sub MirrorWall(document As Autodesk.Revit.DB.Document, wall As Wall)
    Dim reference As Reference = HostObjectUtils.GetSideFaces(wall, ShellLayerType.Exterior).First()
    Dim face As Face = TryCast(wall.GetGeometryObjectFromReference(reference), Face)
    ' get one of the wall's major side faces
    Dim bboxMin As UV = face.GetBoundingBox().Min
 Dim plane As Plane = Autodesk.Revit.DB.Plane.CreateByNormalAndOrigin(face.ComputeNormal(bboxMin), face.Evaluate(bboxMin).Add(New XYZ(10, 10, 0)))
    ' create a plane based on this side face with an offset of 10 in the X & Y directions


    ElementTransformUtils.MirrorElement(document, wall.Id, plane)
End Sub

Exceptions

ExceptionCondition
Autodesk.Revit.ExceptionsArgumentException elementToMirror cannot be mirrored. -or- The element elementToMirror does not exist in the document -or- The input element is a Sketch member and there is no Sketch in the edit mode to place this element in.
Autodesk.Revit.ExceptionsArgumentNullException A non-optional argument was null

See Also

ArchiLabs Desktop

Put AI to work inside Revit.

Give Desktop your instructions and project files to build Revit families, update model elements, and create views and schedules. Works directly in Revit and AutoCAD.

Explore Desktop →