Help with Retrieving "Center" Reference for Structural Columns in Revit API

Help with Retrieving "Center" Reference for Structural Columns in Revit API

ahmadkhalaf7892
Advocate Advocate
777 Views
1 Reply
Message 1 of 2

Help with Retrieving "Center" Reference for Structural Columns in Revit API

ahmadkhalaf7892
Advocate
Advocate

Hello everyone,

I am trying to annotate structural columns by creating aligned dimensions between their centers. However, I’m facing an issue when attempting to retrieve the reference for the "Center (Left/Right)" using the GetReferenceByName method. It doesn't always work as expected for structural columns.

Here's a simplified explanation of my approach:

  1. I am working with a list of structural columns (FamilyInstance objects).
  2. For each column, I try to get its "Center (Left/Right)" reference like this:

    csharp Example : 
    Reference centerReference = pile.GetReferenceByName("Center (Left/Right)");

  3. Unfortunately, this sometimes returns with different results than what I want, which stops me from continuing with my dimension creation.

My Question:
Is there a reliable way to get the center reference ( the center point) of a structural column in the Revit API? If not through GetReferenceByName, is there another method or approach I can use to determine the geometric center or reference of the column as a reference for annotation ?

Any guidance or alternative suggestions would be greatly appreciated!

Thank you in advance for your help!

0 Likes
Accepted solutions (1)
778 Views
1 Reply
Reply (1)
Message 2 of 2

ahmadkhalaf7892
Advocate
Advocate
Accepted solution
https://thebuildingcoder.typepad.com/blog/2014/11/picking-pairs-and-dimensioning-family-instance-ori...

Found the solution here in this topic discussed before by Jeremy Tammik

static Reference GetFamilyInstancePointReference(
FamilyInstance fi )
{
return fi.get_Geometry( _opt )
.OfType<Point>()
.Select<Point, Reference>( x => x.Reference )
.FirstOrDefault();
}

Just make sure to change the options also.
0 Likes