cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 
Archicad Python API
About automating tasks in Archicad using the Python API.
SOLVED!

Python and GUIDs of Composites

jonasm
Booster

Hello everyone,

 

I'll start by shortly describing my goal:

Mapping information received from the skins of composites into properties.

For example i have a composite, containing a skin with the building material "Concrete", then i want to set my property "construction trade" to "Concrete" (Loosely translated from german, but i hope the idea comes across)

 

So Archicad doesen't allow to acces the skins of composites in the calculations. Only in the lists, so i turned to the python API if i can maybe achieve this in there.

 

My general idea:

1. Check which BuildingMaterials are contained in the composites

2. Check the Composites against a property of each Wall that contains the name of the composite

3. Map the property "construction trade" based on the Building materials inside of the composites.

 

I'm fairly optimistic about step 2 and 3, as I have done similar things based on classifications. But currently I'm stuck at step 1 🙂

I found GetCompositeAttributes that should be able to extract the skins of the composites in my archicad project. but i need the attribute IDs as inputs:

 

 
{
    "command": "API.GetCompositeAttributes",
    "parameters": {
        "attributeIds": [
            {
                "attributeId": {
                    "guid": "29EE690D-089C-4573-94C8-DEC75CFA0950"
                }
            },
            {
                "attributeId": {
                    "guid": "00000000-1111-2222-3333-000000000000"
                }
            }
        ]
    }
}

is there any way to get the guid's for all attributes currently in the file, similar to GetAllElements? The other way would probably to export the xml of my composites and Buildingmaterials and search through them inside the script. but this would be less stable, as it couldn't pick up changes in the template file.

 

Thanks for any ideas and input!

Jonas Mattes
currently AC 27/28 on Win
“Essentially, all models are wrong, but some models are useful.”
1 ACCEPTED SOLUTION

Accepted Solutions
Solution
runxel
Hero

Use Tapir and their "GetAttributesByType" command.

Lucas Becker | AC 27 on Mac | Graphisoft Insider Panelist | Akroter.io – high-end GDL objects | Author of Runxel's Archicad Wiki | Editor at SelfGDL | Developer of the GDL plugin for Sublime Text

My List of AC shortcomings & bugs | I Will Piledrive You If You Mention AI Again |

POSIWID – The Purpose Of a System Is What It Does /// «Furthermore, I consider that Carth... yearly releases must be destroyed»

View solution in original post

2 REPLIES 2
Solution
runxel
Hero

Use Tapir and their "GetAttributesByType" command.

Lucas Becker | AC 27 on Mac | Graphisoft Insider Panelist | Akroter.io – high-end GDL objects | Author of Runxel's Archicad Wiki | Editor at SelfGDL | Developer of the GDL plugin for Sublime Text

My List of AC shortcomings & bugs | I Will Piledrive You If You Mention AI Again |

POSIWID – The Purpose Of a System Is What It Does /// «Furthermore, I consider that Carth... yearly releases must be destroyed»

Hi Jonas,

 

there's also a command with the same name in the native AC Python interface.
https://archicadapi.graphisoft.com/JSONInterfaceDocumentation/#GetAttributesByType

Difference seems to be the following:

  • Native: Gives you only the GUIDs of attributes per type
  • tAPIr: Gives you also Attribute Index & Attribute Name

Since you probably only need the GUIDs it might be easier to just use the native interface.

Automating Archicad with Add-Ons, GDL-Objects & Python Archi-XT.com