View3D Class


Class for 3D views

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

Syntax

C#
public class View3D : View
Visual Basic
Public Class View3D _
	Inherits View
Visual C++
public ref class View3D : public View

Examples

Copy C#
private void Getinfo_View3D(View3D view3D)
{
    string message = "View3D: ";
    // The position of the camera.
    XYZ eyePosition = view3D.GetOrientation().EyePosition;
    message += "\nCamera position: (" + eyePosition.X + ", " +
                eyePosition.Y + ", " + eyePosition.Z + ")";

    // Identifies whether this is a perspective view. 
    if (view3D.IsPerspective)
    {
        message += "\nThe view is a perspective.";
    }

    // The section box of the 3D view cuts the model by its bounds.
    BoundingBoxXYZ sectionBox = view3D.GetSectionBox();
    XYZ max = sectionBox.Max; //Maximum coordinates (upper-right-front corner of the box).
    XYZ min = sectionBox.Min; //Minimum coordinates (lower-left-rear corner of the box).
    message += "\nSection Box: ";
    message += "\nMaximum coordinates: (" + max.X + ", " + max.Y + ", " + max.Z + ")";
    message += "\nMinimum coordinates: (" + min.X + ", " + min.Y + ", " + min.Z + ")";

    TaskDialog.Show("Revit",message);
}
Copy VB.NET
Private Sub Getinfo_View3D(view3D As View3D)
    Dim message As String = "View3D: "
    ' The position of the camera.
    Dim eyePosition As XYZ = view3D.GetOrientation().EyePosition
    message += ((vbLf & "Camera position: (" + eyePosition.X & ", ") + eyePosition.Y & ", ") + eyePosition.Z & ")"

    ' Identifies whether this is a perspective view. 
    If view3D.IsPerspective Then
        message += vbLf & "The view is a perspective."
    End If

    ' The section box of the 3D view cuts the model by its bounds.
    Dim sectionBox As BoundingBoxXYZ = view3D.GetSectionBox()
    Dim max As XYZ = sectionBox.Max
    'Maximum coordinates (upper-right-front corner of the box).
    Dim min As XYZ = sectionBox.Min
    'Minimum coordinates (lower-left-rear corner of the box).
    message += vbLf & "Section Box: "
    message += ((vbLf & "Maximum coordinates: (" + max.X & ", ") + max.Y & ", ") + max.Z & ")"
    message += ((vbLf & "Minimum coordinates: (" + min.X & ", ") + min.Y & ", ") + min.Z & ")"

    TaskDialog.Show("Revit", message)
End Sub

Inheritance Hierarchy

See Also