MoveSubElement Method


Move a face/edge/curve/vertex of the form, specified by a reference, and an offset vector.

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

Syntax

C#
public void MoveSubElement(
	Reference subElementReference,
	XYZ offset
)
Visual Basic
Public Sub MoveSubElement ( _
	subElementReference As Reference, _
	offset As XYZ _
)
Visual C++
public:
void MoveSubElement(
	Reference^ subElementReference, 
	XYZ^ offset
)

Parameters

subElementReference
Type: Autodesk.Revit.DBReference
The geometry reference of face/edge/curve/vertex
offset
Type: Autodesk.Revit.DBXYZ
The vector by which the element is to be moved.

Examples

CopyC#
public void MoveSubElement(Form form)
{
    if (form.ProfileCount > 0)
    {
        int profileIndex = 0;   // get first profile
        ReferenceArray ra = form.get_CurveLoopReferencesOnProfile(profileIndex, 0);
        foreach (Reference r in ra)
        {
            ReferenceArray ra2 = form.GetControlPoints(r);
            foreach (Reference r2 in ra2)
            {
                Point vertex = document.GetElement(r2).GetGeometryObjectFromReference(r2) as Point;

                XYZ offset = new XYZ(0, 15, 0);
                form.MoveSubElement(r2, offset);
                break;  // just move the first point
            }
        }
    }
}
CopyVB.NET
Public Sub MoveSubElement(form As Form)
    If form.ProfileCount > 0 Then
        Dim profileIndex As Integer = 0
        ' get first profile
        Dim ra As ReferenceArray = form.CurveLoopReferencesOnProfile(profileIndex, 0)
        For Each r As Reference In ra
            Dim ra2 As ReferenceArray = form.GetControlPoints(r)
            For Each r2 As Reference In ra2
                Dim vertex As Point = TryCast(document.GetElement(r2).GetGeometryObjectFromReference(r2), Point)

                Dim offset As New XYZ(0, 15, 0)
                form.MoveSubElement(r2, offset)
                    ' just move the first point
                Exit For
            Next
        Next
    End If
End Sub

See Also

ArchiLabs

Stop fighting Revit automation.

Build repeatable BIM design and documentation workflows with scripts, data, and AI in one place, without wrestling brittle one-off automations.

Try ArchiLabs →