[Pregunta] [PythonParts] Get Global Attributes [Guardado]

Etiquetas:

Hi,

How can I get an attribute's value from the project's settings ?

(@828@ for example)

Best
Christophe

Adjuntos (1)

Type: image/png
Descargado 70 veces
Size: 26,00 KiB

Show solution Hide solution

Hi,

Works great

attributes = AllplanBaseElements.ProjectAttributeService.GetAttributesFromCurrentProject()

for attribute in attributes:
if attribute[0]== 828:
build_ele.Test.value = attribute[1]

Thanks

Hi,

you can use ProjectAttributeService (NemAll_Python_BaseElements).

Please have a look at the API documentation, located in the folder ...\etc\PythonPartsFramework\InterfaceDoc.

Best regards
Horst

Hi,

Thanks for your reply but I'd like to have more informations about the right way to use it :

build_ele.MyValue.value = AllplanBaseElements.ProjectAttributeService.GetAttributesFromCurrentProject(828) ?

Christophe

Hi,

you get all project attributes by the call

            attributes = AllplanBaseElements.ProjectAttributeService.GetAttributesFromCurrentProject()

            for attribute in attributes: 
                print(attribute)

Please have a look at the example ProjectAttributesInteractor.pyp/py

Best regards
Horst

Hi,

Works great

attributes = AllplanBaseElements.ProjectAttributeService.GetAttributesFromCurrentProject()

for attribute in attributes:
if attribute[0]== 828:
build_ele.Test.value = attribute[1]

Thanks


https://campus.allplan.com/ utiliza cookies  -  Aqui

Acéptalo