Namespace:
Autodesk.Revit.DB
ProjectLocation
Class
Description:
A representation of a specific instance and location of the current project.
A representation of a specific instance and location of the current project.
Remarks:
When using shared coordinates, ProjectLocations can be used to specify specific locations for instances of a linked model. A ProjectLocation keeps track of the position of an instance in relationship to the project's SiteLocation.
By default, each Revit project contains at least one named location, called Internal. Existing ProjectLocation objects can be found by using the ProjectLocations property on the Document object. New project locations can be created by duplicating an existing project location using the Duplicate method, and modifying the location's project position.
See also SiteLocation
Inheritance Hierarchy:
System.Object
Autodesk.Revit.DB.Element
Autodesk.Revit.DB.Instance
Autodesk.Revit.DB.ProjectLocation
System.Object
Autodesk.Revit.DB.Element
Autodesk.Revit.DB.Instance
Autodesk.Revit.DB.ProjectLocation
Examples
public void ShowActiveProjectLocationUsage(Autodesk.Revit.DB.Document document)
{
// Get the project location handle
ProjectLocation projectLocation = document.ActiveProjectLocation;
// Show the information of current project location
XYZ origin = new XYZ(0, 0, 0);
ProjectPosition position = projectLocation.GetProjectPosition(origin);
if (null == position)
{
throw new Exception("No project position in origin point.");
}
// Format the prompt string to show the message.
String prompt = "Current project location information:\n";
prompt += "\n\t" + "Origin point position:";
prompt += "\n\t\t" + "Angle: " + position.Angle;
prompt += "\n\t\t" + "East to West offset: " + position.EastWest;
prompt += "\n\t\t" + "Elevation: " + position.Elevation;
prompt += "\n\t\t" + "North to South offset: " + position.NorthSouth;
// 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
SiteLocation site = projectLocation.GetSiteLocation();
prompt += "\n\t" + "Site location:";
prompt += "\n\t\t" + "Latitude: " + site.Latitude / angleRatio + "��";
prompt += "\n\t\t" + "Longitude: " + site.Longitude / angleRatio + "��";
prompt += "\n\t\t" + "TimeZone: " + site.TimeZone;
// Give the user some information
TaskDialog.Show("Revit",prompt);
}