- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have an addin that will copy all of the schedules and legends from one sheet to another. I am trying to expand the functionality to also copy the key plan (which is not part of the titleblock . . . it could be, but it is the corporate standard to not have it be for a variety of good and bad reasons). My problem is that when I get a list of the FamilyInstances for the sheet like so:
RDB.FilteredElementCollector coll2 = new RDB.FilteredElementCollector(doc, v.Id);
var symbolInst = coll2
.OfClass(typeof(RDB.FamilyInstance))
.ToElements();
// .Where(x => );
foreach(RDB.FamilyInstance anno in symbolInst)
{
RDB.BoundingBoxXYZ xyzLoc = anno.get_BoundingBox(v);
}I end up with symbolInst having 2 members, one is the keyplan symbol, and the other is the titleblock. I would like to filter out the titleblock somehow with the where clause, but I don't know how to exclude something . . . I was hoping to do a not OfCategory, but I'm blanking on how to do that.
When I stop the debugger and look I see that the keyplan symbol shows a value of "Autodesk.Revit.DB.AnnotationSymbol" but that is not allowed in the OFClass(typeof(XXX)) (it throws an error, thus I am using the base class FamilyInstance instead. I could filter out with a test in the loop that follows, but I can't figure out how to test anno for being an AnnotationSymbol (or not an AnnotationSymbol).
Any ideas? Attached is a screen shot from the debugger Autos showing symbolInst expanded with 2 members, the value fields are shown as "Autodesk.Revit.DB.FamilyInstance" and "Autodesk.Revit.DB.AnnotationSymbol", but I don't know how to test for what "type" anno is within the loop.
Solved! Go to Solution.