How to get Project Base Point

How to get Project Base Point

Anonymous
Not applicable
6,450 Views
11 Replies
Message 1 of 12

How to get Project Base Point

Anonymous
Not applicable

Is there a way to get the project Base Point, and if so, how? I can get the Project Location, but I need the base point (N/S, E/W, Elevation, Angle from North).

0 Likes
6,451 Views
11 Replies
Replies (11)
Message 2 of 12

Anonymous
Not applicable

I should clarify that I want to do this in Revit 2011.

0 Likes
Message 3 of 12

Anonymous
Not applicable

 

Have you figured this out yet? I need the same for 2012.

0 Likes
Message 4 of 12

Anonymous
Not applicable

I found it in the elements.

There were two in my project - used Category.Name == "Project Base Point" to get the one I needed.

"E/W", "N/S", "Elev" and "Angle to True North" are in the ParametersMap.

0 Likes
Message 5 of 12

Anonymous
Not applicable

Can you elaborate on how you got access to the project  base point?

 

0 Likes
Message 6 of 12

grahamcook
Advocate
Advocate

I know this post is a few months old now but here is the code that i have used to get the Project Base Point:

 

ElementCategoryFilter siteCategoryfilter = new ElementCategoryFilter(BuiltInCategory.OST_ProjectBasePoint);

FilteredElementCollector collector = new FilteredElementCollector(doc);
IList<Element> siteElements = collector.WherePasses(siteCategoryfilter).ToElements();

foreach (Element ele in siteElements)
{
    Parameter paramX = ele.ParametersMap.get_Item("E/W");
    double X = paramX.AsDouble();

    Parameter paramY = ele.ParametersMap.get_Item("N/S");
    double Y = paramY.AsDouble();

    Parameter paramElev = ele.ParametersMap.get_Item("Elev");
    double Elev = paramElev.AsDouble();

    XYZ projectBasePoint = new XYZ(X, Y, Elev);
}

 

0 Likes
Message 7 of 12

Revitalizer
Advisor
Advisor

Dear grahamcook,

 

as far as I see, it would be better to adress parameters language independent.

In my German Revit,

    Parameter paramX = ele.ParametersMap.get_Item("E/W"); wouldn't work.

 

So one could better use

   Parameter paramX = ele.ParametersMap.get_Item(BuiltInParameter.BASEPOINT_EASTWEST_PARAM);

 

Analogously, there is BASEPOINT_NORTHSOUTH_PARAM for "N/S" and BASEPOINT_ELEVATION_PARAM for the elevation.

 

 

Thanks,

Revitalizer




Rudolf Honke
Software Developer
Mensch und Maschine





Message 8 of 12

grahamcook
Advocate
Advocate

Good spot.  Thanks for improving that.

0 Likes
Message 9 of 12

Revitalizer
Advisor
Advisor

Hi Graham,

 

I think this is an important point that should be added to nearly every topic that is about getting parameters.

Since there is an international audience in this forum, localization may matter.

 

 

Best regards,

Revitalizer




Rudolf Honke
Software Developer
Mensch und Maschine





0 Likes
Message 10 of 12

grahamcook
Advocate
Advocate

Just updated my routines to include the BuiltInParameters as suggested.  Had to slightly amend the parameter call given that get_Item cannot take a BuiltInParameter:

 

Parameter paramX = element.get_Parameter(BuiltInParameter.BASEPOINT_EASTWEST_PARAM);

0 Likes
Message 11 of 12

Revitalizer
Advisor
Advisor

Hi Graham,

 

I usually use element.get_Parameter() instead of element.parametersmap.get_Item().

Parametersmap.get_Item() needs a key string since ParametersMap is a dictionary or hashtable.

get_Parameter() overload accepts both a string value and the BuitInParameter enumeration.

 

To adress parameters "in the international way", I would advice to use the last one.

 

Bye,

Revitalizer




Rudolf Honke
Software Developer
Mensch und Maschine





0 Likes
Message 12 of 12

dkessler
Contributor
Contributor

There have been many updates to the Revit API since this post so the following code could be used where doc is a Document class:

XYZ projectBasePoint = new XYZ();
projectBasePoint = BasePoint.GetProjectBasePoint(doc).Position;