Hi,
In Revit Graphics/Visibility Overrides dialog, I can see the Imported Categories tab.
In API Category has a property CategoryType which is Enum with the following values:
- Invalid
- Model
- Annotation
- Internal
- AnalyticalModel
Looks like CategoryType corresponds the tabs in Dialog, but not. Imported Categories also have CategoryType = CategoryType.Model, but not appear in the Model Categories tab.
Is there a way to find out whether a category is Imported or not?
I actually found two ways. The first on is implicit. I just looked into RevitLookup and checked the properties of Imported category:
I noticed the following:
- Category.Id is not BuiltInCategory, i.e. value > 0
- Properties AllowsBoundParameters, CanAddSubcategory, HasMaterialQuantities and IsCuttable are always false for imported categories.
As a result, I cretaed the extension method:
public static class CategoryExtenstions { public static bool IsImportedCategory(this Category category) { if (Enum.IsDefined(typeof(BuiltInCategory), category.Id.IntegerValue)) return false; if (category.Id.IntegerValue < -1) return false; return category.AllowsBoundParameters == false && category.CanAddSubcategory == false && category.HasMaterialQuantities == false && category.IsCuttable == false; } }
It works. I tested it only for couple models. But want to now is it reliable method or not?
The second one is more complicated, but gave for me the same result.
Searching by keyword "Imported" in Revit API help, I've found the only enum member:
Sounds like this is exactly that I need.
This enum member is related with DWG Export Options. In UI we can find it in DWG Export Settings dialog:
I will not provide the code snippet for this approach. It is really much complicated and gives the same result.
Are there other ways to find out Imported Categories? Definitely internally Revit knows about that, but how to get this info in API? Or I have already found this way? :)
Thanks,
Victor.