Assign the attributes to the PythonPart

By using the PythonPartUtil class to create the PythonPart, the values of

  • parameters with an <AttributeId> tag or

  • parameters with the <ValueType>AttributeIdValue</ValueType> tag

are directly assigned as attribute to the PythonPart.

An example is show in the files

…\etc\Examples\PythonParts\PaletteExamples\Attributes.pyp
…\etc\PythonPartsExampleScripts\PaletteExamples\Attributes.py

Getting an attribute list

In addition it’s also possible to create a list with the attributes from the parameter by using the BuildingElementAttributeList class. The creation of the list looks like follows

from BuildingElementAttributeList import BuildingElementAttributeList
...
attribute_list = BuildingElementAttributeList()
...
attribute_list.add_attributes_from_parameters(build_ele)

Attribute parameter value adjustment

The attributes assigned to a PythonPart can be modified using the general Allplan functions for attribute modification. In the case of a PythonPart modification, the assigned attribute ID allows the PythonParts framework to set the parameter value to the current attribute value.

The described functionality can also be used for attributes that are not input values. For this purpose, the __HiddenPage__ can be assigned a parameter with the needed attribute ID and the attribute value can be set in the py file for the parameter value.