Well shoot. Try removing it from you packages folder and re-import. If that doesn’t work, I will need the assistance of the Dynamo gurus.
Yup. Those are the gurus. I’m only on my 3rd month of dynamo experience. Ok. So I made it a package and published it online. Search for Dyn_SharedParamTesting. See if that works.
Make sure you “Unblock” dll file by right clicking it.
I tested your file it works for me. Below is the process in action:
About the original topic of the discussion. I just realized that the problem is that im working with new version API 2016 so the code has changed.
So in the end it worked with this solution that i found in this post:
Code modified from the Python.Script of the custom node Add Shared Parameter to Project from Archi-lab:
def addParam(doc, _paramName, _visible, _instance, _groupName, _paramGroup): message = None if ParamBindingExists(doc, _paramName, _paramType): if not RemoveParamBinding(doc, _paramName, _paramType) == "Success": message = "Param Binding Not Removed Successfully" else: message = None group = file.Groups.get_Item(_groupName) if group == None: group = file.Groups.Create(_groupName) if group.Definitions.Contains(group.Definitions.Item[_paramName]): _def = group.Definitions.Item[_paramName] else: ### _def = group.Definitions.Create(_paramName, _paramType, _visible) opt = ExternalDefinitionCreationOptions(_paramName, _paramType) opt.Visible = _visible; _def = group.Definitions.Create(opt) param = doc.ParameterBindings.Insert(_def, bind, _paramGroup) return message
Thanks a lot for you help and time.
@Raul.Galdran Don’t forget to mark the post as solved. Thanks
Did the Dyn_sharedParamsTesting.dll not work? I wrote that node (and the link that @kiknchikn2060 posted is my google drive), it seems to work for me and others.
Unblocking the .dll as @Kulkul said should get it into Dynamo, but you said there is an API change causing it to fail? Is there any balloon error message with the node?
I see that you’ve got to a solution already, but for my peace of mind, If there is an error I’ll still update the .dll.
Sorry I didn’t give you credit. I forgot who shared that with me. I will remove the package as well that I published or keep it and put your name as the creator.
Nah, you’re all good buddy. That nodes for anyone. I’m concerned that it doesn’t work and that means i need to have a look at it as i developed it. The stuff in that folder is for anyone to share.
Hi guys, do you solved the problem? The other mentioned solutions dont work for me in the other Thread, i dont have the necessary nodes, i only get a null or with the excel sheet my dynamo crush. I want to create parameter groups and parameters into System families. Is the dll up to date? Should i Go on with this Thread here? I am working with revit 2017. thanks
@Balko this topic is solved already.
Although this is maked as solved I have had a quick look into this.
The .dll is up to date, I have tested this morning in 2017 and no issues. I made a few tweaks since the last version to take out some of the humourous debug messages I wrote to make testing less boring, and modified some of the nesting in the list structure for the Document.GetSharedParamsInGroup node. Here is a screenshot below…
Here is the .dll and example script shown above.
Note: This only adds shared params to Family documents, the shared param file must be loaded into the family document before running otherwise it can’t be read and will fail.
I believe Clockwork has some nodes to create/modify the shared param file if you are doing it with excel. You will need to have that run first upstream before running this or it will fail as it relies on having those params and shared param file loaded. All ports are of type string so you could create a workflow quite easily I think to create and add Shared Params on the fly using just the string values.
To take this further, you could use the awesome Dynamo Automation Package by Anreas Diekmann to automate runs on multiple families (although I have not tested this it would be an interesting workflow) and have a whole bunch of company standard Params pushed to all your Family content. If this interests you please have a look at the GitHub wiki link below…
I hope this helps in what you are trying to do.
Where in your script are your python placed. I’ve come as far as you were in the original topic except that I have no idea where the code should be placed? Is it even necessary to use python code to create a shared parameter through dynamo?
You should paste the code inside the custom node:
Right click on the mouse, “Edit Custom Node…”, then appears this Window:
Then Select the Python Script Node and again: Right click onthe mouse, “Edit”, then appears this other Window:
Here you can paste all that Script and Save it!
Hope that was what you mean.
It was, Raul. I pasted the script and overwrote from line 67-88 in the Python Script, but now my Watch Node says “Function”?
I did some thing wrong, didn’t I?
I forgot to wire ‘Instance’ with True boolean. Now it says “null”…
Are you able to see if im doing anything wrong?
Try all this code:
#Copyright(c) 2015, Konrad Sobon # @arch_laboratory, http://archi-lab.net import clr clr.AddReference('ProtoGeometry') from Autodesk.DesignScript.Geometry import * # Import DocumentManager and TransactionManager clr.AddReference("RevitServices") import RevitServices from RevitServices.Persistence import DocumentManager from RevitServices.Transactions import TransactionManager # Import RevitAPI clr.AddReference("RevitAPI") import Autodesk from Autodesk.Revit.DB import * doc = DocumentManager.Instance.CurrentDBDocument uiapp = DocumentManager.Instance.CurrentUIApplication app = uiapp.Application from System.Collections.Generic import * # Import ToDSType(bool) extension method clr.AddReference("RevitNodes") import Revit clr.ImportExtensions(Revit.Elements) import System #The inputs to this node will be stored as a list in the IN variable. dataEnteringNode = IN _paramName = IN _groupName = IN _paramType = IN _visible = IN _category = IN _paramGroup = IN _instance = IN def ParamBindingExists(_doc, _paramName, _paramType): map = doc.ParameterBindings iterator = map.ForwardIterator() iterator.Reset() while iterator.MoveNext(): if iterator.Key != None and iterator.Key.Name == _paramName and iterator.Key.ParameterType == _paramType: paramExists = True break else: paramExists = False return paramExists def RemoveParamBinding(_doc, _paramName, _paramType): map = doc.ParameterBindings iterator = map.ForwardIterator() iterator.Reset() while iterator.MoveNext(): if iterator.Key != None and iterator.Key.Name == _paramName and iterator.Key.ParameterType == _paramType: definition = iterator.Key break message = None if definition != None: map.Remove(definition) message = "Success" return message def addParam(doc, _paramName, _visible, _instance, _groupName, _paramGroup, k): message = None if ParamBindingExists(doc, _paramName, _paramType): if not RemoveParamBinding(doc, _paramName, _paramType) == "Success": message = "Param Binding Not Removed Successfully" else: message = None group = file.Groups.get_Item(_groupName) if group == None: group = file.Groups.Create(_groupName) if group.Definitions.Contains(group.Definitions.Item[_paramName]): _def = group.Definitions.Item[_paramName] else: ### _def = group.Definitions.Create(_paramName, _paramType, _visible) _def = group.Definitions.Create(opt) param = doc.ParameterBindings.Insert(_def, bind, _paramGroup) return message #"Start" the transaction TransactionManager.Instance.EnsureInTransaction(doc) try: file = app.OpenSharedParameterFile() except: message = "No Shared Parameter file found." pass k=0 while k<_paramName.Count: builtInCategory = System.Enum.ToObject(BuiltInCategory, _category[k].Id) cats = app.Create.NewCategorySet() cats.Insert(doc.Settings.Categories.get_Item(builtInCategory)) if _instance[k]: bind = app.Create.NewInstanceBinding(cats) else: bind = app.Create.NewTypeBinding(cats) opt = ExternalDefinitionCreationOptions(_paramName[k], _paramType[k]) opt.Visible = _visible[k] if isinstance(_paramName[k], list): ###for i, j, k in zip(_paramName[k], _visible[k], _instance[k]): for i in _paramName[k]: message = addParam(doc, i, _visible[k], _instance[k], _groupName[k], _paramGroup[k], k) else: message = addParam(doc, _paramName[k], _visible[k], _instance[k], _groupName[k], _paramGroup[k], k) k=k+1 # "End" the transaction TransactionManager.Instance.TransactionTaskDone() #Assign your output to the OUT variable if message == None: OUT = "Success" else: OUT = message
For me is working.
I’m running Revit 2015 with Dynamo Version 1.21
5 posts were split to a new topic: Archi-lab Add Shared Parameter getting null