BIM Coordinator Program (INT) April 22, 2024

Find the next step in your career as a Graphisoft Certified BIM Coordinator!

Collaboration with other software
About model and data exchange with 3rd party solutions: Revit, Solibri, dRofus, Bluebeam, structural analysis solutions, and IFC, BCF and DXF/DWG-based exchange, etc.

Classification XML Editor and External Classification Updates

gdford
Advisor
Classification XML editor
What is the best editor for creating archicad classification system XML files external to archicad. I have not been able to tweak the excel merging of XML data and the non-repeating elements to generate an XML file that archicad will import without prior additional editing as Excel seems to leave out necessary items. Surly there exist an XML editor system that can be set up which will let me deal with the data and not have to cleanup all of the stuff that doesn't change. Preferably i could feed the new data in through an excel spread sheet or an Access database. I understand how to create an XML classification file that will import into archicad. My goal here is to merge new XML data into an existing XML file and need to deal with only the actual data and not the XML formatting or the XML header information that never changes. Someone must have a way to automate this??

Anyone have thoughts on this?
Gary Ford
Self Employed - Modeling, Estimating, Construction
Archicad 12-26
AMD Ryzen 9 5900X 12-Core Processor
3701 Mhz, 12 Core(s), 24 Logical Processor(s)
(RAM) 128 GB
NVIDIA RTX A2000
7 REPLIES 7
Anonymous
Not applicable
Usually with xml's from AC Excel doesn't work because the data structure is too complex for default XML deserialization procedure. In order to make it work you need some VB/C# script to handle reading and writing back proper XML structure.
gdford
Advisor
Thanks for the confirmation ..... this is what i was expecting.
Is there an editor out there that can handle this???
Gary Ford
Self Employed - Modeling, Estimating, Construction
Archicad 12-26
AMD Ryzen 9 5900X 12-Core Processor
3701 Mhz, 12 Core(s), 24 Logical Processor(s)
(RAM) 128 GB
NVIDIA RTX A2000
B_E_A_T_
Advocate
Looking for an answer to this question, I came across this topic. Still relevant imho...

I have a simple "office" Classification looking like this:

10. Chapter 10
⎣10.00. Chapter 10 - general
⎣10.01. Chapter 10, part 01
⎣_10.01.01. Chapter 10, part 01, element type 01
⎣_10.01.02. Chapter 10, part 01, element type 02
⎣10.02. Chapter 10, part 02
20. Chapter 20
⎣20.00. Chapter 20 - general
⎣20.01. Chapter 20, part 01
⎣_20.01.01. Chapter 20, part 01, element type 01
⎣_20.01.02. Chapter 20, part 01, element type 02

I have the whole "outline" in a Word-doc/Excel-sheet, but would love to 'migrate' this to AC-classification, without to much manual typing... Seems straightforward, but alas...

Any thoughts on XML-editors helping in the process (I tried Atom and Xcode)
(òÓ,)_\,,/

www.studiov2.be

Archicad 24/25/26
Rhino/Grasshopper
BIMcollab ZOOM

>>> Read my book!<<<
gdford
Advisor
To my knowledge the answer is no, but there are many xml editors out there and it is possible that there is one that you can teach the archicad expected format and supply it with the data via a spreadsheet and off it will go. Excel can take your list and export it into XML and in theory i believe there is a way to teach excel the required format but i could not figure out how to do it. I built my own xlm generator in excel using visual basic. I proved it can be done, but it is not a general all purpose classification generator. It was very specific to my needs. The best solution is to hire an excel visual basic programmer to build you a classification generator. You could probably get this done for a few hundred dollars as there are millions of excel programmers all over the planet looking for work. Then you could just enter your classification in the spreadsheet and let the visual basic code create the xml file.
If you haven't already inspected archicad classification format you can export any of the default classification systems and inspect the xml using Notepad++. This can be a bit overwhelming. To really understand how the xml is put together build a new very small classification system and export it for study. Make small changes in the classification system and see how that changes the exported XML.
I feel your pain.
Gary Ford
Self Employed - Modeling, Estimating, Construction
Archicad 12-26
AMD Ryzen 9 5900X 12-Core Processor
3701 Mhz, 12 Core(s), 24 Logical Processor(s)
(RAM) 128 GB
NVIDIA RTX A2000
B_E_A_T_
Advocate
Thanks for the reply. Unfortunately on my Mac, VBA is not really an option... Maybe Applescript would work or even Python in Archicad. I'll see if I can come up with a solution.
(òÓ,)_\,,/

www.studiov2.be

Archicad 24/25/26
Rhino/Grasshopper
BIMcollab ZOOM

>>> Read my book!<<<
gdford
Advisor
My understanding is that Apple does not implement scripting in excel....
However you could hire someone to just code this from scratch.
Gary Ford
Self Employed - Modeling, Estimating, Construction
Archicad 12-26
AMD Ryzen 9 5900X 12-Core Processor
3701 Mhz, 12 Core(s), 24 Logical Processor(s)
(RAM) 128 GB
NVIDIA RTX A2000
stefan
Expert

In the past, I once created an elaborate Excel with formulas (no VBA) to generate the different text fragments I needed for the XML. But that was too much effort and hardly reusable. And I had to copy-paste the text into the XML manually.

 

I recently used a custom Python script to convert existing classifications in the format Archicad expects. One was starting from an Excel table (CCTB), the other from an XML file (ETIM).

Archicad expects a certain XML structure of tags, before it accepts a classification import.

 

It's not a generic plug-and-play for ANY Excel, but it was not too much work either. Most work was figuring out a correct hierarchy from the numbering in the source Excel. The rest is straightforward.

 

E.g. reading the Excel 

import openpyxl
import xml.etree.ElementTree as ET

####################################################################
# Parse Excel file
####################################################################
print("Parsing Excel File")
workbook = openpyxl.load_workbook(input, data_only=True) # ignore formulas
# Dict to keep items (flat, at this point)
itemsFlat = {}
for worksheet in workbook:
    for row in worksheet.iter_rows():
        code = row[0].value
        description = row[1].value
        itemsFlat[code] = description

And then setting up a suitable XML structure is something like this:

# root
buildingInformation = ET.Element('BuildingInformation')
classification = ET.SubElement(buildingInformation, 'Classification')

# Classification System
system = ET.SubElement(classification, 'System')
name = ET.SubElement(system, 'Name')
name.text = systemName
editionVersion = ET.SubElement(system, 'EditionVersion')
editionVersion.text = version

editionDate = ET.SubElement(system, 'EditionDate')
year = ET.SubElement(editionDate, 'Year')
year.text = dateYear
month = ET.SubElement(editionDate, 'Month')
month.text = dateMonth
day = ET.SubElement(editionDate, 'Day')
day.text = dateDay
description = ET.SubElement(system, 'Description')
description.text = systemDescription
source = ET.SubElement(system, 'Source')
source.text = systemSource

# Items
items = ET.SubElement(system, 'Items')

 

Then there is a specific section to parse and interpret the strings from Excel into a structure that suits Archicad... I parse the "itemsFlat" dictionary and for each items calls a custom "writeItem" function which takes a parent XML item and the two strings (ID and Name) to be added to the 'Items' tag (created in the last line of the previous fragment).

 

And finally writing the XML:

## Write the XML (with proper encoding header string)
tree = ET.ElementTree("tree")
tree._setroot(buildingInformation)
tree.write(systemName + "_" + version + ".xml", encoding="UTF-8", xml_declaration= True)

 

--- stefan boeykens --- bim-expert-architect-engineer-musician ---
Archicad27/Revit2023/Rhino8/Unity/Solibri/Zoom
MBP2023:14"M2MAX/Sonoma+Win11
Archicad-user since 1998
my Archicad Book
Learn and get certified!