@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
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
final code if anyone is interested
import clr clr.AddReference('RevitAPI') from Autodesk.Revit.DB import* clr.AddReference('RevitServices') from RevitServices.Persistence import DocumentManager from RevitServices.Transactions import TransactionManager #doc = DocumentManager.Instance.CurrentDBDocument uiapp = DocumentManager.Instance.CurrentUIApplication app = uiapp.Application docs = IN #document list spfile = IN #shared parameter file as string group_name = IN #group in shared parameter file param_name = IN #parameter name in shared parameter file exec("param_group = BuiltInParameterGroup.%s" % IN) #BuiltInParameterGroup as string #param_group = IN #BuiltInParameterGroup from node instance = IN #boolean value for instance result =  #test list #ExternalDefinition def defFile(file, group, param) : file = app.OpenSharedParameterFile() defGroup = file.Groups.get_Item(group) return defGroup.Definitions.get_Item(param) for doc in docs : TransactionManager.Instance.EnsureInTransaction(doc) try : eDef = defFile(spfile, group_name, param_name) doc.FamilyManager.AddParameter(eDef, param_group, instance) result.append(True) except : result.append(False) TransactionManager.Instance.ForceCloseTransaction() 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
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 ) with higher programming skills…
Thank you very much @Mostafa_El_Ayoubi
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…
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