I am attempting to grab the document’s base point. I need to have instances report their own GPS positions in the document. So far, I have the instances report their coordinates via the following:
DB.FamilyInstance door = E as DB.FamilyInstance;
DB.LocationPoint location = door.Location as DB.LocationPoint;
X = location.Point.X;
Y = location.Point.Y;
Z = location.Point.Z;
ID = door.Id;
Next, I hope to combine this with getting the base point of the document. This part does not work yet:
using DB = Autodesk.Revit.DB;
using UI = Autodesk.Revit.UI;
using RIR = RhinoInside.Revit;
using RhinoInside.Revit.Convert.Geometry;
private void RunScript(object E, ref object A)
{
DB.Document activeDoc = Autodesk.Revit.UI.Events.CommandEventArgs.ActiveDocument;
DB.FilteredElementCollector locations = new DB.FilteredElementCollector(activeDoc).OfClass(typeof(DB.BasePoint));
foreach (var locationPoint in locations) {
DB.BasePoint basePoint = locationPoint as DB.BasePoint;
if (basePoint.IsShared == true) {
//this is the survey point
DB.Location svLoc = basePoint.Location;
A = basePoint.get_Parameter(DB.BuiltInParameter.BASEPOINT_EASTWEST_PARAM).AsDouble();
//projectSurvpntY = basePoint.get_Parameter(BuiltInParameter.BASEPOINT_NORTHSOUTH_PARAM).AsDouble();
//projectSurvpntZ = basePoint.get_Parameter(BuiltInParameter.BASEPOINT_ELEVATION_PARAM).AsDouble();
}
}
}
The end goal is to use the x-y-z output from the first script to approximate the GPS/coordinates of the objects by figuring out their position relative to the project base point.
Please let me know if you know how I can accomplish this. Your insight is very appreciated.