This is a quick summary of the main changes included in PropertyWizard_V0-16-0_Beta.
There are three main changes: one new feature and two bug fixes.
- New feature: Views added to Category List
- Bug fix: Rounding error in Length and Area values
- Bug fix: Uncatchable errors accessing some properties
Views added to Category List
I’ve quickly added ‘Views’ to the Category drop-down in the Formula Window, so you can create formulas that set properties on Views.
This example uses the Type Name of the View’s Family to set a project parameter called ‘Test’:
The simple implementation in this version of PropertyWizard should allow you to make a start with Views. But the Views Category does include a range of internal View elements and View Templates, so you will encounter errors like this:
This has not caused any problems so far, and the code does correctly set the values on the ‘real’ views, so please do have a go with it and let me know how you get on.
Bug Fix: Rounding error in Length and Area values
This fixes a rounding error in some Length and Area values, which resulted in incorrect values being returned in previous versions.
If you are using Length and Area values, you should upgrade to V0-16-0 straightaway.
This bug fix is in advance of a major rewrite of the Units code to handle the full range of Revit units.
Bug Fix: Uncatchable errors accessing some properties
This bug fix avoids a class of errors that were not catchable by try(). They were thrown with the message “Object reference not set to an instance of an object.”
Now, the errors are thrown with the message “Parameter does not have value: <parameter name>”, and you can catch them with try() in order to provide an appropriate error value.
This was a common error with the Host.Type.[Fire Rating] example: It occurred if you hadn’t set the wall type’s Fire Rating.
Now, if you set the formula like this:
You will get this error message for the doors in walls with no fire rating:
And now you can catch the error using try() like this:
I will cover try() in more detail in another post, but here is a quick explanation:
As the Help file says, “try(a, b) … Tries a. If a throws an error, returns b”.
What that means in this example is that try(a, b) starts by evaluating the first expression, Host.Type.[Fire Rating]. If that produces a value, all well and good: The target property is set to that value. On the other hand, if the first expression produces an error, the target property is set to the second expression, “None”.
Summary
As always, please download this latest version and let me know how you get on with it. You can leave comments below, email me or contact me on Twitter or LinkedIn.