Project |
Exception | Condition |
---|---|
ArgumentNullException | A non-optional argument was null |
InvalidOperationException | Unable to use the project position's transform to calculate the point. |
When getting this value, the North/South, East/West, and Elevation values report the coordinates of the point similar to the Revit command "Report Shared Coordinates". To get the values of the transformations applied by this project location, pass XYZ.Zero.
If the project has acquired shared coordinates from a linked model, the shared coordinate transformation will be reflected in the coordinates of the transformed point returned by this property.
//get and set the value of the projectlocation public ProjectLocation GetProjectLocation(Autodesk.Revit.DB.Document document) { ProjectLocation currentLocation = document.ActiveProjectLocation; //get the project position XYZ origin = new XYZ(0, 0, 0); const double angleRatio = Math.PI / 180; // angle conversion factor ProjectPosition projectPosition = currentLocation.GetProjectPosition(origin); //Angle from True North double angle = 30.0 * angleRatio; // convert degrees to radian double eastWest = 30.0; //East to West offset double northSouth = 23.32; //North to South offset double elevation = 22.14; //Elevation above ground level //create a new project position ProjectPosition newPosition = document.Application.Create.NewProjectPosition(eastWest, northSouth, elevation, angle); if (null != newPosition) { //set the value of the project position currentLocation.SetProjectPosition(origin, newPosition); } return currentLocation; }