Contains the geographical location information for the project's site.
Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 24.0.0.0 (24.0.0.0)
Syntax
C# |
---|
public class SiteLocation : ElementType |
Visual Basic |
---|
Public Class SiteLocation _ Inherits ElementType |
Visual C++ |
---|
public ref class SiteLocation : public ElementType |
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
CopyC#
// 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
CopyVB.NET
' 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