Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to get Project Base Point

11 REPLIES 11
Reply
Message 1 of 12
rfeldman
5252 Views, 11 Replies

How to get Project Base Point

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).

11 REPLIES 11
Message 2 of 12
rfeldman
in reply to: rfeldman

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

Message 3 of 12
bketel
in reply to: rfeldman

 

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

Message 4 of 12
bketel
in reply to: bketel

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.

Message 5 of 12
mnelson
in reply to: rfeldman

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

 

Message 6 of 12
grahamcook
in reply to: rfeldman

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);
}

 

Message 7 of 12
Revitalizer
in reply to: grahamcook

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
in reply to: rfeldman

Good spot.  Thanks for improving that.

Message 9 of 12
Revitalizer
in reply to: grahamcook

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





Message 10 of 12
grahamcook
in reply to: rfeldman

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);

Message 11 of 12
Revitalizer
in reply to: grahamcook

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





Message 12 of 12
dkessler
in reply to: rfeldman

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;

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community