Project attributes
In this chapter we focus on managing the attributes appended to an ALLPLAN project. The service class ProjectAttributeService provides methods to read and change project attributes of the currently active project or all existing projects.
Read project attributes
The methods GetAttributesFromCurrentProject and GetAttributesFromAllProjects will read all the attributes from the current or all ALLPLAN projects respectively and return a list of tuples
Example
This line of code:
project_attributes = AllplanBaseElements.ProjectAttributeService.GetAttributesFromCurrentProject()
print(project_attributes)
will return the attributes of the current project like this:
This line of code:
all_projects_attributes = AllplanBaseElements.ProjectAttributeService.GetAttributesFromAllProjects()
print(all_projects_attributes)
will return the attributes of all the projects currently existing in ALLPLAN in one list like this:
[(403, 'localhost'), (405, 'First project name'), … , (403, 'localhost'), (405, 'Second project name'), …]
The attributes of all projects are put all in one list without grouping into one list per project. The attributes are returned ordered after their ID in ascending order. Knowing that, it's possible to split the list at that point, where the Attribute ID numeration begins.
Modify project attributes
The methods ChangeAttributeFromCurrentProject and ChangeAttributesFromCurrentProject allows you to change attribute(s) of the current project (single or multiple respectively).