.tsv-based reflection mechanism migrated to BHoM_Engine - #564
Open
pawelbaran wants to merge 1 commit into
Open
Conversation
This was referenced Jul 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
NOTE: Depends on
BHoM/BHoM#1724
BHoM/BHoM_Engine#3596
Issues addressed by this PR
Closes #563
Recommended review process:
The PR is a byproduct of my investigation of the topic as explained in #563. It is not fully finished, there was quite a few copy-paste actions, todos left etc., so more work required, but the intent is hopefully clear. The code works (.tsv processing, loading scripts,
RunExtensionMethod, dynamic assembly load), the only feature that does not fully work is ctrl+shift+b due to the fact thatItemByKeymethod is not fully finished.Recommended sequence to review, with key points mentioned:
Jsonprop removed fromCodeElementRecordclassCodeElementTypeenum items changed to be more focused on actual reflectionAssemblyResolverclass moved toBHoM_Engine\Objects(code unchanged)BH.Engine.Base.Objects.Initialisation- please treat it as a placeholder, I put it together under one class to make it easier to review - main changes compared to the original BHoM_UI code are around input parametersQuery.CodeElementsmethod and its dependencies migrated to Reflection_Engine because it depends on methods from that project - the method itself has been simplified to align with the new version ofCodeElementTypeenum, also try/catches added etc.BH.Engine.Base.Query.ItemByKeymethod that allows to find a member based on a key (the key is the same or almost the same as keys used in versioning), to replace JSON deserialisation - the method is not finished yet, just proves the concept by reflecting types and non-CreatemethodsBH.Engine.Base.Objects.Initialisationand Reflection_Engine in untouched state)BH.UI.Base.Global.Initialisationclass refactored heavily: many methods moved out toBH.Engine.Base.Objects.Initialisationand made more parametric, what is important is that the flow ofActivatemethod stayed untouchedSearchItem,SearchMenu,ItemSelectorMenualigned with the new oM (noJsonproperty, changed enum)Initialisationclass leveraging the changes listed in points 1. to 3.:CodeElementRecordsfrom the base .tsv with a dedicated set and .tsv - possible thanks to more parametric design of the codeTesting
For now I would not obsess about functionality, because code principles are more relevant. However, if you'd like to verify the concept overall, then follow this sequence:
AssemblyContents.tsvfile fromBHoM\Resourcesfolder (schema changed) - for now this step is required, but if we decide to merge this PR, we'll need to change the default .tsv path to protect the usersRunExtensionMethod(e.g. by passing a line andLengthas method name)Changelog
Additional comments
Consolidation of
CodeElementTypeenum could go even further, so that methods from all 5 classes would land under 1 value, for the UIs to dispatch them at runtime - this, however, would mean that we'd need to query strings every time the information about declaring type is needed. I did not dare to do it in the 1st iteration, but still on my hitlist to try and see how it lands.