Archicad Python API
About automating tasks in Archicad using the Python API.

Selecting elements with Python

Anonymous
Not applicable
Hey,
is there an easy way to get all Zone elements in the same classification system or all walls in the same branch?
16 REPLIES 16
Boling1
Contributor
I have read all the phthon examples,but I can't find any info about story_namber and building_material,can you figer out which example I should read carefully?
thx a lot
ArchiCAD 25
JSN
Enthusiast
poco2013 wrote:
Sorry -- Picked the wrong function!!

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?

Hi, just curious if you have already tried to SetClassificationsOfElements, as this somehow tricking me at the moment. It requires the list of ElementClassification but I somehow don't get it right. Any help is appreciated!
poco2013
Mentor
Might be a easier way:
elements = acc.GetElementsByType('Object')
top_class = acu.FindClassificationSystem('ARCHICAD Classification')
item_class = acu.FindClassificationItemInSystem('ARCHICAD Classification','System Furniture')
class_id = act.ClassificationId(top_class,item_class.classificationItemId)
elem_classes = []
for element in elements:
    elem_class = act.ElementClassification(element.elementId,class_id)
    elem_classes.append(elem_class)
acc.SetClassificationsOfElements(elem_classes)
Gerry

Windows 11 - Visual Studio 2022; ArchiCAD 27
JSN
Enthusiast
poco2013 wrote:
Might be a easier way:
Thx, structuring the class hierarchy helps. I will dig deeper and see where I get with this!

can you please provide the website? I can't find videos on https://graphisoft.com/downloads/python

The link to the videos are in the PDF of each script examples.

 

NB: I made a little introduction to the archicad/python connection here if you are a beginner on the subject: https://community.graphisoft.com/t5/Developer-forum/PYTHON-Introduction-to-the-Archicad-Python-conne...

Thank you, Mathias. 

I have another question here: https://community.graphisoft.com/t5/Developer-forum/Getting-all-property-values-of-type-Door-from-Ar... 

would appreciate any kind of help))