Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

Detecting if a family is editable (i.e. loadable)

Kevin.Bell
Advisor

Detecting if a family is editable (i.e. loadable)

Kevin.Bell
Advisor
Advisor

Hi,

 

I'm writing a routine which iterates all families in the document to find which ones have CAD imports, the idea is based on this post:

https://thebuildingcoder.typepad.com/blog/2009/05/imports-in-families.html

 

The routine I've written get all families:

 

FilteredElementCollector checkDWG = new FilteredElementCollector(fdoc).OfClass(typeof(ImportInstance));

And then iterates when trying to open them to check for an imported instance, the families are open with:

 

doc.EditFamily(f)

f being the families from the collector above.

 

This works fine, except the list of families includes some that cannot be opened - such as a Curtain Wall Mullion etc.

 

At the moment I use a Try - Catch statement to stop the inevitable 'unable to open family' error when the routine tries to open these families, but this is a very inelegant solution.

 

Is there something that I can test for in the families - some sort of IsLoadableFamily flag etc? so the routine can skip these families?

 

Thanks.

0 Likes
Reply
Accepted solutions (1)
731 Views
1 Reply
Reply (1)

Kevin.Bell
Advisor
Advisor
Accepted solution

OK, worked it out. The family has a IsEditable flag that can be checked:

 

 

From the API help:

"Thrown when the input argument-"loadedFamily"-is an in-place family or a non-editable family. (This can be checked with the IsInPlace and IsEditable properties of the Family class."