33
44using Autodesk . Revit . DB ;
55
6+ using Bim4Everyone . RevitFiltration ;
67using Bim4Everyone . RevitFiltration . Controls ;
78
89using dosymep . Revit ;
@@ -13,27 +14,32 @@ namespace RevitMarkAllDocuments.Services;
1314
1415internal class FiltrationService {
1516 private readonly bool _isMarkForTypes ;
17+ private readonly Category _category ;
18+ private readonly DocumentService _docService ;
19+ private readonly ILogicalFilter _logicalFilter ;
1620 private readonly FilterOptions _filterOptions ;
1721
18- public FiltrationService ( bool isMarkForTypes ) {
22+ public FiltrationService ( bool isMarkForTypes ,
23+ Category category ,
24+ DocumentService docService ,
25+ ILogicalFilterContext logicalFilterContext ) {
1926 _isMarkForTypes = isMarkForTypes ;
27+ _category = category ;
2028 _filterOptions = new FilterOptions ( ) { Tolerance = 0 } ;
29+ _docService = docService ;
30+ _logicalFilter = logicalFilterContext . GetFilter ( ) ;
2131 }
2232
23- public MarkData FilterElements ( MarkData markData ,
24- Category category ,
25- IReadOnlyList < Document > documents ,
26- DocumentService docService ,
27- ILogicalFilterProvider filterProvider ) {
33+ public MarkData FilterElements ( MarkData markData , IReadOnlyList < Document > documents ) {
2834 foreach ( var document in documents ) {
2935 var marksByDocument = new MarkDataByDocument ( ) {
30- DocumentName = docService . GetDocumentFullName ( document )
36+ DocumentName = _docService . GetDocumentFullName ( document )
3137 } ;
3238
33- var filter = filterProvider . GetFilter ( ) . GetFilter ( ) . Build ( document , _filterOptions ) ;
39+ var filter = _logicalFilter . Build ( document , _filterOptions ) ;
3440
3541 var elements = new FilteredElementCollector ( document )
36- . OfCategory ( category . GetBuiltInCategory ( ) )
42+ . OfCategory ( _category . GetBuiltInCategory ( ) )
3743 . WhereElementIsNotElementType ( )
3844 . WherePasses ( filter )
3945 . ToElements ( ) ;
0 commit comments