Contains the geographical location information for the project's site.
Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 21.0.0.0 (21.1.1.109)
Syntax
C# |
---|
|
Visual Basic |
---|
|
Visual C++ |
---|
|
Remarks
Each project may have one site which dictates where in the world the project is based. On this site there may be several locations of the same project. These are represented by ProjectLocation objects. The site location object can be found by using the SiteLocation property on the Document object. The properties of this object can be changed such that it represents any location on the planet or to a known city. Cities already programmed into Revit can be found from the Cities property on the Application object.
Examples

// Get the SiteLocation instance.
Autodesk.Revit.DB.SiteLocation site = document.SiteLocation;
// Angles are in radians when coming from Revit API, so we
// convert to degrees for display
const double angleRatio = Math.PI / 180; // angle conversion factor
// Format the prompt information.
String prompt = "Current project's Site location information:";
prompt += "\n\t" + "Latitude: " + site.Latitude / angleRatio + " degrees";
prompt += "\n\t" + "Longitude: " + site.Longitude / angleRatio + " degrees";
// Give the user some information.
TaskDialog.Show("Revit",prompt);
// Change the SiteLocation property data.
site.Latitude = 0.5; // latitude information
site.Longitude = 0.5; // longitude information
site.TimeZone = -5; // TimeZone information

' Get the SiteLocation instance.
Dim site As Autodesk.Revit.DB.SiteLocation = document.SiteLocation
' Angles are in radians when coming from Revit API, so we
' convert to degrees for display
Const angleRatio As Double = Math.PI / 180
' angle conversion factor
' Format the prompt information.
Dim prompt As [String] = "Current project's Site location information:"
prompt += vbLf & vbTab & "Latitude: " & site.Latitude / angleRatio & "°"
prompt += vbLf & vbTab & "Longitude: " & site.Longitude / angleRatio & "°"
prompt += (vbLf & vbTab & "TimeZone: ") + site.TimeZone
' Give the user some information.
TaskDialog.Show("Revit", prompt)
' Change the SiteLocation property data.
site.Latitude = 0.5
' latitude information
site.Longitude = 0.5
' longitude information
site.TimeZone = -5
' TimeZone information
Inheritance Hierarchy
System Object
Autodesk.Revit.DB Element
Autodesk.Revit.DB ElementType
Autodesk.Revit.DB SiteLocation
Autodesk.Revit.DB Element
Autodesk.Revit.DB ElementType
Autodesk.Revit.DB SiteLocation