We value your input! Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey
2022-07-03 02:13 AM
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.
2022-10-20 07:36 AM
what's your solution Gerry? do you have one?
2022-10-20 07:59 AM
I'm also interested. For example you have the python script then you'll just replace some part of it with the name of the zone then it will update automatically then that would be great. 😁
2022-10-20 09:37 AM - edited 2022-10-21 08:26 AM
Hi tomyg,
Here how's (in detail) I created a percentage of site areas. (See attached).
But yes, Archicad allows you create a new property, but you can not capture a single zone area "value" as a stand alone property.
I'm not an expert in Archicad - but I think this is where the problem lies,
.i.e. given if this is what your wanting to achieve. But I'm happy to be proven wrong.
I spoke to someone who is very experienced with Archicad, and he could not come up with an easier way, and in his own work does not use this method to setup schedules because he runs into this exact problem.
I hope this is what your after, and hope it helps!
2022-10-20 11:45 AM
Python scripts are run manually
Using a Python script:
1. create a custom property under the zone group -- named zone percent and set classification to all zones.
2. run Python script
from Archicad import ACConnection
import Archicad
import sys
conn = ACConnection.connect()
assert conn
acc = conn.commands
act = conn.types
acu = conn.utilities
zonePercentId = acu.GetUserDefinedPropertyId('Zones','zone percent')
zoneAreaId = acu.GetBuiltInPropertyId('Zone_MeasuredArea')
zones = acc.GetElementsByType('Zone')
totalArea = 0
for zone in zones:
value = acc.GetPropertyValuesOfElements([zone.elementId],[zoneAreaId])
totalArea += value[0].propertyValues[0].propertyValue.value
EPVArray = []
for index,zone in enumerate(zones):
value = acc.GetPropertyValuesOfElements([zone.elementId],[zoneAreaId])
area = value[0].propertyValues[0].propertyValue.value
percent = round((area/totalArea)*100)
number = act.NormalNumberPropertyValue(percent, type='number', status='normal')
EPV = act.ElementPropertyValue(zone.elementId, zonePercentId, number)
EPVArray.append(EPV)
result = acc.SetPropertyValuesOfElements(EPVArray)
print(result)
2022-10-20 02:36 PM
Is it possible to show in the schedule that the total area is 100%
2022-10-20 04:04 PM - edited 2022-10-20 04:09 PM
You could set the sum flag in the percent column and get a total at the bottom, But, while it would be close to 100, it would never display exactly 100 because of rounding. Python scripts have no access to schedule columns or data, nor does the C++ API. You could adjust slightly the numbers in the script to total 100. But probably not a good idea.
BTW -- Adjusting the rounding in the script to 4 places instead of zero got the total up to 99.99 but still not 100%Adjusting the working units similarly to 4 decimal got 100.0000 but now you have four decimal places which does not look good. -- So no solution?
2022-10-21 12:01 AM
so how did Barry above in the solution to this thread get the zone total areas to work so simply in the property manager? he hasn't mentioned a python script at all.
2022-10-21 12:12 AM
He used an expression to calculate the zone percentage for each zone. The difference was that you have to manually enter the sum of all the zones, taken from the schedule total, into a custom property. The Python script calculates the totals automatically and eliminates the custom property as unnecessary.
2022-10-21 12:16 AM
ahhhh i see, will give this script a run
2022-10-21 08:49 AM
HI