Inheritance Hierarchy:
System.Object
Autodesk.Revit.DB.Element
Autodesk.Revit.DB.View
Autodesk.Revit.DB.View3D
System.Object
Autodesk.Revit.DB.Element
Autodesk.Revit.DB.View
Autodesk.Revit.DB.View3D
Examples
private void Getinfo_View3D(View3D view3D)
{
string message = "View3D: ";
// The position of the camera.
XYZ eyePosition = view3D.GetOrientation().EyePosition;
message += "\nCamera position: " + eyePosition;
// Identifies whether the view is a perspective view.
if (view3D.IsPerspective)
{
message += "\nThe view is a perspective view.";
}
// The section box of the 3D view can cut the model.
if (view3D.IsSectionBoxActive)
{
BoundingBoxXYZ sectionBox = view3D.GetSectionBox();
// Note that the section box can be rotated and transformed.
// So the min/max corners coordinates relative to the model must be computed via the transform.
Transform trf = sectionBox.Transform;
XYZ max = sectionBox.Max; //Maximum coordinates (upper-right-front corner of the box before transform is applied).
XYZ min = sectionBox.Min; //Minimum coordinates (lower-left-rear corner of the box before transform is applied).
// Transform the min and max to model coordinates
XYZ maxInModelCoords = trf.OfPoint(max);
XYZ minInModelCoords = trf.OfPoint(min);
message += "\nView has an active section box: ";
message += "\n'Maximum' coordinates: " + maxInModelCoords;
message += "\n'Minimum' coordinates: " + minInModelCoords;
}
TaskDialog.Show("Revit", message);
}