ParameterGroup of SharedParameters INVALID?

Hi everyone,

What could be the reason that the ParameterGroups of all the parameters in the shared parameter file are showing as ‘INVALID’? I know that ‘Other’ in the UI shows up as ‘INVALID’ in Dynamo, but even parameters that have been assigned to ‘Text’ for example keep showing ‘INVALID’.

What am I missing?

Thanks in advance!

Johan

Does anyone have a clue?

Hello @johanboo
INVALID is returned because there is no “ParameterGroups Enum” in your shared parameter file, just groups created by user.

if you want to search ParameterGroups for your Shared Parameters loaded in your project you can do this (with SharedParameterElement.Lookup() method )

import clr
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

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

lstDef = []
gpNames = []
spf = app.OpenSharedParameterFile()
if spf is not None:
	spfGroups = spf.Groups
	for group in spfGroups:
		for def_ in group.Definitions:
			guid = def_.GUID
			spInproj = SharedParameterElement.Lookup(doc, guid)
			if spInproj is not None:
				defInproj = spInproj.GetDefinition() 
				pGroup = defInproj.ParameterGroup
				lstDef.append(defInproj)
				gpNames.append(LabelUtils.GetLabelFor(pGroup))

OUT = lstDef, gpNames

2 Likes

Hi @c.poupin do you know if I can permanently change a parameter group into python? please see this post for reference if possible, Unable to permanently change a parameter group
Thanks in advance
Cheers

Hello @paris
I replied on this topic

Thank you @c.poupin, this was exactly what i was looking for.