We value your input!
Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey

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

Home Story Name in Python

Arash
Contributor

Hello,

 

I noticed that the "Home Story Name" property in the General category is not accessible directly in Python, so I was wondering if there is something that I'm missing here. 

 

Could anyone please provide a sample code that extract "General_HomeStoryName" information of each element in python?

 

Thanks,

Arash

10 REPLIES 10
poco2013
Mentor

The "home Story Name" is not available to python scripts.

 

At Present, there are two workarounds.

 

You can create a user expression that references element home story and set its availability to all elements or selected Types. Then just reference that custom property. This expression returns the floor string name. The disadvantage is that the property must be ore-configured for all plans of interest.

 

The other one is to develop a AddOn to return that info via the ExecuteAddOnCommand, in Python and the floorInd attribute in the API_ELEM_HEAD structure in the AddOn API. This attribute returns the floor number. The disadvantage is that the AddOn must be pre-loaded to access it.

 

Gerry

Windows 11 - Visual Studio 2022; ArchiCAD 27

Hi Gerry,

 

Thank you for taking the time to read and answer my question. Do you think using Classification could be another work around?

 


@Arash wrote:

 Classification could be another work around?

 


I don't understand your question. The Classification system has nothing to do with the home story property or a expression. Properties,however, are made available to elements via their classification, -- so if you were to use a expression, it would have to belong to the the same classification as was the element(s).

Gerry

Windows 11 - Visual Studio 2022; ArchiCAD 27

Gerry,

 

I was thinking to create custom classification branches in the classification manager and name the branches similar to story names of the project and assign those classifications to the related elements of the building.

 

For instance, I will create a classification named "B5", then assign that classification to all the elements in basement 5 of the project. Eventually, by 

acu.FindClassificationItemInSystem() I can create lists that contains all the elements of each story, plus their story name.
 
do you think this a feasible and logical method? 

I'm assuming your intent is to just test out Python's capabilities. So yes, if the details are fleshed out, it would work. But if you are just interested in listing all elements on a story -- a schedule would be best and more logical

Gerry

Windows 11 - Visual Studio 2022; ArchiCAD 27

You could also use Properties for this instead of Classification. In fact, I would prefer using Properties to using Classifications for this specific purpose.

Loving Archicad since 1995 - Find Archicad Tips at x.com/laszlonagy
AMD Ryzen9 5900X CPU, 64 GB RAM 3600 MHz, Nvidia GTX 1060 6GB, 500 GB NVMe SSD
2x28" (2560x1440), Windows 10 PRO ENG, Ac20-Ac27

We have a python script that helps us organize and export schedule values to a spread sheet for our quantity take off purposes. Recently, we've decided to separate values also based on their home story name. Therefore, I'm trying to figure out what is the easiest way and requires the least amount of efforts from our engineers during modeling phase to access that information in python.

Hello Laszlo,

 

Thank you very much for taking the time to read and answer my question. Could you please elaborate more on what you are suggesting? are you suggesting to enter "home story name" value of each element as a property during modeling phase? or is that that information is somehow stored somewhere in each element's property?


@Arash wrote:

. Therefore, I'm trying to figure out what is the easiest way and requires the least amount of efforts from our engineers during modeling phase to access that information in python.


As mentioned before ,Python does not have access to the Home Story property. Schedules do and , of course does the C++ API. Since you are already using Python to collect the properties that you need, I understand that you only want to include "Home Story". Good news is that ALL elements have a home story property, that's the way Archicad works. Since there is no direct access by Python, just use the indirect method-- as mentioned.

 

Create a expression in Property Manager, and make it available to all classifications. Set that classification root as one of the classes for all elements, then download that user created property (expression) with your other properties using Python. If you are unsure how to download properties in Python check out the Archicad Python web Site

Python Site 

You might want to make a request to Graphisift to include "Home Story" in the 26 release -- But that would be a year or two away.

Gerry

Windows 11 - Visual Studio 2022; ArchiCAD 27