How to convert FamilyInstances to Autodesk.revit.db.element type?

Hi

Ive been trying to set parameters to several detail items and to do so I need to convert familyInstances to autodesk.revit.db.element. Anyone knows how to achieve this?

Thanks

FamilyInstance is of Element, that is, it is a sub class of Element.

Do you have an example of your code for us all to review otherwise its hard to actually help. It may be you are not unwrapping the elements (assuming this is python) but would be good to have a look at the code to see what you are getting stuck on exactly.

1 Like

Hi Daniel, thanks for your reply.

I figured it out, I had to UnwrapElement(family_inst) and then for every element in family_inst , had to convert ToDsType(), now all family instances are of type Revit.DB.Element.

Here it is:

import clr

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

clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.Elements)

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc=DocumentManager.Instance.CurrentDBDocument

for i in family_inst: #convert familyInstances to revit.db.elements
	new_types.append(i.ToDSType(False))

OUT=new_types
1 Like