Archicad C++ API
About Archicad add-on development using the C++ API.
SOLVED!

Editing XML files

DGSketcher
Legend

Archicad appears to be using XML for a number of exportables. My current interest is the Project Info file which also doubles as a handy store for Autotexts. What is the recommended way to edit / format these files outside of AC? I would like to open the file and add a number of Autotext values that can then be imported back into AC. Is this an acceptable exercise or is editing the file a no-go area?

Apple iMac Intel i9 / macOS Sonoma / AC27UKI (most recent builds.. if they work)
1 ACCEPTED SOLUTION

Accepted Solutions
Solution

The project info XML has two big ubernodes:

<FixKeys> and <CustomKeys>. Both have an attribute called "val" set to a number.

Don't touch the <FixKeys> node and its contents. In the <CustomKeys> you can add as many new nodes as you like, but keep them ordered, as their names have a counter in it. Don't forget to set the "val" attribute in the end to the right number.

 

One custom node looks like:

<Custom1>
  <UIKey>
    <![CDATA[Eigentümer]]>
  </UIKey>
  <DBKey>
    <![CDATA[autotext-SITE-0A3DEF04-F614-574B-A59F-847C7B4393D9]]>
  </DBKey>
  <value>
    <![CDATA[<####>]]>
  </value>
</Custom1>

 

XML is sometimes a bit allergic to empty nodes (some software would truncate it to a selfclosing tag, eg.g. <mynode />), thats why empty nodes do have some text in them. In the example above its "<####>".

 

Interesting here is the <DBKey>, which is the reference to the actual content used inside of Archicad. Also that's exactly what you can put in a GDL object. You would write

text2 0, 0, "<autotext-SITE-63A43EA8-A776-455F-9DB1-746EE27D085D>"

 

If you want to manually create new items:

The preamble of "autotext" seems to be needed, as well as the category of the block of the project info, here "SITE", always allcaps.

The last part is just a plain GUID. You can totally make up one!

Either you copy it from a webservice out there, or you use the function inside your favorite editor.

Lucas Becker | AC 27 on Mac | Author of Runxel's Archicad Wiki | Editor at SelfGDL | Developer of the GDL plugin for Sublime Text |
«Furthermore, I consider that Carth... yearly releases must be destroyed»

View solution in original post

4 REPLIES 4

I used to heavily modify android framework xml files to alter look and feel on my phone, I bet you can use notepad or equivalent, or anything that opens and resaves xml files.

Thanks, I can open with text edit, but the bit that troubles me is the lines of code that contain unique ID references, which I assume have to be generated by AC...

<![CDATA[autotext-BUILDING-0659ED0C-1267-E947-9D40-9566D9678B35]]>

 

Apple iMac Intel i9 / macOS Sonoma / AC27UKI (most recent builds.. if they work)
Solution

The project info XML has two big ubernodes:

<FixKeys> and <CustomKeys>. Both have an attribute called "val" set to a number.

Don't touch the <FixKeys> node and its contents. In the <CustomKeys> you can add as many new nodes as you like, but keep them ordered, as their names have a counter in it. Don't forget to set the "val" attribute in the end to the right number.

 

One custom node looks like:

<Custom1>
  <UIKey>
    <![CDATA[Eigentümer]]>
  </UIKey>
  <DBKey>
    <![CDATA[autotext-SITE-0A3DEF04-F614-574B-A59F-847C7B4393D9]]>
  </DBKey>
  <value>
    <![CDATA[<####>]]>
  </value>
</Custom1>

 

XML is sometimes a bit allergic to empty nodes (some software would truncate it to a selfclosing tag, eg.g. <mynode />), thats why empty nodes do have some text in them. In the example above its "<####>".

 

Interesting here is the <DBKey>, which is the reference to the actual content used inside of Archicad. Also that's exactly what you can put in a GDL object. You would write

text2 0, 0, "<autotext-SITE-63A43EA8-A776-455F-9DB1-746EE27D085D>"

 

If you want to manually create new items:

The preamble of "autotext" seems to be needed, as well as the category of the block of the project info, here "SITE", always allcaps.

The last part is just a plain GUID. You can totally make up one!

Either you copy it from a webservice out there, or you use the function inside your favorite editor.

Lucas Becker | AC 27 on Mac | Author of Runxel's Archicad Wiki | Editor at SelfGDL | Developer of the GDL plugin for Sublime Text |
«Furthermore, I consider that Carth... yearly releases must be destroyed»

@runxel Thanks the GUID worried me, now I understand them a lot better.

Apple iMac Intel i9 / macOS Sonoma / AC27UKI (most recent builds.. if they work)