Sets the analytical model projection to a preset value.
Namespace: Autodesk.Revit.DB.Structure
Assembly: RevitAPI (in RevitAPI.dll) Version: 17.0.0.0 (17.0.1090.0)
Since: 2015
Syntax
C# |
---|
|
Visual Basic |
---|
|
Visual C++ |
---|
|
Parameters
- selector
- Type: Autodesk.Revit.DB.Structure AnalyticalElementSelector
End of the analytical model.
- planeIdY
- Type: Autodesk.Revit.DB ElementId
Plane on to which analytical model may be projected in Y direction. Plane identifies a Level, a Grid, or a Ref Plane.
- projectionZ
- Type: Autodesk.Revit.DB.Structure StickElementProjectionZ
Preset value for Analytical Model Stick projection Z.
Examples

public void ChangeBeamProjection(FamilyInstance familyInstance)
{
AnalyticalModelStick ams = familyInstance.GetAnalyticalModel() as AnalyticalModelStick;
if (ams != null)
{
// Change the Z projection for the end of the beam
StickElementProjectionZ orgEndProj = ams.GetProjectionZ(AnalyticalElementSelector.EndOrTop);
StickElementProjectionZ newEndProj = StickElementProjectionZ.Bottom;
using (Transaction tran = new Transaction(familyInstance.Document, "ChangeProjection"))
{
tran.Start();
ams.SetProjection(AnalyticalElementSelector.EndOrTop, ElementId.InvalidElementId, newEndProj);
tran.Commit();
}
TaskDialog.Show("AnalyticalModelStick", "AnalyticalModelStick ID: " + ams.Id + "; \nOriginal ProjectionZ value was: " + orgEndProj + "; \nNew ProjectionZ value: " + newEndProj);
}
}

Public Sub ChangeBeamProjection(familyInstance As FamilyInstance)
Dim ams As AnalyticalModelStick = TryCast(familyInstance.GetAnalyticalModel(), AnalyticalModelStick)
If ams IsNot Nothing Then
' Change the Z projection for the end of the beam
Dim orgEndProj As StickElementProjectionZ = ams.GetProjectionZ(AnalyticalElementSelector.EndOrTop)
Dim newEndProj As StickElementProjectionZ = StickElementProjectionZ.Bottom
Using tran As New Transaction(familyInstance.Document, "ChangeProjection")
tran.Start()
ams.SetProjection(AnalyticalElementSelector.EndOrTop, ElementId.InvalidElementId, newEndProj)
tran.Commit()
End Using
TaskDialog.Show("AnalyticalModelStick", "AnalyticalModelStick ID: " + ams.Id.ToString + "; " & vbLf & "Original ProjectionZ value was: " + orgEndProj + "; " & vbLf & "New ProjectionZ value: " + newEndProj)
End If
End Sub
Exceptions
Exception | Condition |
---|---|
Autodesk.Revit.Exceptions ArgumentNullException | A non-optional argument was NULL |
Autodesk.Revit.Exceptions ArgumentOutOfRangeException | A value passed for an enumeration argument is not a member of that enumeration |