From SharedParameterElement class to regular DB Parameter class

Dear professionals,
could you please advise how to get out of a SharedParameterElement class a regular DB Revit Parameter in order use all the properties and method that we can use DB.Parameter class?
image

@m.shcheblykin ,

what are you trying exactly? is this a Parameter issue ?

like snooping Parameters

import clr

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

clr.AddReference('RevitAPIUI')
from Autodesk.Revit.UI import *

clr.AddReference('System')
from System.Collections.Generic import List

clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)

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

doc = DocumentManager.Instance.CurrentDBDocument
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument

iterator = doc.ParameterBindings.ForwardIterator()
data = []
while iterator.MoveNext():
	vag = iterator.Key.VariesAcrossGroups
	name = iterator.Key.Name
	id = iterator.Key.Id
	pgs = iterator.Key.ParameterGroup
	pts = iterator.Key.ParameterType
	uts = iterator.Key.GetSpecTypeId()
	isvis = iterator.Key.Visible
	total = [name, id, pgs, pts, uts, isvis, vag]
	data.append(total)

OUT = data

grafik
KR

Andreas

1 Like

Hi,
you can use the Guid of SharedParameterElement

here an example

import clr
import sys
import System
from System.Collections.Generic import List
# Import RevitAPI Classes
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *

# Import DocumentManager and TransactionManager
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument

elem = UnwrapElement(IN[0])
sharedParameterName = IN[1]

filterName = System.Predicate[System.Object](lambda x : x.Name == sharedParameterName)
sharedParameter = List[Element](
                        FilteredElementCollector(doc)\
                        .OfClass(SharedParameterElement)\
                        .ToElements()).Find(filterName)
                        
if sharedParameter is not None:
    elemType = doc.GetElement(elem.GetTypeId())
    parameterElem = elemType.get_Parameter(sharedParameter.GuidValue)
    OUT = sharedParameter, parameterElem, parameterElem.Definition.Name
2 Likes

Hi Andreas,

This info is exactly what I’m looking for but wanting to get it from a shared parameter element pulled from a family in a directory. Your code will pull the info from a shared parameter bound into the active document.
I’ve got all the code and Dynamo nodes to pull the shared parameter elements from my directory of families as well as the GuidValue from each, BUT… I’m struggling to pull the ParameterType (Data type).
Do you know if this is possible in Revit 2021 API and if so can you give me some guidance?

1 Like