The Autodesk.Revit.DB.Visual.Mirror
class belongs to the Autodesk Revit API and is a part of the Visual
namespace. This class is used to perform mirror operations on graphical elements in Revit.
The Autodesk.Revit.DB.Visual.Mirror
class has the following properties:
Axis
: This property is used to get or set the axis of the mirror operation. It is of type Autodesk.Revit.DB.Line
.The Autodesk.Revit.DB.Visual.Mirror
class has the following methods:
Apply(Element elem)
: This method is used to apply the mirror operation to the specified Element
. The specified Element
will be mirrored across the Axis
property defined for this Autodesk.Revit.DB.Visual.Mirror
object.The following example demonstrates how to use the Autodesk.Revit.DB.Visual.Mirror
class to mirror a selected element:
// Get the currently selected element
Selection sel = uidoc.Selection;
Element elem = doc.GetElement(sel.PickObject(ObjectType.Element));
// Define the mirror axis
Line axis = Line.CreateBound(new XYZ(0, 0, 0), new XYZ(0, 0, 1));
// Create a new visual mirror object
VisualMirror mirror = new VisualMirror();
mirror.Axis = axis;
// Apply the mirror operation to the selected element
mirror.Apply(elem);
In this example, the Selection
object is used to allow the user to select an element to be mirrored. The Line
object is used to define the axis of the mirror operation, and a new instance of Autodesk.Revit.DB.Visual.Mirror
is created with this axis. Finally, the Apply
method is called on the VisualMirror
object to perform the mirror operation on the selected element.