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

Element type query centralised and made more logical #1154

Merged
merged 7 commits into from
Jan 21, 2022

Conversation

pawelbaran
Copy link
Member

@pawelbaran pawelbaran commented Dec 22, 2021

Issues addressed by this PR

Closes #1146

Test files

On SharePoint.

Changelog

  • Revit element type search centralised for creation and update of the elements based on the BHoM objects
  • informative warnings added to explain to the user what is the source of the element type information for given convert (BHoM object name vs name of its defining property like Construction)
  • Query.ElementType stopped from modifying the queried Revit element types

Additional comments

The problem proved to be much more complex than originally stated #1146. There were 3 parallel challenges to deal with:

  • element type query being different on creation and update of the Revit elements based on BHoM objects
  • not enough feedback on how what is happening on type update
  • element type query being able to modify the queried type

First two were rather straightforward to capture and fix, just a matter of pulling the strings together. The 3rd one, however, was a bit more tricky. Until now, when Query.ElementType was called on physical Wall, Beam etc., ToRevitElementType method was called from within. This resulted in an attempt to convert and overwrite the parameters of the existing type (if found) instead of simply querying it. This, I believe, is fundamentally wrong, so this has been changed to Query.ElementType only querying the element type, but never modifying it.

The above is a breaking change, but I believe it is a step in the right direction, plus it is likely to be left unnoticed by the users. The only scenario affected by the change is a Push of an object with its defining property (e.g. Construction) having modified Revit parameter values (not properties) using SetRevitParameter method. Now, after the change, Push of elements affects the elements, while modification of element types can be achieved by pushing the element types themselves.

Sorry for the non-Revit users trying to understand the above 🙈

@pawelbaran pawelbaran added type:bug Error or unexpected behaviour type:compliance Non-conforming to code guidelines labels Dec 22, 2021
@pawelbaran pawelbaran self-assigned this Dec 22, 2021
@pawelbaran pawelbaran force-pushed the Revit_Toolkit-#1146-SetTypeCleanup branch from 81bab27 to 19eb778 Compare January 7, 2022 18:54
@pawelbaran
Copy link
Member Author

@BHoMBot check core

@bhombot-ci
Copy link

bhombot-ci bot commented Jan 7, 2022

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

  • core

There are 4 requests in the queue ahead of you.

@pawelbaran
Copy link
Member Author

@BHoMBot check compliance
@BHoMBot check null-handling

@bhombot-ci
Copy link

bhombot-ci bot commented Jan 7, 2022

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

  • code-compliance
  • documentation-compliance
  • project-compliance
  • branch-compliance
  • dataset-compliance
  • copyright-compliance
  • null-handling

There are 4 requests in the queue ahead of you.

@pawelbaran
Copy link
Member Author

@BHoMBot check compliance
@BHoMBot check null-handling

@bhombot-ci
Copy link

bhombot-ci bot commented Jan 7, 2022

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

  • code-compliance
  • documentation-compliance
  • project-compliance
  • branch-compliance
  • dataset-compliance
  • copyright-compliance
  • null-handling

There are 18 requests in the queue ahead of you.

@pawelbaran
Copy link
Member Author

@BHoMBot check core
@BHoMBot check installer
@BHoMBot check serialisation
@BHoMBot check versioning

@bhombot-ci
Copy link

bhombot-ci bot commented Jan 7, 2022

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

  • core
  • installer
  • serialisation
  • versioning

There are 19 requests in the queue ahead of you.

@pawelbaran pawelbaran force-pushed the Revit_Toolkit-#1146-SetTypeCleanup branch from 9c53850 to b61274d Compare January 19, 2022 20:15
@pawelbaran
Copy link
Member Author

@BHoMBot check compliance
@BHoMBot check core
@BHoMBot check null-handling

@bhombot-ci
Copy link

bhombot-ci bot commented Jan 19, 2022

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

  • code-compliance
  • documentation-compliance
  • project-compliance
  • branch-compliance
  • dataset-compliance
  • copyright-compliance
  • core
  • null-handling

There are 31 requests in the queue ahead of you.

@pawelbaran
Copy link
Member Author

@BHoMBot check installer
@BHoMBot check serialisation
@BHoMBot check versioning

@bhombot-ci
Copy link

bhombot-ci bot commented Jan 19, 2022

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

  • installer
  • serialisation
  • versioning

There are 62 requests in the queue ahead of you.

michal-pekacki
michal-pekacki previously approved these changes Jan 21, 2022
Copy link
Contributor

@michal-pekacki michal-pekacki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested on different Revit versions and LGTM! 👍

@pawelbaran
Copy link
Member Author

@BHoMBot check required

@bhombot-ci
Copy link

bhombot-ci bot commented Jan 21, 2022

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

  • code-compliance
  • documentation-compliance
  • project-compliance
  • core
  • null-handling
  • serialisation
  • versioning
  • installer

Copy link
Contributor

@michal-pekacki michal-pekacki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@pawelbaran
Copy link
Member Author

@BHoMBot check copyright-compliance
@BHoMBot check dataset-compliance
@BHoMBot check ready-to-merge

@bhombot-ci
Copy link

bhombot-ci bot commented Jan 21, 2022

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

  • copyright-compliance
  • dataset-compliance
  • ready-to-merge

There are 15 requests in the queue ahead of you.

@pawelbaran pawelbaran merged commit 966decc into main Jan 21, 2022
@pawelbaran pawelbaran deleted the Revit_Toolkit-#1146-SetTypeCleanup branch January 21, 2022 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Error or unexpected behaviour type:compliance Non-conforming to code guidelines
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SetType should pass relevant categories into IElementType query
2 participants