Base class for all types of views in Autodesk Revit.
Namespace:
Autodesk.Revit.DB
Assembly:
RevitAPI
(in RevitAPI.dll) Version: 20.0.0.0 (20.1.1.1)
Syntax
Remarks
A view can display an image produced from a Revit model.
Views can be graphical (e.g. plans, elevations, or 3D views)
or textual (e.g. schedules). Views keep track of Elements that can be seen in them.
Examples
Copy
C#
private void Getinfo_View(Autodesk.Revit.DB.View view)
{
string message = "View: ";
//get the name of the view
message += "\nView name: " + view.Name;
//The crop box sets display bounds of the view
BoundingBoxXYZ cropBox = view.CropBox;
XYZ max = cropBox.Max; //Maximum coordinates (upper-right-front corner of the box).
XYZ min = cropBox.Min; //Minimum coordinates (lower-left-rear corner of the box).
message += "\nCrop Box: ";
message += "\nMaximum coordinates: (" + max.X + ", " + max.Y + ", " + max.Z + ")";
message += "\nMinimum coordinates: (" + min.X + ", " + min.Y + ", " + min.Z + ")";
//get the origin of the screen
XYZ origin = view.Origin;
message += "\nOrigin: (" + origin.X + ", " + origin.Y + ", " + origin.Z + ")";
//The bounds of the view in paper space (in inches).
BoundingBoxUV outline = view.Outline;
UV maxUv = outline.Max; //Maximum coordinates (upper-right corner of the box).
UV minUv = outline.Min; //Minimum coordinates (lower-left corner of the box).
message += "\nOutline: ";
message += "\nMaximum coordinates: (" + maxUv.U + ", " + maxUv.V + ")";
message += "\nMinimum coordinates: (" + minUv.U + ", " + minUv.V + ")";
//The direction towards the right side of the screen
XYZ rightDirection = view.RightDirection;
message += "\nRight direction: (" + rightDirection.X + ", " +
rightDirection.Y + ", " + rightDirection.Z + ")";
//The direction towards the top of the screen
XYZ upDirection = view.UpDirection;
message += "\nUp direction: (" + upDirection.X + ", " +
upDirection.Y + ", " + upDirection.Z + ")";
//The direction towards the viewer
XYZ viewDirection = view.ViewDirection;
message += "\nView direction: (" + viewDirection.X + ", " +
viewDirection.Y + ", " + viewDirection.Z + ")";
//The scale of the view
message += "\nScale: " + view.Scale;
// Scale is meaningless for Schedules
if (view.ViewType != ViewType.Schedule)
{
int testScale = 5;
//set the scale of the view
view.Scale = testScale;
message += "\nScale after set: " + view.Scale;
}
TaskDialog.Show("Revit",message);
}
Copy
VB.NET
Private Sub Getinfo_View(view As Autodesk.Revit.DB.View)
Dim message As String = "View: "
'get the name of the view
message += vbLf & "View name: " + view.Name
'The crop box sets display bounds of the view
Dim cropBox As BoundingBoxXYZ = view.CropBox
Dim max As XYZ = cropBox.Max
'Maximum coordinates (upper-right-front corner of the box).
Dim min As XYZ = cropBox.Min
'Minimum coordinates (lower-left-rear corner of the box).
message += vbLf & "Crop Box: "
message += vbLf & "Maximum coordinates: (" + max.X + ", " + max.Y + ", " + max.Z + ")"
message += vbLf & "Minimum coordinates: (" + min.X + ", " + min.Y + ", " + min.Z + ")"
'get the origin of the screen
Dim origin As XYZ = view.Origin
message += vbLf & "Origin: (" + origin.X + ", " + origin.Y + ", " + origin.Z + ")"
'The bounds of the view in paper space (in inches).
Dim outline As BoundingBoxUV = view.Outline
Dim maxUv As UV = outline.Max
'Maximum coordinates (upper-right corner of the box).
Dim minUv As UV = outline.Min
'Minimum coordinates (lower-left corner of the box).
message += vbLf & "Outline: "
message += vbLf & "Maximum coordinates: (" + maxUv.U + ", " + maxUv.V + ")"
message += vbLf & "Minimum coordinates: (" + minUv.U + ", " + minUv.V + ")"
'The direction towards the right side of the screen
Dim rightDirection As XYZ = view.RightDirection
message += vbLf & "Right direction: (" + rightDirection.X + ", " + rightDirection.Y + ", " + rightDirection.Z + ")"
'The direction towards the top of the screen
Dim upDirection As XYZ = view.UpDirection
message += vbLf & "Up direction: (" + upDirection.X + ", " + upDirection.Y + ", " + upDirection.Z + ")"
'The direction towards the viewer
Dim viewDirection As XYZ = view.ViewDirection
message += vbLf & "View direction: (" + viewDirection.X + ", " + viewDirection.Y + ", " + viewDirection.Z + ")"
'The scale of the view
message += vbLf & "Scale: " + view.Scale
' Scale is meaningless for Schedules
If view.ViewType <> ViewType.Schedule Then
Dim testScale As Integer = 5
'set the scale of the view
view.Scale = testScale
message += vbLf & "Scale after set: " + view.Scale
End If
TaskDialog.Show("Revit", message)
End Sub
Inheritance Hierarchy
System
Object
Autodesk.Revit.DB Element
Autodesk.Revit.DB View
Autodesk.Revit.DB.Analysis ViewSystemsAnalysisReport
Autodesk.Revit.DB TableView
Autodesk.Revit.DB View3D
Autodesk.Revit.DB ViewDrafting
Autodesk.Revit.DB ViewPlan
Autodesk.Revit.DB ViewSection
Autodesk.Revit.DB ViewSheet
Autodesk.Revit.DB Element
Autodesk.Revit.DB View
Autodesk.Revit.DB.Analysis ViewSystemsAnalysisReport
Autodesk.Revit.DB TableView
Autodesk.Revit.DB View3D
Autodesk.Revit.DB ViewDrafting
Autodesk.Revit.DB ViewPlan
Autodesk.Revit.DB ViewSection
Autodesk.Revit.DB ViewSheet