Get and set parameter: Autodesk.Revit.DB.FamilyType

Hi all,

I try to set some parameter values in a FamilyType.
In my first script I was able to add the parameters to my familydoc.

What I want is to get those parameters and set them in the FamilyTypes, but I wonder it this even possible?

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

clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager

#Start Transaction
#TransactionManager.Instance.EnsureInTransaction(doc)
#Eind Transactie
#TransactionManager.Instance.TransactionTaskDone()

familytype = IN[0]

param = []
for f in familytype:
	para = f.FamilyManager.Parameters
	
	
OUT = "Succeed"

File “”, line 19, in
AttributeError: ‘FamilyType’ object has no attribute ‘FamilyManager’

Firstly, In order to use the FamilyManager class you must querying a family document.

The API docs description of what the FamilyManager class is:
“The family manager object to manage the family types and parameters in family document”.

Secondly, all family types within a family document have access to the same parameters. Therefore the .parameters property will return all of the parameters in a family document. Within which, each family type can have different values against the same parameter. Rather than tying to get the individual parameters from each family type as you are.

For example (ignore python node header name, ripped code from another project):

To start wading into the weird ether world which is API family document parameter values and types etc it is definitely worth looking at the forward iterator method (warning, its a touch confusing!).

2 Likes

Hi @haganjake2 ,

Thank you for your explanation!

What I try to do is set a type parameter for each familytype.
I try to use the FamilyParameter.SetValue node from orchid but something weird is happend:

The script is set the parameter but both of the types get the same values.
Any thoughts?

I think it could be to do with your lacing and levels.

Since you have used the ‘Of repeated items’ node to create the parameters name list I don’t think your FamilyParameter.Set value node needs to be on lacing longest and could stay on Auto.

Also, try changing your input levels for family type, parameter name and value to suit the list levels you are inputting (also I don’t think you need the list.create node for family type as all this is doing is adding another list level)

1 Like

I tried with one parameter with multiple types but nothing works.
Any ideas how to fix this?

I saw this topic. but this works only in a family doc:

Before you continue further with this exercise I think it would be good to get a better understanding of what your end goal is.

Now that you’ve created parameters in a family document, do you want to just set a value to those parameters? Are they type or instance parameters?

Are you trying to do this exercise purely in python or would you use nodes if you could?

Do you need to update the family type parameters in the the family document and then load it into the project? Or would you be happy with updating the family instance parameters from the project environment?

Only type parameters.

Are you trying to do this exercise purely in python or would you use nodes if you could?

Normal nodes are fine too.

Do you need to update the family type parameters in the the family document and then load it into the project? Or would you be happy with updating the family instance parameters from the project environment?

No, I want to update them from my direction.

In python if you have a familyinstance, you just need to add .Symbol.LookupParameter(paramname) or if BIP .Symbol.get_Parameter(bipname)

if working inside the family, then majority of your methods sit within the FamilyManager class. you cannot specifically add a parameter only to a single type within a family, the parameter is introduced to all types within the same family, but you can add the parameter and define if it is an instance parameter, it defaults to type i believe, and can add formulas accordingly. This is a script I use to mass edit families in a file location as an example of some of those actions:

1 Like

Thanks for the explanation!=
Add the parameter to the familys is not a problem.

I try to give every family type his own number (for example)
This does not work some how, but I think I found a other way to do this :slight_smile:

Thank you all for your help!

Ahh alright, without digging into the specifics too much I would try an if statement with the type names and if it equals it set that value for each
if type1 == familytypename1:
doc.familymanager.set(paramname, value1)

1 Like

Thanks!

1 Like