I am looking to be able to read the parameter values from a given element (or group of elements) from a linked model. That info would then be used to construct and place a new element in the host model.
I am able to get the elements and read the parameter types; however, I am not able to read the values. *first pic shows selecting elements from linked model, second shows failure to read the specific level values*
Is there a way to do this, WITHOUT using packages (native Revit nodes and Python scripts)?
Any help or pointing in the right direction is greatly appreciated.
I saw you get the parameters from linked elements. Then you feed it into Parameter.Name
Have you tried to use Parameter.Value node?
Othervise you can use Element.GetParameterValueBy name.
Sorry for being too obvious 
The second photo shows you getting the Parameter “Level”, not getting the value of the Parameter “Level”. Those are different nodes.
I can see my blunder now with help from Robert.
I have tried both of those nodes, and they both return the same warning message (see pic).
I think this is where the linked model stuff becomes the problem as I’ve read up on this forum.
The method you’re using expects the parameter to be from the current document because it’s pulling from the actual parameter element. Instead, you can just use the standard GetParameterValueByName node and skip all this mess - simpler and more user-friendly.
hi, an example with a Python function (to get level)
import clr
import sys
import System
#import Revit API
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *
import Autodesk.Revit.DB as DB
#import net library
from System import Array
from System.Collections.Generic import List, IList, Dictionary
#clr.AddReference("System.Reflection")
from System.Reflection import BindingFlags
#import transactionManager and DocumentManager (RevitServices is specific to Dynamo)
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
def get_Level(item):
val = None
if hasattr(item, "LevelId"):
val = item.Document.GetElement(item.LevelId)
if val: return val
if hasattr(item, "Level"):
val = item.Level
if val: return val
if hasattr(item, "GenLevel"):
val = item.GenLevel
if val: return val
if not val:
try:
return item.Document.GetElement(item.get_Parameter(BuiltInParameter.INSTANCE_REFERENCE_LEVEL_PARAM).AsElementId())
except Exception as ex:
print(ex)
try:
return item.Document.GetElement(item.get_Parameter(BuiltInParameter.INSTANCE_SCHEDULE_ONLY_LEVEL_PARAM).AsElementId())
except Exception as ex:
print(ex)
return item.Document.GetElement(DB.Level.GetNearestLevelId(item.Document, item.Location.Point.Z))
toList = lambda x : x if hasattr(x, "__iter__") and not isinstance(x, (str, System.String)) else [x]
#Preparing input from dynamo to revit
lstelems = toList(UnwrapElement(IN[0]))
OUT = [get_Level(x) for x in lstelems]
if want the Z value (in feet) you can replace this line
OUT = [get_Level(x) for x in lstelems]
by
OUT = [getattr(get_Level(x), "ProjectElevation", None) for x in lstelems]
Understood. However, the same issue still occurs, and I receive the same warning (as seen in my comment reply above).
Depending on your categories and how you’re trying to access the value, Level in particular can be tricky because it can sometimes still try to read the name from the element, which will have the same “does not exist in this document” error. This is because the value (the name) is directly tied to the actual Level element, not the element you think you’re querying. A python solution is the only way to ensure that this doesn’t happen.
EDIT: Cyril’s solution is the best overall solution. If you want to stick to out of the box nodes (and no python) you may have to include a number of workarounds.