How can I filter all model elements but not also the symbol elements?
I am creating a plugin using the Lab4_2_ExportParametersToExcel from the Revit API .NET Labs.
In Lab4_2_ExportParametersToExcel we are iterating "over all elements, both symbols and model elements, and then in the dictionary." (see attached .png)
How can I get all model elements but not the symbol elements?
The reason why I'm asking this is because when I run this plugin on a project with just a few columns and walls to make a small test, I get an endless list of elements (on an excel file) that I have no idea of where they came from and what they are, so I guess they might be symbol elements. (see excel file)
Any help would be appretiated
[Transaction(TransactionMode.ReadOnly)] public class Lab4_2_ExportParametersToExcel : IExternalCommand { public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements ) { UIApplication app = commandData.Application; Document doc = app.ActiveUIDocument.Document; // Extract and group the data from Revit in a dictionary, //where the key is the category name and the value is a list of elements. Stopwatch sw = Stopwatch.StartNew(); Dictionary<string, List<Element>> sortedElements = new Dictionary<string, List<Element>>(); // Iterate over all elements, both symbols and // model elements, and then in the dictionary. ElementFilter f = new LogicalOrFilter( new ElementIsElementTypeFilter( false ), new ElementIsElementTypeFilter( true ) ); FilteredElementCollector collector = new FilteredElementCollector( doc ) .WherePasses( f );
Solved! Go to Solution.
Solved by so-chong. Go to Solution.
Solved by jeremytammik. Go to Solution.
The sample you are using is retrieving absolutely all Revit database elements.
It uses a union of two Booleans, one set to true, one to false.
This is not what you are after at all.
I suggest that you read a little bit more about the basics of filtered element collectors and implement your own filter that really does want you need and retrieves the elements you are interested in:
http://thebuildingcoder.typepad.com/blog/about-the-author.html#5.9
Cheers,
Jeremy
Hi,
This might be useful to you as an example how to filter all model elements.
If you are new to the Revit API i also recommend you to study how to use filtered element collectors, for your own need as Jeremy mentioned.
Hope this helps,
Cheers,
So-Chong
Can't find what you're looking for? Ask the community or share your knowledge.