Getting BoundingBoxXYZ of element relative to specific view

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I am trying to get the BoundingBoxXYZ of an element as it is viewed within a section view. I thought I had it nailed down using the following procedure, but I am now seeing that it is only working if the element & section view are aligned orthographically. Here is my code:
BoundingBoxXYZ viewBB = view.get_BoundingBox(view); // view = the ViewSection BoundingBoxXYZ elemBB = element.get_BoundingBox(doc.ActiveView); XYZ xfMin = viewBB.Transform.Inverse.OfPoint(elemBB.Min); XYZ xfMax = viewBB.Transform.Inverse.OfPoint(elemBB.Max);
If I run this code on an element & section that are aligned orthographically, the Min/Max values are correct according to the ViewSection's orientation.
Example:
For a rectangular box 2ft wide x 3ft tall x 1ft Tall
The BoundingBox Min/Max is reported as :
(-1.159410750, -49.417618267, 0.000000000)
(0.840589250, -47.917618267, -3.000000000)
If I run this code on the same element & section but rotated at a 45-degree angle, the Min/Max values as follows:
(-0.078885239, -49.417618267, 1.500000000)
(-0.078885239, -47.917618267, -3.500000000)
At first, I thought that the boundingbox being reported was still the size as if I were to analyze the bounding box in plan view. i.e. a rotated element's BoundingBox is going to be much larger than that of an element's BoundingBox that is completely aligned with the view's vertical and horizontal lines.
But if you look at the individual differences between the Max and Min X, Y, Z values it seems that the coordinates get re-arranged. For example, the Z coordinate of the the 45-dgree BoundingBox is now 2ft. Where 2ft should be the X dimension. Am I missing something simple here? Perhaps misuse, or not using the correct transform when I am getting the coordinates?
Thanks