Revit 2020 API BasePoint - Unable to access parameter info of linked models.

Revit 2020 API BasePoint - Unable to access parameter info of linked models.

Dan_Mapes
Participant Participant
2,325 Views
7 Replies
Message 1 of 8

Revit 2020 API BasePoint - Unable to access parameter info of linked models.

Dan_Mapes
Participant
Participant

We have been using a python script to get the BasePoint info from all linked models in a project. We use this to create a project dashboard showing all linked models and their associated location information. In 2020 this stopped working and I need to figure out a solution.

 

In the 2020 API we cannot access the Built in parameters for BasePoint when using GetLinkedDocument()

Is there another method to get this info from a linked model in the 2020API?

linkDocuments = []
for linkType in linkTypes:
if DB.RevitLinkType.IsLoaded(doc, linkType.Id):
     linkDoc = None
     for li in linkInstances:
           if li.GetTypeId().IntegerValue == linkType.Id.IntegerValue:
                    linkDoc = li.GetLinkDocument()
            if linkDoc is not None:
                linkDocuments.append(linkDoc)       

basepoints = DB.FilteredElementCollector(linkDoc)\
            .OfClass(DB.BasePoint)
        basePoint = None
        surveyPoint = None
        # print(modelName)
        for e in basepoints:
            if e.IsShared:
                surveyPoint = e
                break
        for e in basepoints:
            if not e.IsShared:
                if e.get_Parameter(DB.BuiltInParameter.BASEPOINT_ANGLETON_PARAM) is not None:
                    basePoint = e
        surveyPointNS, surveyPointEW, surveyPointElev = (
            round(surveyPoint.get_Parameter(
                DB.BuiltInParameter.BASEPOINT_NORTHSOUTH_PARAM).AsDouble(), 3),
            round(surveyPoint.get_Parameter(
                DB.BuiltInParameter.BASEPOINT_EASTWEST_PARAM).AsDouble(), 3),
            round(surveyPoint.get_Parameter(
                DB.BuiltInParameter.BASEPOINT_ELEVATION_PARAM).AsDouble(), 3)
        )

 

 

2,326 Views
7 Replies
Replies (7)
Message 2 of 8

Anonymous
Not applicable

I have same issue with you. Did you solve it?

0 Likes
Message 3 of 8

Dan_Mapes
Participant
Participant

No I still have not found a solution to this.

0 Likes
Message 4 of 8

Yien_Chao
Advisor
Advisor

try to use this instead:

.Basepoint[0]

Or better :

BuiltInCategory.OST_ProjectBasePoint

BuiltInCategory.OST_SharedBasePoint

if you use .Basepoint, you will get a list of points (project and shared)

0 Likes
Message 5 of 8

RPTHOMAS108
Mentor
Mentor

You can use static methods:

 

BasePoint.GetProjectBasePoint(Document)

BasePoint.GetSurveyPoint(Document)

 

BasePoint class also has the following related properties:

Position

SharedPosition

IsShared

 

What you'll find is that instances of BasePoint with category OST_ProjectBasePoint do not have the following parameters attached if they are from a linked document:

BuiltInParameter.BASEPOINT_NORTHSOUTH_PARAM

BuiltInParameter.BASEPOINT_EASTWEST_PARAM

BuiltInParameter.BASEPOINT_ELEVATION_PARAM

BuiltInParameter.BASEPOINT_ANGLETON_PARAM

 

I don't know the reason for that but I also don't know what bearing these things have on how the link is orientated in the host project? You could have an infinite number of positions for project base point in a link project but still achieve the same relative position between the link and it's host.  Maybe it is important for IFC, I don't know. I've worked on project where I set project north 180 degrees opposite from the architect's project north (as that was the elevation more relevant to us) in the end the links still came together in the correct position and orientation using shared coordinates. Also important to remember that there is an active site and same link type can be placed in multiple alternate locations, so I don't know how that relates to your intended task.

 

0 Likes
Message 6 of 8

TripleM-Dev.net
Advisor
Advisor

In Revit 2020 a third BasePoint exists: BuiltinCategory.OST_IOS_GeoSite in addition to the 2 others categories mentioned by @Yien_Chao 

 

This third point, IsShared property = False, and doesn't have the BuiltinParameter.BASEPOINT_ANGLETON_PARAM.

There isn't a break in the second loop, so the retrieved BasePoint variable is overwritten by the third basepoint.

Stop the loop as soon as the BasePoint is retrieved OR compare against the BuiltinCategory value

 

- Michel

Message 7 of 8

moj
Contributor
Contributor

Did anyone solve this?

0 Likes
Message 8 of 8

moj
Contributor
Contributor

I solved it this way:

 

// Get the current project location
ProjectLocation currentLocation = m_selectedLinkedDocument.ActiveProjectLocation;

// Create a 0,0,0 origin
XYZ origin = new XYZ();

// Get the project position
ProjectPosition projectPosition = currentLocation.GetProjectPosition(origin);

// Get the Project Base Point parameters
double northSouth = projectPosition.NorthSouth;
double eastWest = projectPosition.EastWest;
double elevation = projectPosition.Elevation;
double trueNorth = projectPosition.Angle;