Adding Multiple Parameters in the Family Editor

Apologies if this is already been solved.

There are similar discussion in the forum regarding this topic but I can’t find/figure out the solution. :confused:

The FamilyManager.AddParameter Method doesn’t accept a list but just a string.

Can it be iterated? or a completely different method is needed to achieve this.

Thanks.

Hi Salvatore,

Try wrapping python script in to custom node.

@Kulkul
Do you mean creating a custom node using the python script?

If so, I tried that and it’s giving me a null value

@salvatoredragotta Alright try this:

4 Likes

@Kulkul.
I had to add in order to work (before starting the transaction):
doc = DocumentManager.Instance.CurrentDBDocument.

Thanks a lot!

Hello, I am getting an error “unexpected token RevitServices”
Can someone explain why? or how to solve it?
Thanks!

Hi @moraruandrei29

Could you please show me your complete python script.

Hey, nice work guys!
Is there possibility to add to the python script parameter type and parameter group as input value?

@Kulkul Thanks for the fast reply.
Here is the script plus the error I get.

@moraruandrei29 You have typo error:

1 Like

@Kulkul Thanks a lot man, I am new to Python, I had some more mistakes, but I fixed it and now is working.

Hi,

I am new to python in Dynamo.

Could anybody take a look, whats wrong with code?
I am trying to add multiple Yes/No patameters (001, 002, 003…), in other section.

Hi,

So you will need to be incredibly diligent with your working, spacing and captial letters. Make sure it is identical to what the above python script has and it will work! i will copy and paste mine below.

Python Script:

Load the Python Standard and DesignScript Libraries

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

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

par_name = IN[0]
par_type = ParameterType.Text
par_grp = BuiltInParameterGroup.PG_DATA
TransactionManager.Instance.EnsureInTransaction(doc)

for i in IN[0]:
doc.FamilyManager.AddParameter(i,par_grp, par_type, True)

TransactionManager.Instance.TransactionTaskDone()

this is awesome thank you!

Try saving it, closing it and opening it. it did that for me too.
also check that the parameters didnt make anyway. that also happened to me