Change Family Category

Hi all,

I am having a big headache trying to change the Revit family category. I hope you could help.
I am trying to change “Structural Foundation” into “Generic Model”, unfortunately, I received an error message.
image

I found the solution in forum:
1. Change the Category in Family file, save a copy of the file using a different name and load it into the project
2. Use the below Dynamo workflow after making the required changes to Family Types


image

As you can see I got an error.
Please let me know if you could help me or know any solutions, I have thousands of elements to change…

Are there instances of that family type? Does Element.GetLocation work?

1 Like

HI, I don’t really understand what are you asking, as I am not familiar with dynamo. Could you please clarify your questions?

Can you change the category inside in Revit ? Structural foundation to Generic Model.

Hi, you mean in the family? No, it is not possible. See the error message below.

image

can you share the family?

Yes, of course.

Please see attached. EWS01_Bracket-H-FrontOfSlab.rfa (336 KB)

this the only family you want to change( “Structural Foundation” into “Generic Model” ,)? or more you have like this?

find the converted file.

GN .rvt (2.0 MB)

1 Like

Hi @_Vijay, I am sorry for my late reply, I had an issue with installing the Orchid Package.
I have tried your proposal and I don’t receive any error message, but the family category is not changed in the project, it stayed the same.

I attached image, could you please let me know if I understood it correctly. First I need to get the “family-type” of the element I want to change the category. Second, I set up that I want to change from Structural Foundation into Generic Models? Is that correct?

Overall I have like 25 different families, and even more types. In total it is about 3000 instances in the project… I would appreciate anyone help trying to help me.

Did you read the full conversation on the attached link?

you need to open the family reloads again to reflation changes. that can be also automated.

Hi,

It doesn’t work. I have checked the link and the discussion.

Does it seem OK for you, see image below, that to change family type (8 instances)? This is correct, I have in the project 8 objects in this family type.
But then, I have in dynamo 22 families changed in the generic model…I can’t understand this.

I tried another family and here is the same issue in the second part of node

Hello
Here is a solution with Python

image

import clr
import sys
import System
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument

class FamilyOption(IFamilyLoadOptions) :
	def OnFamilyFound(self, familyInUse, overwriteParameterValues):
		overwriteParameterValues.Value = False
		return True

	def OnSharedFamilyFound(self, sharedFamily, familyInUse, source, overwriteParameterValues):
		overwriteParameterValues.Value = False
		return True	

toDoList = lambda x : x if hasattr(x, '__iter__') else [x]
FamTypes = toDoList(UnwrapElement(IN[0]))
catToSet = UnwrapElement(IN[1])
out = []

opts = FamilyOption()
for familySymb in FamTypes:
	TransactionManager.Instance.ForceCloseTransaction()
	family = familySymb.Family
	famDoc =  doc.EditFamily(family)
	result = "Failed"
	ownerFamily = famDoc.OwnerFamily 
	if ownerFamily.IsAppropriateCategoryId(catToSet.Id):
		ownerFamily.FamilyCategoryId = catToSet.Id
		result = "Success"
	out.append(result)	
	famInProj = famDoc.LoadFamily(doc, opts)	
	famDoc.Close(False)	
	famDoc.Dispose()
	
OUT = out

`
Please note that such a change of category (structure to model generic) has an impact on existing instances

`

3 Likes