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!
Solved! Go to Solution.
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