Hi,
I am trying to change the name of user created subcategories within families via the API to weed out double ups like Bench Top vs Bench Tops.
Unfortunately it looks like the Name property of the Category class is read only. Which kinda makes sense for built in categories but not so much for user created ones.
I had a look at CategoryNameMap and its Item property in the hope of a work around but did not get that working.
So is this actually possible?
(I'm on Revit 2017.1)
Jan
Hi Jan,
From what I've seen, you appear to be correct.
There are a couple of things you could do:
Cheers,
-Matt
Hi Matt,
Thanks for your reply!
The batch processing bit which is reporting all subcategories and their properties in a family is already done 🙂 Unfortunately we have a fairly size able number of families in our company (5k+). Going over those manually is a bit of a task...
I thought about the first option you described but was wondering: what will happen to a nested family which uses the same category I am re-creating?
I guess there is only one way to find out 🙂
Jan
Hi,
I think I might have hit another road block...when trying the swap category method:
The hierarchy of Revit geometry appear to look like as follows:
( based on this)
All three levels use GraphicStyleId to define the category / subcategory they are assigned to and it appears to be read only on all three of them.
Am I looking at the wrong spot If I want to set the GraphicStyle?
Jan
Hi Jan,
I believe that that blog post was with regards to 'in model' families and their instances. It would not surprise me that the elements you describe are largely read-only in that context.
You should be able to open the families as documents, and filter directly for Extrusions, ModelLines etc. Though you will probably simply have to filter for all elements of the (sub)category that you want to rename.
Each of the above mentioned element types have a .SubCategory property that you may set, or for a ModelLines, .GraphicStyle is the input value, while for DetailLine, it's .LineStyle.
If you are talking about nested families, then you will simply have to edit the child families (as family documents), then reload them into your parent family.
Cheers,
-Matt