2022-07-03
02:13 AM
- last edited on
2025-06-03
01:48 AM
by
Laszlo Nagy
Hi,
How do you add a percentage column to a zone area schedule? Where each zone/area is a percentage of the total site area?
Please see attached.
Solved! Go to Solution.
2023-03-10 07:11 AM
Thanks for the help Barry. I've checked the Calculation Units in Project Preferences and they are set to 2. And I've removed the rounding and 2 from the equation but I'm still seeing 3 decimal places.... very strange!
2023-03-10 07:30 AM
Hi Gerry, thanks for your reply and explanation. I'm still trying to get my head around the options and what's going to work best. This is not a "one off" and is something I hope to figure out and have in our Archicad template to use in all future projects.
Ideally what I'm after is a way to create a schedule that will update in real time (ie if I change the size of a zone, all fields associated with that will update automatically. So having said that, it sounds like Python is not the answer for me in this case
To outline what exactly I'm after, I've listed this below:
1) I need to state the m² for any given lot in my project (using a Zone from what you've mentioned above)
2) Within this lot, I need to state the building coverage as a m² figure and as a percentage of the total lot m² (from step 1 above)
3) Within the lot, I also need to state the impervious coverage as a m² and as a percentage of the total lot m² *(from step 1 above)
4) In some cases, I also need to state the landscaping areas (often these are multiple areas so each area needs to be somehow added together into a total sum) and then have the total sum as a percentage of the total lot m² (from step 1 above)
In addition to the above, I'm working on subdivisons, so I have more than 1 lot. In some cases I have 70 individual lots and have to work out steps 1-4 as above for each one individually. If I can somehow use zones to create what's needed and then edit the ID of each zone to correspond with the lot number, this may work, but I can't seem to work out how to capture all of this in ONE schedule (and so it presents nicely for my layout sheet)
2023-03-10 08:57 AM
I found the solution under Project Preferences > Working Units > Decimals (set it to 2) and this worked!
2024-05-30 09:23 AM - edited 2024-06-19 01:35 PM
I would like to ask is it possible to get value from 1 exact zone into a property automatically? So there is no need to type it manually but let Archicad read it as a new property automically in the formula like Barry wrote before
What I get in the table with % of total Area is correct table:
But I need to find a way how to attach a number 79351 automatically with a property - is there a way?
I have a thought to have just 1 slab in my project to use it as an area for the plot (I don't need slabs anywhere else in my project) but I have a problem with right calculations - should I convert the slab area number into something else to then be able to use it in the formula with zones? Not sure why the calculation doesn't work
Any idea how could it work? Thank you in advance.
Or maybe is it possible with Python script?
2024-05-31 12:14 PM - edited 2024-06-06 12:49 PM
Hi Gerry, so finally after running your python script I got table with %:
Still, I run into some problems:
- How can I sum up all zones that have category number 01 (Green Area) so the total % shown will be 43.
- Also is it a way to not show m² in the sum-up cell?
Best option would be to have there a name Plot area and use it as a zone but of whole plot area but I would need to define it in the python script as a
but not sure how to do it. How one can say what zone ID should the script use for totalArea value? I would give it an ID name PlotArea then can python recognize it? Thank you in advance for any tips and help.
2024-09-10 06:08 PM - edited 2024-09-10 06:09 PM
I added a "Total Area" row to Project Info and the expression can recall this value after you turn the text to number (STRTONUM). I know it's not as elegant, but updating the project info is not a big deal. Not to mention that there are always other places in a project where this total is used (project info on a site plan etc.), so I can refer to that total with an autotext.
(I did the same with "Unit Total" in order to calculate the % of 1 bedrooms, 2 bedrooms etc.)
2025-05-28 03:53 PM
I tried to use help of AI to write a script for zones % but I don't actually understand what is working and what is not... Is it of any use?
I would appreciate it if someone competent in python and archicad could look and help me get what am I missing here... Thank you in advance.
Below is the script, described as: python script for Archicad 28 that will count percentage proportion of sum of one zone area to another sum of zone area according to their zone category code for each zone number? There would be 3 numbers for each zone number:
1st would be: all zone area with zone category 01 and zone number 1 divided by all zone area with zone category 01 and zone number 1,
2nd would be: all zone area with zone category 02 and zone number 1 divided by all zone area with zone category 01 and zone number 1,
3rd would be: all zone area with zone category 03 and zone number 1 divided by all zone area with zone category 01 and zone number 1.
from inspect import _void
import archicad
from archicad import ACConnection
# Establish connection to Archicad
conn = ACConnection.connect()
if not conn:
print("Failed to connect to Archicad. Make sure Archicad is running and the Python palette is open.")
exit()
acc = conn.commands
# --- DISCOVERY: Print all available zone attributes and properties for reference ---
zones = acc.GetElementsByType('Zone')
if not zones:
print("No zones found in the project.")
exit()
print("Inspecting first zone for available attributes and properties:")
zone = zones[0]
for attr in dir(zone):
if not attr.startswith("_"):
print(f" Attribute: {attr} -> {getattr(zone, attr, None)}")
try:
props_result = acc.GetElementProperties([zone.elementId])
for prop_value in props_result[0].propertyValues:
print(f" Property: {prop_value.propertyId.name} -> {prop_value.value}")
except Exception as e:
print("Could not fetch properties with GetElementProperties:", e)
# --- AFTER DISCOVERY, set the correct property/attribute names below: ---
# Example property/attribute names (update these based on your discovery output)
ZONE_CATEGORY_CODE_PROP = "Category Code" # e.g., "Category Code" or custom property
ZONE_NUMBER_PROP = "Number" # e.g., "Number" or custom property
AREA_ATTR = "area" # often just "area"
# --- Data aggregation ---
zone_data = {}
for zone in zones:
# Try direct attribute access first
area = getattr(zone, AREA_ATTR, None)
zone_number = getattr(zone, ZONE_NUMBER_PROP, None)
category_code = getattr(zone, ZONE_CATEGORY_CODE_PROP, None)
# If any value is None, try to fetch from custom properties
if category_code is None or zone_number is None:
try:
props_result = acc.GetElementProperties([zone.elementId])
for prop_value in props_result[0].propertyValues:
if prop_value.propertyId.name == ZONE_CATEGORY_CODE_PROP:
category_code = str(prop_value.value)
elif prop_value.propertyId.name == ZONE_NUMBER_PROP:
zone_number = str(prop_value.value)
except Exception:
pass
# Only add if all required values are found
if category_code and zone_number and (area is not None):
zone_number = str(zone_number)
category_code = str(category_code)
if zone_number not in zone_data:
zone_data[zone_number] = {'01': 0.0, '02': 0.0, '03': 0.0}
if category_code in ['01', '02', '03']:
zone_data[zone_number][category_code] += float(area)
# --- Calculate and print results ---
for zone_number, category_areas in zone_data.items():
area_01 = category_areas['01']
area_02 = category_areas['02']
area_03 = category_areas['03']
denominator = area_01 if area_01 > 0 else 1e-9 # Prevent division by zero
p01 = area_01 / denominator
p02 = area_02 / denominator
p03 = area_03 / denominator
print(f"Zone Number: {zone_number}")
print(f" 1st (cat 01/01): {p01:.2%}")
print(f" 2nd (cat 02/01): {p02:.2%}")
print(f" 3rd (cat 03/01): {p03:.2%}")
print("--------------------------")
2025-05-28 04:27 PM
I use Claude AI for my python script, and it works well. I often give him the link to the python manual (or copy paste the AI the command I think should be used) and give him some python script examples.
You should begin with simple script and add functionnality step by step.