Shared Parameter Value by Guid

Hi there,

this has to be easy,
but im really struggeling to find the parameter value of a shared parameter via dynamo/python.

in c# i would do it like this: “window.get_Parameter(new Guid(“c54e24d6-cb57-4fa2-a246-f65bcc1c8b3d”)).AsValueString())” but i cant for the love of god make it work in dynamo.

is there a package solution?

here is it with all parameters of a element.

Can i just read the one specific value?

This is a python try based on LookupParameter:


import sys
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

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

doc = DocumentManager.Instance.CurrentDBDocument

TransactionManager.Instance.EnsureInTransaction(doc)

windows= UnwrapElement(IN[0])
zuordnung_list = []

for window in windows:
    zuordnung = window.LookupParameter("Zuordnung Haus").AsString()
    zuordnung_list.append(zuordnung)
   
TransactionManager.Instance.TransactionTaskDone()

OUT = zuordnung_list```
import sys
import clr
clr.AddReference('ProtoGeometry')
import System
from Autodesk.DesignScript.Geometry import *

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

doc = DocumentManager.Instance.CurrentDBDocument

TransactionManager.Instance.EnsureInTransaction(doc)

windows= UnwrapElement(IN[0])
zuordnung_list = []

for window in windows:
    zuordnung = window.get_Parameter(System.Guid(“c54e24d6-cb57-4fa2-a246-f65bcc1c8b3d”)).AsString()
    zuordnung_list.append(zuordnung)
   
TransactionManager.Instance.TransactionTaskDone()

OUT = zuordnung_list```

That should work

3 Likes

Thank You.

Tested and working.
It really was simple :smiley:
You dont want to guess how long i was trying to get this to work myself :sweat_smile:

Thank You again, this really helps!

1 Like

Transaction is not needed since you are not doing any modifications on the Revit model.

So maybe you can simplify doing this.

import clr
clr.AddReference('RevitServices')
clr.AddReference('RevitAPI')

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

# Documento actual
doc = DocumentManager.Instance.CurrentDBDocument

# Entradas
elements = UnwrapElement(IN[0])
guids = IN[1]  # lista de strings de GUID

# Convertir strings a objetos System.Guid
guid_objs = [System.Guid(g) for g in guids]

# Recorrer elementos y GUIDs
result = []
for el in elements:
    values = []
    for g in guid_objs:
        p = el.get_Parameter(g)
        if p:
            values.append(p.AsString())
        else:
            values.append(None)
    result.append(values)

OUT = result

Here is the documentation where the method
e.get_Parameter(guid)

cames from,

Is supper hard to get over the soluction, I’ve spend to much time trying.

https://forum.dynamobim.com/t/shared-parameter-value-by-guid/98222/4?u=antoniorojas

Hope it helps