The Global Archicad Community

Stay informed. Get help. Share your knowledge.

Discussions about using GRAPHISOFT's tools (Archicad API, BIMx API, BIMcloud API) for independent software developers

Moderators: Karl Ottenstein, LaszloNagy, ejrolon, Barry Kelly, Gordana Radonic, nbalogh, mnguyen, gkmethy, rmasaki, Viktor Kovacs, MOREH Tamas, Akos Somorjai, Ed Brown, Mihály Palenik, Tibor Lorántfy

User avatar
By poco2013
You can get the wall and zone elements by using the function: GetElementsByType(Zone or Wall)
Use GetClassificationsOfElements() to get the classifications of each of the above elements.

You will then have to iterate through the list to isolate the elements with the desired classification.

There is no direct method but the above is only a few lines
User avatar
By Boling1
I guess code like this:
Code: Select all
from archicad import ACConnection
conn = ACConnection.connect()       #连接AC Application对象
assert conn
acc = conn.commands                 #赋值acc为AC的commands命令对象
act = conn.types                    #赋值act为AC的types类型对象
acu = conn.utilities                #赋值act为AC的utility实用工具对象

lstElements1 = acc.GetElementsByType("Zone")
and then? how to use GetClassificationsOfElements,can you give a code example?
like foreach item in lstElements1 :
User avatar
By poco2013
Sorry -- Picked the wrong function!!

Code: Select all
space_classification_item = acu.FindClassificationItemInSystem( 'ARCHICAD Classification', 'Space')

element_ids = acc.GetElementsByClassification(space_classification_item.classificationItemId)

Once you have your element list, you can iterate through to find the element with the properties you want or match them to a specific element type?
User avatar
By poco2013
You are not clear as to what information you want based on classification? Are you seeking a list of element identifiers (guid), ids (names) ,or types, etc.?

The Archicad classification system is a tree structure with a root (system) name at the top and a item id (s) which may be branches, sub-branches or leaves.

Elements are classified based on the classification system name (root) and a item id which could be a branch, sub-branch or leaf name. You need both names (system & item) to retrieve a element Id. This is because there can be several different classification systems in Archicad with duplicate item names between each. How you retrieve a element depends on how it was classified in the "classifications and Properties" Tab. Elements can be classified at any level and by multiple class system structures.

Using: "GetElementsByClassification" returns a list of elements (guids) that have that classification.You then can use other functions to find or sort through the properties of each element.
User avatar
By Boling1
sorry I'm new in Python, I runned

Code: Select all
space_classification_item = acu.FindClassificationItemInSystem( "ARCHICAD Classification", "Wall")

and the result is :

Exception has occurred: StopIteration
File "C:\software\Python\Excel file exporter\", line 27, in <module>
space_classification_item = acu.FindClassificationItemInSystem("RCHICAD Classification", "Wall")

1>"ARCHICAD Classification" 'ARCHICAD Classification' which is right?
2>Wall Column Beam Window Door Object Lamp Slab Roof Mesh Zone CurtainWall Shell Skylight Morph Stair Railing Opening, I don't know what "Space" means?
3>Can you give a whole code, if I can run that code, I can get what you mean.

thx a lot
User avatar
By poco2013
You are not clear as to what information you want based on classification? Are you seeking a list of element identifiers (guid), ids (names) ,or types, etc.? What information do you want to do what?
User avatar
By Boling1
I just want to takeoff all walls's area,thickness,story_number,building_material,How can I do by python?
User avatar
By poco2013
You might start by reviewing the videos and examples on Graphisoft's Python site.

For wall properties, the procedure is to obtain the IDs of both the element (wall) and the property, then use the Get Value function to obtain the property value. Story level and Building Material are not directly available but can be obtained by making a custom expression property referencing those properties, Then reference the custom properties.

The examples illustrate this.