Shared Parameter Creation from list

Is there any way to feed in a list to the Add shared parameter to Project node? I’ve got a list of 125 parameters that we use for room data sheets but i’d like an automated way to add them to the project. Any thoughts?

Danny,

I thought it worked with list input:

Thanks for the response Konrad. Unfortunately I just get a null. Thoughts??

Shared

What you doing is not the same or even close to what I sent you an image of. Please try again.

For anyone wondering…you need to pipe in true/false statements for however many parameters you have and it works great.

I’m new to dynamo and hoping someone can help me figure out what 'm doing wrong. I am trying to get the “Add Shared Parameter to Project” node working. Currently it is returning null every time. When I run it is complete with out warnings, adds the parameter group to the shared parameters file but not that actual parameter. Nothing ever seems to hit the project document. When I tried with an existing shared parameter nothing happened. What did I mess up?

 

Add Shared Parameter

Hello,

I’m in the same boat as Isaac, null every time. Only difference, for me it only adds the group name to the shared parameters file, but no parameters.

Appreciate any help, thank you.

Here is a definition I made not too long ago. Only real difference is I’m feeding in an excel list of parameter names. If you are getting nulls make sure a shared parameter file exists. If the shared parameter .txt file isn’t there the definition will error out.

I’m in the same boat as Roman; my shared parameters file exists; the group is created but not the parameter; return is null.

I’m sure I can work the input and matrix manipulation to process lists once I can work out what I’m doing wrong with the node itself…

If anyone has any ideas that would be great.

While I’m not certain, I think the “Add Shared Parameter to Project” custom node does not like the “Parameter Types” and “Parameter Groups” drop down nodes. For some reason I don’t have them in my Dynamo to test. I’d suggest formatting your definition as Konrad described or how I did mine using the custom nodes from his Archi-Lab package. That’s the only common thing I see with those who get the groups but not the parameters…using a combination of the custom parameter nodes and the drop downs.

Thanks for the reply, Nick.

I’m really not having any luck at all with this.

I’ve tried a few things; with an empty shared parameters file I’ll get the group added, but no other changes. No project parameters get added, everything returns ‘null’.

Regardless of using a list or an individual item for testing, the result is the same. Extracting the active python script is a little more descriptive, but still beyond me…

 

If anyone has any advice, I’d appreciate it.

 

Just discovered my definition is broken in Revit 2016. Feeding a single shared parameter or a group of them results in nulls. Not sure what changed between 2015 and 2016 to break it.

it worked for me as described from Konrad. the drop down nodes for “Parameter Types” and “Parameter Groups” does not work. for “Parameter Types” and “Parameter Groups” you could use the python scripts from Konrad.

@Konrad: Thanks!

Cheers, Milorad

 

Code for the Parameter Type node:

#Copyright© 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 *
import System

#Assign your output to the OUT variable
OUT = System.Enum.GetValues(ParameterType)

 

 

Code for the Parameter Group node:

#Copyright© 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 *
import System

#Assign your output to the OUT variable
OUT = System.Enum.GetValues(BuiltInParameterGroup)

Konrad-

Couple of questions on the archi-lab Add Shared Parameter node Python script:

  1. Is there any way to bypass the Shared Parameter File that is set in the Revit Instance and insert a static file path? I would like to point to a consistent shared parameter file on my server to look for certain parameters, and my users might have switched to a different shared parameter file for one reason or another. Alternatively, is it possible to hard-code a shared parameter into the script (GUID, name, ParameterType, Visible) and bypass the Shared Parameter File Lookup altogether?

  2. Is there any way to set the parameter “Aligned By Group Type / Vary By Group Instance” setting when adding the parameter? I would guess it would exist somewhere in the parameter bindings, but I couldn’t find anything that made that available.

Also, I modified the python script for my purposes to allow for a parameter to be mapped to multiple revit element categories (inputing a list of categories for one single parameter). Is this the best way to accomplish this? See below:

cats = app.Create.NewCategorySet()

for categ in _category:

builtInCategory = System.Enum.ToObject(BuiltInCategory, categ.Id)

cats.Insert(doc.Settings.Categories.get_Item(builtInCategory))

if _instance:

bind = app.Create.NewInstanceBinding(cats)

else:

bind = app.Create.NewTypeBinding(cats)

 

Thanks-

I found an answer to how to change the “Vary Between Groups” behavior. See image below:

VaryBetweenGroups

I’m still having issues getting this to work in Revit 2016. Same definition (as I posted above) works fine in Revit 2015. Using Dynamo 0.9.1.3503 for both versions of Revit.

 

If I feed in a list of shared parameters I get this traceback:

Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed.
Traceback (most recent call last):
File “<string>”, line 107, in <module>
File “<string>”, line 78, in addParam
TypeError: Item() argument after * must be a sequence, not NoneType

 

If I feed in 1 shared parameter I get this traceback:

Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed.
Traceback (most recent call last):
File “<string>”, line 107, in <module>
File “<string>”, line 81, in addParam
TypeError: Create() takes exactly 1 argument (3 given)

 

Is anyone experiencing this in 2016?

Hi Konrad and all masters!

I used Add Shared Parameter for Project Node. I found it worked exactly when the input was instance (not a list or array). But when the input were List like your post above and input for isinstance? was {false, true, false}, the result was wrong?

I realized that when we worked with list the is_instance were alway “Yes”

Can you help with this problem?

Thanks!

Dear all!

I tried to revise the script and get the exact result.

Shareparameter2

Hi, Nick!

The method “Autodesk.Revit.DB.Definitions.Create(string, Autodesk.Revit.DB.ParameterType, bool)” was deleted in API 2016. Read more here: https://github.com/jeremytammik/RevitLookup/blob/master/CS/Test/SDKSamples/FireRating/SharedParam.cs#L74

We decided the problem as follows (Multiple Category is also implemented):

Python_Add_Parameters

Pardon me, there is a remark: we can not add multiple categories to a single parameter, only different categories to different parameters. We need to think about it.