Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Change a subcategory Name

4 REPLIES 4
Reply
Message 1 of 5
jan_christel
2055 Views, 4 Replies

Change a subcategory Name

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

Tags (2)
4 REPLIES 4
Message 2 of 5

Hi Jan,

From what I've seen, you appear to be correct.

 

There are a couple of things you could do:

  • Create a new subcategory, clone settings from old one. Change elements to new subcategory, erase old subcategory from the CategoryNameMap.
  • Batch process the families while logging which ones have wrong named subcategories. Go back and manually change them.

Cheers,

 

-Matt


Cheers,

-Matt
_______________________________________________________________________________
Marking a post as a 'solution' helps the community. Giving a post 'Kudos' is as good as saying thanks. Why not do both?
Message 3 of 5

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

Message 4 of 5

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:

  • GeometryElement
  • GeometryObject
  • GeometryInstance

( 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

Message 5 of 5

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


Cheers,

-Matt
_______________________________________________________________________________
Marking a post as a 'solution' helps the community. Giving a post 'Kudos' is as good as saying thanks. Why not do both?

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community