Does BoundingBoxIntersectsFilter work for text note?

Does BoundingBoxIntersectsFilter work for text note?

mycad2016D8W4P
Enthusiast Enthusiast
465 Views
2 Replies
Message 1 of 3

Does BoundingBoxIntersectsFilter work for text note?

mycad2016D8W4P
Enthusiast
Enthusiast
I created two overlap text notes in a document, and run the code below, seems BoundingBoxIntersectsFilter does not work for text note. What's wrong? Any other easy way to check if text notes are interesected? Thanks. RevitDb.FilteredElementCollector collectorNotes = new RevitDb.FilteredElementCollector(Document.RevitDoc) .OfClass(typeof(RevitDb.TextNote)); var notes = collectorNotes.ToElements(); foreach (RevitDb.TextNote note in notes) { var view = Document.RevitDoc.GetElement(note.OwnerViewId) as RevitDb.View; var box = note.get_BoundingBox(view); var ol = new RevitDb.Outline(box.Min, box.Max); RevitDb.FilteredElementCollector collector = new RevitDb.FilteredElementCollector(Document.RevitDoc) .OfClass(typeof(RevitDb.TextNote)) .WherePasses(new RevitDb.BoundingBoxIntersectsFilter(ol)); var elements = collector.ToElements(); if (elements.Count > 0) { } }
0 Likes
466 Views
2 Replies
Replies (2)
Message 2 of 3

FlorisvdG
Advocate
Advocate

I was trying the same thing a while ago. Here's what I know:

 

BoundingBoxIntersectsFilter only works on 3d Elements. 2d Elements are ignored.

What you can do, though you must decide for yourself if this is worth it, is the folowing:

 

For every textnote, use it's bounding box to create a new 3d Solid. This new 3d Solid will have the same dimensions ans position as the textNote, therefore you can use it as a subsitute for the textnote and use the BoundingBoxIntersectionFilter.

 

(Note: If you ever try this with Tags, please consider the fact that the boudingBox of a tag goes all the way from the tag itself to the tagged item, and thus is much larger than the tag itself).

 

Message 3 of 3

mycad2016D8W4P
Enthusiast
Enthusiast
Thanks. If so, I would check if the bounding box intersected one by one.
0 Likes