Is there any way to calculate dimension of Area Element?

Is there any way to calculate dimension of Area Element?

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

Is there any way to calculate dimension of Area Element?

Anonymous
Not applicable

Hi All,

 

          As i have used some Areas using "Area Boundary" approach in a revit model. Now i am trying to get maximum allowed/exist dimensions(width/Length) of an area element. Can anyone suggest me any way to do this?

 

Area element is sorrouned by "area boundary lines".

 

Thanks

 

0 Likes
Accepted solutions (1)
1,807 Views
4 Replies
Replies (4)
Message 2 of 5

jeremytammik
Autodesk
Autodesk

Dear Vyom Dixit,

 

I am not sure I understand your question completely.

 

However, if the area element is a normal Revit database element, its normal bounding box should give you a rough idea of its maximum width and height.

 

I hope this helps.

 

Cheers,

 

Jeremy



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

Message 3 of 5

Anonymous
Not applicable

Yes, Jeremy. You are right. I am asking about Revit Database Area element. As i know, bounding box gives us min/max co-ordinates of 3D rectangular box.

Do we need to trace it's geometry or anything else to get the dimension like length/width/height.

 

 

0 Likes
Message 4 of 5

jeremytammik
Autodesk
Autodesk

I don't know. Try it out and let us know how it goes! Thank you.



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

0 Likes
Message 5 of 5

Anonymous
Not applicable
Accepted solution

Hi All,

 

Finally, i got the solution. As suggested by Jeremy, I had tried with "Area" element bounding box co-ordinates and got the success.

Below is the approach i have used to calculate width/length of an "Area" element. Let me know, if anyone find this useful.

 

Approach :-1. Get the min & max point of "Area" element bounding box.

                   2. Then get respective end points (end points from bounding box's min point  in both the directions).

                   3. Construct a Line by using Line.CreateBound().

                   4. Use length of the constructed line object.

Code :-

 

public static UV CheckFunctionalAreaDimensions(Element selectedElement, Document doc)
        {
            UV dimension = null;
            if (selectedElement != null)
            {
                Type _type = selectedElement.GetType();
                if (_type == typeof(Area))
                {
                    Area selectedAreaObject = selectedElement as Area;
                    BoundingBoxXYZ box = selectedAreaObject.get_BoundingBox(doc.ActiveView);

                    XYZ targetX = new XYZ(box.Min.X,box.Max.Y,box.Min.Z);
                    XYZ targetY = new XYZ(box.Max.X,box.Min.Y,box.Min.Z);

                    double width = CalculateAreaWidthLength(doc, box.Min, targetX);
                    double length = CalculateAreaWidthLength(doc, box.Min, targetY);

                    dimension = new UV(length, width);
                }
            }
            return dimension;
        }

 

 public static double CalculateAreaWidthLength(Document doc, XYZ startingPoint, XYZ endingPoint)
        {
            double length = 0;
            Line objLine = Line.CreateBound(startingPoint, endingPoint);
            length = objLine.Length;
            return length ;
        }