C# - Getting the Base Point of the Document

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.

To get the base point of the active document, the error I am getting is:

1. Error (CS0120): An object reference is required for the non-static field, method, or property 'Autodesk.Revit.UI.Events.CommandEventArgs.ActiveDocument.get' (line 65)

Here is the documentation for the ActiveDocument property:

I have no idea what the debugger is saying when it needs an object reference…

Bumping this thread… any idea how to use the getter method for the ActiveDocument? I am not very familiar with C# syntax. Any help would be much appreciated

this sample code is
Is getting the instance parameters VIA BuiltinParameter method of the Base Pt Object. to mimic this you could simply select the project base pt in your project and get the parameters via this node as shown. would this be all you needed to do? do you need to embed this in a c# node?

1 Like