Object inspection via reflection #22

Merged
merged 1 commit into from Feb 6, 2017

Projects

None yet

2 participants

@awmcc90
Contributor
awmcc90 commented Feb 5, 2017

Drastic changes to the library to load object information directly from
the assembly. More information is available and the product is cross
compatable with different versions of the revit api

@awmcc90 awmcc90 Object inspection via reflection
Drastic changes to the library to load object information directly from
the assembly. More information is available and the product is cross
compatable with different versions of the revit api
6a423e9
@awmcc90
Contributor
awmcc90 commented Feb 5, 2017

Snoop / CollectorExts

Removed all modules spare two, the non abstract one which is the main worker of loading information via reflection. In general I felt like it was a lot of code which needed to be specifically typed out in order to get parameters and method values that were already available. The new worker is very simple: when the collect event is called we pass the object to the worker, the worker determines which types the object is associated with and places those in a list. Then we loop through each type and collect properties and methods that meet certain requirements, for each type:

Properties have to have a get method and they can't require any parameters to be passed in.
Methods cannot require any parameters to be passed in and they also can't have a void return type.

We avoid making any changes to the document by invoking the methods in a try statement, and given we are outside of a transaction we catch any error that it would throw due to that. I did a simple (and I mean simple) check of what parameters we have already seen so that we don't continue to log duplicate information in the snoop dialog. I considered leaving all the properties and methods in for every type but it made the list of information very long and I wasn't sure how much I benefited from showing all that information.

Certain specific properties and methods that I wanted, such as element geometry and boundary segments, I had to add on a case by case basis but even this is much more efficient because we still don't require separate methods for each type. We can continue to update the list of specific properties and methods that have parameter inputs as an ongoing work.

Utils

I thinned out the Utils class to remove anything that we no longer needed. The changes here were minor.

Tests

I had to remove the vast majority of the tests given they were no longer required and more importantly the methods that they called no longer existed.

@jeremytammik jeremytammik merged commit f9e5b4e into jeremytammik:master Feb 6, 2017
@jeremytammik jeremytammik added a commit that referenced this pull request Feb 6, 2017
@jeremytammik merged pull request #22 from awmcc90 drastic changes implementing obj…
…ect inspection via reflection and cross-version compatibility
da40421
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment