Set parameter by name, using API

how can I set a parameter by his name using the Revit API? I actually want to modify the value to one of the parameter of my FamilyType.

(I try to code exactly what the SetParameterByName note does)



This was already exposed in the forum :

import clr

import Revit

import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
from System.Collections.Generic import *
doc = DocumentManager.Instance.CurrentDBDocument

parameter_names = IN[1]
values = IN[2]

for e, v in zip(elements, values):
#Assign your output to the OUT variable.
OUT = elements


I’ve tried this one, but ‘elements’ for me are FamilyType and the error says that FamilySymbol (my family type) doesn’t have the argument SetParameterByName


SetParameter works with elements :

If you want to SetParameter inside a family, you can use the node from Orchid Package.

You need to post a snippet of your code so we can investigate where the issue is coming from.

We cannot do that with your description only.

Maybe this?

|Public method|ChangeTypeId(ElementId)|Changes the type of the element.

(Inherited from Element .)

If not it might help you identify an alternative solution…

Hope that’s useful…


It is a bit unclear if you are working inside a project or a family. as @Alban_de_Chasteigner describes, you can use my nodes for family issues (the Orchid package) and if you are inside a project then you can use the OOTB nodes.
You can call this inside code as @Alban_de_Chasteigner show using the Dynamo API and you can also call it by using my assembly, however, mine is not documented for this purpose.’’
as @Mark.Ackerley demonstrates use the webpage for the Revit API if you want to code it the real way :slight_smile: