Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add View Filters #1502

Open
wants to merge 136 commits into
base: develop
Choose a base branch
from
Open

Add View Filters #1502

wants to merge 136 commits into from

Conversation

GCRA101
Copy link

@GCRA101 GCRA101 commented Sep 2, 2024

Issues addressed by this PR

Closes #1501

Test GH Script - All Algorithms

Test Revit Model - 3D View Filters Table

It is now possible to push, pull and update View Filters in Revit via the BHoM and assign to them OverrideGraphicSettings in selected Views.

Test files

Grasshopper File

[https://burohappold.sharepoint.com/:u:/r/sites/BHoM/02_Current/12_Scripts/02_Pull%20Request/BHoM/Revit_Toolkit/%231502-AddViewFilters/TestScript.gh?csf=1&web=1&e=l3Fafx](url)

Revit Files

[https://burohappold.sharepoint.com/:u:/r/sites/BHoM/02_Current/12_Scripts/02_Pull%20Request/BHoM/Revit_Toolkit/%231502-AddViewFilters/TestRevitfile_PushModel.rvt?csf=1&web=1&e=O8L8fo](url)
[https://burohappold.sharepoint.com/:u:/r/sites/BHoM/02_Current/12_Scripts/02_Pull%20Request/BHoM/Revit_Toolkit/%231502-AddViewFilters/TestRevitfile_PullModel.rvt?csf=1&web=1&e=ge2KZI](url)
[https://burohappold.sharepoint.com/:u:/r/sites/BHoM/02_Current/12_Scripts/02_Pull%20Request/BHoM/Revit_Toolkit/%231502-AddViewFilters/TestRevitfile_UpdateModel.rvt?csf=1&web=1&e=yj4ExY](url)

Changelog

  • FilterRules classes mirroring the corresponding Revit API ones (all within a new namespace FilterRules)
  • New Elements classes View, ViewFilter and OverrideGraphicSettings
  • Conversion methods in the Convert partial class allowing to convert BHoM ViewFilter objects into/from Revit ParameterFilterElement

pawelbaran and others added 30 commits January 29, 2024 19:04
	- Enum LinePattern
	- Enum SolidPattern
	- Class OverrideGraphicSettings
	- Class FilterRule
	- Enumeration Class that works as an attribute of the FilterRule Class, allowing to
	  avoid the use of several abstract and concrete classes for each type of rule type.
To simplify the mirroring representation of the Revit API classes within the BHoM, it's necessary to add a concrete classe, subclass of FilterRule, that
corresponds to the FilterValueRule from Revit API.
Whatever sub-class type as well as Evaluator class type will be represented in BHoM via enumeration classes assigned to the RevitFilterRule and RevitFilterValueRule
as attributes.
Instead of using a single class FilterRule with an Enumeration encapsulated to represent all the different Revit API Filter Rules,
we go for creating multiple classes and sub-classes in BHoM as well, thus trying to match as much as possible the classes structure
that is present in the API.
Add NOT_START_WITH and NOT_ENDS_WITH enum values to the enumeration.
These are required to implement the View Filtering in BHoM.
Useful to create LevelFilterRule objects
Greater, GreaterOrEqual, Less, LessOrEqual are added to reflect the types and names of
the subclasses of the Revit API class FilterStringRuleEvaluator
…ype Enum Values

Greater, GreaterOrEqual, Less, LessOrEqual
Instead of keeping the conversion of FilterRule objects from/to Revit/BHoM within the ParameterFilter/ViewFilter
conversion classes only, we split the code in each different FilterRule Class keeping the code more modular and reusable.
The View3D Class is a subclass of the View Class. To let the BHoM run the Update method on the View3D class, we need to specify an overloaded version of the Update Method taking a View3D class instance rather than a View class instance as input.
…neric Type

Since View3D is a subclass of View in the Revit API, we can make the Update method work on a generic type T, specifying that it must be extending the revit api superclass View.
Using this abstract class it's possible to decouple the ParameterValuePresence Class from the FilterValueRule class.
@GCRA101
Copy link
Author

GCRA101 commented Oct 16, 2024

@pawelbaran, you can find the commit with all your comments incorporated in the following commit
53b434e

@pawelbaran
Copy link
Member

@BHoMBot check compliance

Copy link

bhombot-ci bot commented Oct 16, 2024

@pawelbaran to confirm, the following actions are now queued:

  • check code-compliance
  • check documentation-compliance
  • check project-compliance
  • check branch-compliance
  • check dataset-compliance
  • check copyright-compliance

@GCRA101
Copy link
Author

GCRA101 commented Oct 16, 2024

@pawelbaran, thanks for your comments.
Updated code now in latest commit 501e2c2

@pawelbaran
Copy link
Member

Thanks for the activity @GCRA101 - can see your commits addressing my comments on the ongoing basis 😃 I think the code is OK now, I am slowly switching to testing. Found quite a few bugs so far:

  • filters with Workset still throw error on pull
    image
  • same as above for has value and does not have value
  • updating categories using Push/Update causes reset in the filter (which kind of makes sense - after modifying categories one would need to check if all parameters are available in each of them, so not surprised it breaks things, it almost feels like updating categories should not be allowed)
  • changing any parameter in the filter resets all parameters in the filter

All above cases are covered in the test materials I updated here. Please note these materials cover only the most basic cases, you'll need to test the code against real life models too. But this is the last step, let's focus on getting the basics sorted first 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:feature New capability or enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add View Filters Management in the BHoM
4 participants