[Frage] [PythonParts] Get Global Attributes [Gelöst]

Schlagworte:
  • PythonParts
  • Attributes

Hi,

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

(@828@ for example)

Best
Christophe

Anhänge (1)

Typ: image/png
76-mal heruntergeladen
Größe: 26,00 KiB

Lösung anzeigen Lösung verbergen

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