Got a minute? We appreciate your feedback:

Graphisoft Learn survey
Archicad Python API
About automating tasks in Archicad using the Python API.

Using python to manage attributes across multiple files


I am working on a massive hospital project, where each of the buildings is planned in a separate file. Unfortunately the teams that were assigned to each building over time added a variety of attributes that vary from the template with which they all started. I am trying to figure out if there is a way to merge all these together and to tidy them up using Python. E.g. in one of the blocks all the settings are correct - but I cannot simply copy them over beacuse same elements have different index numbers - e.g. A wall type WA1 has Idx=1 in File 1 and Idx=2 in File 2. I thought I managed to accomplish the clean up using xml.etree.ElementTree but the resulting XML files cannot be imported. There must be some underlying issue I am not seeing. Anyone had similar problems or tried Python to achieve this? 



I have successfully written some python scripts to mess around with attribute XML files. Archicad is very particular about the xml not having any missing nodes etc. 

there are actually 2 spots where the index is stored. In the id attribute and also an id node. You need to change both. 
make sure nothing else in the xml has changed inadvertently too by comparing your old and new in a text comparer. 

also keep in mind that if you change an id number of an attribute in the xml. It will not relink the elements using that attribute. You may unintentionally swap attributes between elements. 

what I have done in the past is exported all the attributes as text files. Compared them all in excel to determine what matches, what needs to change etc and then manually go through with delete and replace in each file. 

once you’ve got all your files synced up, define one file or a separate master attributes file as the single source of truth for attributes and then U

use the xml export / import to manually sync and changes out to the other files. Don’t trust hotlinks to update your attributes, it a disaster!

Some shameless self promotion 😶 but check out a webinar I ran earlier this year which talks about the issues you are experiencing.

Scott J. Moore | Fulton Trotter Architects | BIM Manager, Associate, Architect
Since AC13 | Current versions AC23.7000 & AC26.5002 | BIMCloud Basic | Python, GDL, VBA, PHP, SQL, CSS
Certified Graphisoft BIM Manger (2022)
Win 10, i9-9900K, 32GB, Quadro P2200, 500GB NVMe

Excellent, many thanks Scott, this is great. 


Attribute management is a big mess, I'm looking forward to watch your webinar on this, @scottjm.

What I did is a python script to compare attributes across multiple project files (based on xml exports), which generates a report that also can be used as a step by step guide to make changes in the respective project file attributes in Archicad.
It assumes a master-slave hotlink structure with one complete master host file and multiple slave source files.
Comparison right now is only based on index and name.

What I want to implement is also a comparison based on the attributes properties.
Also, it's still a hassle to export all the attribute xmls from all project files regularly.

Automating the syncing itself would be a big win but I guess this is hard to achieve using only xml and python because this relies heavily on changing indices in Archicad using the built-in function in attribute manager.

Didn't find the answer?

Check other topics in this Forum

Back to Forum

Read the latest accepted solutions!

Accepted Solutions

Start a new conversation!