I’m trying to get Project Parameters Data (name,disc, type, group) and categories they belong to, but stuck almost from the start
I can get Project needed parameters and their id but I can`t find a way do get their Data (name,disc, type, group) and categories they belong to.
You may have to look at the Clockwork nodes for project parameters and adjust the python code to get what you want. Or there may be other packages with nodes to help you.
Thanks Nick I have seen the document.projectparameters node if you mean this node. Actually I cant understand how ho get from this node that I need. I can see the list of all parameters.. types .. but I cant get parameters I need. No pythin coding skills as well
I’m afraid it’s going to take python to get what you’re after. You might get lucky and find some custom nodes from someone who has already tackled this issue, or you may have to look into python yourself.
Hi @c.poupin,
I tested your great code to list the project parameters, and:
I need to filter out only the shared parameters loaded from the .txt file (and not others shared parameters came from inside loaded family into the project) but I don’t know how
you can get all definitions name from your Shared Parameter File and compare them with each definition Name in BindingMap (or using guid)
method with Name
lstExtDef_Name = []
spf = app.OpenSharedParameterFile()
if spf is not None:
spfGroups = spf.Groups
for group in spfGroups:
for def_ in group.Definitions:
lstExtDef_Name.append(def_.Name)
iterator = doc.ParameterBindings.ForwardIterator()
while iterator.MoveNext():
if iterator.Key.Name in lstExtDef_Name:
#processing
#....
method with guid
full_bind = []
spf = app.OpenSharedParameterFile()
if spf is not None:
spfGroups = spf.Groups
for group in spfGroups:
for def_ in group.Definitions:
sharInProject = SharedParameterElement.Lookup(doc, def_.GUID)
if sharInProject is not None:
binding_map = doc.ParameterBindings
binding = binding_map.Item[sharInProject.GetDefinition()]
if binding is not None:
#rest of code
#objBind = ...
#full_bind.append(objBind)
Blue for Instance Parameter
Red for Type Parameter
Hi @c.poupin , great, very impressive, you are amazing! I’ll try it with the projects of the custumer where I have the txt files of shared parameters, but is there another workaround for others projects where there is no more the .txt file of shared parameters ?
Thank you very much for your help.
Have a good day
Cheers
that is pretty cool, the plugin as well. In my case I want to know more than just project parameters added into the project, what about the builti-in parameters, is possible to query them in similar way without having to select a bunch of different elements of categories to query the parameters?
I have been asking those annoying questions in some posts recently:
import clr
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument
uidoc = DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument
mydicInstanceParameter = {}
set_elemTypeId = set()
fecElement = FilteredElementCollector(doc).WhereElementIsNotElementType()
for elem in fecElement:
set_elemTypeId.add(elem.GetTypeId())
for p in elem.Parameters:
if p.Definition is not None and elem.Category is not None:
if p.Definition.Name not in mydicInstanceParameter:
mydicInstanceParameter[p.Definition.Name] = set([elem.Category.Name])
else:
mydicInstanceParameter[p.Definition.Name].add(elem.Category.Name)
mydicTypeParameter = {}
fectypeElement = [doc.GetElement(xId) for xId in set_elemTypeId if doc.GetElement(xId) is not None]
for elem in fectypeElement:
for p in elem.Parameters:
if p.Definition is not None and elem.Category is not None:
if p.Definition.Name not in mydicTypeParameter:
mydicTypeParameter[p.Definition.Name] = set([elem.Category.Name])
else:
mydicTypeParameter[p.Definition.Name].add(elem.Category.Name)
OUT = mydicInstanceParameter , mydicTypeParameter
thank you to avoid digging up several successive topics in the future, it is better to make a single post and relaunch this one if necessary
I would like to get a list of the parameters referred as well, amazing script by the way, I guess it is taking in consideration only the elements on current project file
Hi c.poupin & Gavin. Just checking this code to get parameter’s properties. I have a little question: which is the input IN[0] o the Python script node of the image? I’ve tried the current document, a list of elements… thank you so much