Project data & BIM
About BIM-based management of attributes, schedules, templates, favorites, hotlinks, projects in general, quality assurance, etc.
SOLVED!

Adding percentage to Zone Area schedule

cadsph
Enthusiast

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. 

 


percent Area analysis.jpg
45 REPLIES 45

what's your solution Gerry? do you have one? 

ryejuan
Advisor

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. 😁

In the end what is your Objective?
ArchiCAD 9 onwards

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!  

 

 


step 1.jpgstep 2.jpgstep 2.1.jpgstep 3.jpg
poco2013
Mentor

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)

zone percent.PNG
Gerry

Windows 11 - Visual Studio 2022; ArchiCAD 27

Is it possible to show in the schedule that the total area is 100%

Andrii
AC 8.1 - 27 INT/POL 3001
Win11 | Ryzen 5600 | 16 GB | GTX 1650
poco2013
Mentor

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?

Gerry

Windows 11 - Visual Studio 2022; ArchiCAD 27
tomyg
Enthusiast

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. 

poco2013
Mentor

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.

Gerry

Windows 11 - Visual Studio 2022; ArchiCAD 27

ahhhh i see, will give this script a run

HI

That's pretty nifty poco2013, you've used Python to extract the actual zone area "value(s)" and populate an array from it, then show it in Archicad. 
 
The Data is there, you've clearly shown that. 
 
But why can't we do the same thing using Archicad directly?
(This is an open question, I'm not aiming this at you poco2013, I just want to know).