Selecting elements with Python
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2021-01-19
06:30 AM
- last edited on
‎2021-09-14
01:34 PM
by
Noemi Balogh
is there an easy way to get all Zone elements in the same classification system or all walls in the same branch?
- Labels:
-
Automation (Python or JSON)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2021-01-19 06:45 AM
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
Windows 11 - Visual Studio 2022; ArchiCAD 27
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2021-01-19 09:33 AM
------------------------------------------------------------------------
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 :.....
......

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2021-01-19 03:23 PM
space_classification_item = acu.FindClassificationItemInSystem( 'ARCHICAD Classification', 'Space') element_ids = acc.GetElementsByClassification(space_classification_item.classificationItemId) print(element_ids)
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?
Windows 11 - Visual Studio 2022; ArchiCAD 27
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2021-01-19 06:08 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2021-01-19 07:12 PM
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.
Windows 11 - Visual Studio 2022; ArchiCAD 27
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2021-01-22 10:13 AM
space_classification_item = acu.FindClassificationItemInSystem( "ARCHICAD Classification", "Wall")
and the result is :
Exception has occurred: StopIteration
File "C:\software\Python\Excel file exporter\toExcel-1.py", 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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2021-01-22 01:56 PM
Windows 11 - Visual Studio 2022; ArchiCAD 27
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2021-01-26 02:49 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2021-01-26 05:01 PM
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.
Windows 11 - Visual Studio 2022; ArchiCAD 27