Faces of the rectangular column

Faces of the rectangular column

Anonymous
Not applicable
1,081 Views
4 Replies
Message 1 of 5

Faces of the rectangular column

Anonymous
Not applicable

Hello!

 

Is there a way to know which face of a rectangular column has an opening cut in from the API?

 

Thanks in advance!

0 Likes
1,082 Views
4 Replies
Replies (4)
Message 2 of 5

jeremytammik
Autodesk
Autodesk

Hi.

 

Yes, there may actually be an easy way to achieve this.

 

You can retrieve the geometry from the column and determine all its faces.

 

Then, for each face, you can ask Revit what element generated it:

 

      Options opt = app.Create.NewGeometryOptions();
      GeometryElement geo = beam.get_Geometry( opt );
 
      foreach( GeometryObject obj in geo )
      {
        Solid solid = obj as Solid;
 
        if( null != solid )
        {
          foreach( Face f in solid.Faces )
          {
            ICollection<ElementId> ids
              = beam.GetGeneratingElementIds( f );
 
            foreach( ElementId id in ids )
            {
              Element e = doc.GetElement( id );
              if( null != e.Category
                && e.Category.Id.IntegerValue.Equals(
                  (int) BuiltInCategory.OST_StructuralColumns ) )
              {
                columnIds.Add( id );
              }
            }
          }
        }
      }

 

If the generating element is not the column itself, it must be something else.

 

In that case, it may stem from a hole cut into the column.

 

Best regards,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 3 of 5

Anonymous
Not applicable

Thank you very much for the answer!

 

Can I use this to determine an openings perimeter and depth on a rectangular beam or column? Or I need to try something else?

0 Likes
Message 4 of 5

jeremy_tammik
Alumni
Alumni

Thank you for the appreciation. My pleasure. 

 

To answer your question:

 

I believe yes.

 

For sure: try it out.

 

Best regards,

 

Jeremy

 

 

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes
Message 5 of 5

Anonymous
Not applicable

I tried the code above with the addition of outputing the category of the generating object. The output didn’t show any of the openings. So I tried the opposite direction and queried the OST_ColumnOpening category. From that I know the perimeter and the host object. I work with rectangular columns/beams so the host has ’b’ and ’h’ parameters. My problem is that I don’t know which parameter from b and h use in a calculation as the depth of the opening. (Because an opening can be on any side of the object obviously.)

I would like to ask for an advice on this, please.

0 Likes