Family document add shared parameter



@Erik_Falck_Jorgensen Try removing “1:” from your code block and just type “Sheet and Project”. See if that helps!


Thanks @Mostafa_El_Ayoubi ,

Sometimes you need other to confirm you are not a totally idiot concerning the code, but still a bit daft :slight_smile:

The problem was an old-timer working with Dynamo/Revit. I forgot to close the files later in the script since I froze that part. Meaning I tried to reopen the same files over and over again… but that mentioned, there is also the problem you need to restart dynamo when the script has run once. Closing the TransactionManager isn’t working as proper as could be wished.

I am so sorry for the disturbance, but very glad for all the hints I got :slight_smile:

final code if anyone is interested

import clr
from Autodesk.Revit.DB import*

from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

#doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application

docs = IN[0] #document list
spfile = IN[1] #shared parameter file as string
group_name = IN[2] #group in shared parameter file
param_name = IN[3] #parameter name in shared parameter file
exec("param_group = BuiltInParameterGroup.%s" % IN[4]) #BuiltInParameterGroup as string
#param_group = IN[4] #BuiltInParameterGroup from node
instance = IN[5] #boolean value for instance

result = [] #test list

def defFile(file, group, param) :
	file = app.OpenSharedParameterFile()
	defGroup = file.Groups.get_Item(group)
	return defGroup.Definitions.get_Item(param)

for doc in docs :
	try :
		eDef = defFile(spfile, group_name, param_name)
		doc.FamilyManager.AddParameter(eDef, param_group, instance)
	except :
OUT = docs, result

Adding Shared Parameters to a family
Adding Shared Parameters to a family

The code is not working, an Error: endline expected error appears :sweat_smile:


@fablabolbia Show us your complete graph with errors expanded.


Hi Kulkul,
I’m using the @Mostafa_El_Ayoubi code without results. (the @erfajo code gave me an error)
with reference to mostafa code, a “false” appear in the OUT watch.
NO changes have been applied to the families stored in the called folder (read only flag has been removed).
The shared parameter file is also attached.
SP.txt (810 Bytes)


Thank you in advance !


you need to feed the right data from your Shared Parameter file. I have no idea what “Group 3” and “Group 1” is, these “items” is not a part of the SP file you have uploaded.

And… please try to see this post, use the nodes in DanEDU Dynamo package instead.


HI @erfajo, already tested and not working…I’m going to try again, but it gave me an error: the Run in progress never disappear


Never reaches a stop…



Also continous crashes…



Hi @fablabolbia ,
could you share dummy files (revit and .txt) that cause the same issues?


i’m having pretty much same issues with it crashing… not sure if it’s because of the same problem as you fablobolbia but i would really appreciate if you could update once you find a solution as i’ve tried to search so much for one that i got headaches and had to take drugs for them, i can’t search further anymore. Mostafa also thanks for answering that guy’s questions. you seem to have some good knowledge… would you mind if i am going to have some questions either? thanks!


At the moment I can not find a solution…I’m not sure if I’m a stupid or if there’s no real working code in the forum but just “suggestions” for people (not me :sweat_smile::sweat_smile::sweat_smile: ) with higher programming skills…


Thank you very much @Mostafa_El_Ayoubi

shapa.txt (552 Bytes)
Project2.rvt (2.8 MB)


in your attemps, you replaced these values with your own right?

I see from your shared parameter file that the group is called sp1 and the parameter A1


yes…too much confusion… :open_mouth::open_mouth::open_mouth:


I wrote exactly what @Mostafa_El_Ayoubi also is showing… if you dont use the right input nothing will work, but it is not the code that is the problem it is the usage!


I know, but usually its not clear where all the inputs have to be set…


The bare minimum must be that you understand how to give the right input before complaints about code you dont seem to understand.

Please use nodes that are built for the purpose instead of using some code while you still are learning. There is to many steps that goes wrong if you dont understand what is happening.

It sends to much noise with such complaints


Hi @erfajo I did not want to offend anybody…sorry. :sweat_smile:


hi @erfajo @Mostafa_El_Ayoubi i have a little dynamo script that associate shared parameters from a shared parameter file with the current family document and its not working and its driving me nuts can u help me plz
test.dyn (7.9 KB)

shapa.txt (552 Bytes)