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: 

Structural Wall Rectangular Openings' Perimeter

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
Anonymous
570 Views, 2 Replies

Structural Wall Rectangular Openings' Perimeter

Hello!

I have a "Rectangular Straight Wall Opening" and I would like to know the perimeter of the rectangular cut.

I have tried to get the geometry of this element but it's GeometryElement is empty.

I know that the BoundingRect property provides two points, but this two point only is insufficient for the calculation.

 

Thanks for any tips in advance!

2 REPLIES 2
Message 2 of 3
Anonymous
in reply to: Anonymous

Why are the two points insufficent? I'm thinking if you flatten the to points then calculate the distance between the 2 this is the length of the opening, height can be calulated by subtracting the z value of the second point from the first.

 

For non rectangular openings you can loop through the boundry curves of the opening adding up the length of each curve.

 

Heres some code to explain:

 

            Dim perimeter As Double = 0

            If opening.IsRectBoundary Then

                Dim pt0 As New XYZ(opening.BoundaryRect(0).X, opening.BoundaryRect(0).Y, 0)
                Dim pt1 As New XYZ(opening.BoundaryRect(1).X, opening.BoundaryRect(1).Y, 0)

                Dim length As Double = pt0.DistanceTo(pt1)
                Dim height As Double = opening.BoundaryRect(1).Z - opening.BoundaryRect(0).Z

                perimeter = (2 * length) + (2 * height)
            Else

                For Each c As Curve In opening.BoundaryCurves
                    perimeter = perimeter + c.Length
                Next

            End If

 

Hope that helps,

 

Brett

Message 3 of 3
Anonymous
in reply to: Anonymous

Your solution works great!

 

Thank you very much!

 

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