Shared parameters shows not in file Parameters

I am using the Filtered elements collector passing in the document as in the image below, the intention is to get all shared parameter loaded to the document. However, it returns extra shared parameters. which I recognise but not actually loaded in the file.

when I tried using a linked document it gives the same results.( which is correct it uses a different SP file)

I even tried unloading the linked file and is still the same.

import clr

import RevitServices
from RevitServices.Persistence import DocumentManager

import Autodesk 
from Autodesk.Revit.DB import *

# Current doc/app/ui
doc = IN[1] #DocumentManager.Instance.CurrentDBDocument

defNames,grpNames = [],[]

SP = FilteredElementCollector(doc).OfClass((SharedParameterElement)).ToElements()


#if (SP == None) :
#	OUT = "No Shared Parameters"

#	for i in SP:
#		defNames.append(i.GetDefinition().Name)
#		OUT = defNames,grpNames

@saju_autodesk ,

you can call the doc via variable.

import clr

from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.Structure import *

import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument

defNames,grpNames = [],[]

SP = FilteredElementCollector(doc).OfClass((SharedParameterElement)).ToElements()


when you deleted fresh your parameters, than i would recomment open/close revit



Hello, I’m not sure if this is much help for you, but here it is by searching the Id from the name

OUT= [i.Id for i in SP if i.Name=='Jour de coulage'],dir(c),c.get_Parameters(),c.Name,SP

the 5 parameters, I don’t see what they correspond to.

It doesn’t seems to work even if I close/open Revit session.

I also tried it on a new document from the actual document and vice versa and it gives the same number of SPs. It seems to like the Filtered element collector tries to access the UIapplication of the host model and access the SP in there. Since the linked models are also in the same session and in the same UI application it seems to return the same.

I also tried another way to first access the shared parameter file but, did not continue as the models are on BIM 360.( it may also includes SP from other discipline).

Are you trying to return all the SharedParameterElements that exist in the model or all the shared parameters available in the currently loaded shared parameter file? This seems to be returning all the shared parameters existing in the model, which makes sense from a collector standpoint.

It may also be that the shared parameters loaded into a given doc also include any shared parameters available through a currently linked model. That would explain why active and linked docs return the same list.

The Intention is to load only shared parameters in the document. For instance if there are 10 Shared parameter on host file A and 5 on linked file B ( Assuming that the SP file can also be different)

Currently I am getting 10 shared parameter if I pass in doc B. so its the opposite here I have more numbers than less, clearly its also not the sum of SP in A&B.

I suspect if the FilterdElementCollecter extracts this information from SP file available in the Host model.
something like,


rather than


I know its most likely not the case but, It alteast looks so.

The FilteredElementCollector is getting the actual SharedParameterElements that exist in the model. That is all the shared parameters that have been loaded into a family or project. It has nothing to do with the current SPF.

Compare it to if you collected all the ParameterElements in the current document. This would be the actual elements representing a parameter that exist within a family or doc. There’s no “source” here to choose from because it’s the actual elements.

If you want the parameters from the SPF then you have to get them from the SPF. The currently active SPF doesn’t actually interact with the current document. It’s just a source for pulling parameter definitions at the time of import.

This post may be helpful.

In order to get the corresponding SharedParameterElements that exist within the active SPF, I think you’d have to compare both sources (GUID from SPF with GUID from elements). This of course would only work for parameters that have been loaded into the project via families or project parameters though.

1 Like

Sorry for all the confusion I just realised that these parameter are coming from the Project Template that I have been using and most of them are still available of the SPF which created this confusion in the first place. I actually get a null value when I open a file with out any revit template applied.