Monday, April 28, 2014

Beware the In Place Family

I have been working to have my latest Revit add on published to the Exchange app store and came across a bug in my code.

The app basically processes all walls (or all selected walls) and allows you to manage the wall join condition (allow/disallow joins) here is a link to the page describing the app: http://krispcad.blogspot.com.au/2014/03/krispcad-wall-join-manager.html.

All was working hunky dory in my test projects so I submitted the app confident of a quick approval. What I got instead was a message telling me that my app throws an error :( Sure enough, when I tested the app with the sample project it threw the error. Turns out that checking that the walls collected are of the correct Category was not enough as the sample project also included an in place family in the wall category... so my code was throwing an error when I was casting my collection's objects to "Walls", the in place family is a "FamilyInstance" and cannot be cast to "Wall".

A simple fix of including an "ElementClassFilter" for a type of "Wall" solved the issue... hopefully my new app will be available on the store in the next few days.

No comments:

Post a Comment