- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi forum,
Im trying to know the widht and height of legend componentes on legend views. For this, my approach has been this function with BoundingBoxes in a macro:
public void WidhtAndHeight()
{
UIDocument uidoc = this.ActiveUIDocument;
Autodesk.Revit.DB.Document doc = this.ActiveUIDocument.Document;
Reference myRef = uidoc.Selection.PickObject(ObjectType.Element);
Element ele = doc.GetElement(myRef);
BoundingBoxXYZ BB = ele.get_BoundingBox(uidoc.ActiveView);
double width = BB.Max.X - BB.Min.X;
double height = BB.Max.Y - BB.Min.Y;
width = width *0.3048; //convert feet to meters
height = height *0.3048; //convert feet to meters
TaskDialog.Show("HELLO", "Width is: " + width.ToString());
TaskDialog.Show("HELLO", "Height is: " + height.ToString());
}
It looks to me like it should work, and it fact it does, but not always. This are the result Im getting applying this function to some windows and doors:
The dimension mark the real size. While the number down every door/window its the result Im getting with this function. As you can see, Im getting the right dimensions for the 3 bigger doors. Then a little more in the 4 door, and much more with the smallest door. While in the windows im getting always 0.05m more than the real size.
I cant see the correlation between the results. The strangest thing is that in the door its giving me right results for the bigger ones but the two others even if they are not the real dimension, they are not even proportional so Im lost here. I have used the doors and windows that are by default in architectural template (attach file). Also Im using 0.01m in "host length" parameter and dont see any diference if I set it to more.
Any ideas about what is "seeing" the bounding box property? Any other consistent way to do this?
Solved! Go to Solution.