My approach is different because the objectives are not the same...
My specifications were as follows:
Operation from version 24 of ARCHICAD which is the one still used mainly at the agency
Add up the housing surfaces
Make 3 additions of different surfaces: PMR version, evolutionary version and exterior surfaces. (PMR = Existing+ToBeDemolished, Evolutionary=Existing+New)
Obtain "Area" type results
Use the "Calculated area" values of the zones
Be able to choose the number of decimal places (I initially wanted to recover the current setting of the project but I gave up, for lack of skill and because I believe it is... impossible today! In any case, in 24...)
Automatically determine the typology of housing (1 bedroom = T2, 2 bedrooms=T3, etc - French calculation)
Have the results of the additions and the typology in the landing doors of the apartments (To use associative labels from 24 and because I think it's the right support)
Have the results of the additions also in the zones (Because it may be useful...)
Zones, the following information must be provided:
Dwelling number in zone number: 01, A01, A4B, 001, 1001, etc.
Room name in zone name: Entrance, Bedroom, Living room/Kitchen, etc.
Position (Custom Property): "INTERNAL" or "EXTERNAL"
Renovation status: "Existing"=PMR, "ToBeDemolished"=PMR spaces modified in the upgradeable version, "New"=spaces specific to the upgradeable version (Replacing the "demolished" spaces)
The areas are in the same layer
You have to specify when it is a landing door (FR="porte paliere" - "Boolean" type custom property = True/False).
The numbers of the dwellings on which these doors depend are automatically retrieved from the linked areas in which the doors open (Often an "Entrance" space... but not always)
Import/Create custom properties
Import/Create of graphic overrides (Optional... But highly recommended!)
Import/Create of renovation filters (Optional... But highly recommended!... bis)
Element settings (Zones and Doors) as seen above
Using associative tags to display info(s) from doors and/or zones
[FUNCTIONING] Broadly, the principle of the script is as follows:
The script lists the areas present in the file and lists the layers that contain them
A graphical interface offers the user to select the layer containing the areas to be processed as well as the number of digits after the decimal point, expected for the additions
The script then lists the retained zones with a certain number of their properties
A list of doors with the attribute "Landing door" (FR="porte paliere") is established with the corresponding batch number
The script initializes the custom properties in question for all the objects concerned - Zones and Doors ("0" for surfaces and "IND" for the rest)
The script then makes the expected calculations (PMR, scalable, outdoor surfaces) from the "Calculated surfaces" that have been retrieved, then calculates the number of rooms per batch, to define the "typo". To define the typology, the script lists, per batch, the number of rooms whose name begins with "Ch" (Chamber 1, CH1, etc.). The french regulations do not authorize the change of typology between the PMR and evolutionary versions, it is therefore on the basis of the PMR rooms that this calculation is made.
All that remains is to reinject the calculated values into the corresponding zones and doors...
AGP-AC24-PYTHON-Add_surf_lots_typo-v0.01-20230301.py - The script