Hi all. I want to create an outline from a linked element's bounding box to use in a BoundingBoxIntersectsFilter. My approach bellow works for some cases but where a link or element is rotated beyond a certain limit, the bounding box goes askew and the Outline(xyz, xyz) method returns an empty outline. I've tried scaling the bounding box up with an offset which fixes some cases, but not all of them. Some advice on solutions would be appreciated.
non-rotated link
rotated link
#get the elements bounding box
s_BBox = element.get_BoundingBox(doc.ActiveView)
#apply the link documents transform
s_BBox_min = link_trans.OfPoint(s_BBox.Min)
s_BBox_max = link_trans.OfPoint(s_BBox.Max)
#make the outline
new_outline = Outline(s_BBox_min, s_BBox_max)
#make the filter
bb_filter = BoundingBoxIntersectsFilter(new_outline)
Solved! Go to Solution.
Solved by jeremy_tammik. Go to Solution.
Yes. You can corrupt the bounding box by transforming it. I would suggest the following:
The Building Coder samples includes code to create and enlarge a bounding box point by point that will come in handy for the last step:
/// <summary>
/// Expand the given bounding box to include
/// and contain the given point.
/// </summary>
public static void ExpandToContain(
this BoundingBoxXYZ bb,
XYZ p)
{
bb.Min = new XYZ(Math.Min(bb.Min.X, p.X),
Math.Min(bb.Min.Y, p.Y),
Math.Min(bb.Min.Z, p.Z));
bb.Max = new XYZ(Math.Max(bb.Max.X, p.X),
Math.Max(bb.Max.Y, p.Y),
Math.Max(bb.Max.Z, p.Z));
}
Can't find what you're looking for? Ask the community or share your knowledge.