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

Collaboration with other software
About model and data exchange with 3rd party solutions: Revit, Solibri, dRofus, Bluebeam, structural analysis solutions, and IFC, BCF and DXF/DWG-based exchange, etc.

Adjust rounding with expressions

Anonymous
Not applicable
According to Swedish standards rounding of apartment areas have to comply with the following:

if the first decimal is 0-4 round down
if the first decimal is 6-9 round up
if the first decimal is 5 and if the number before the decimal is odd round up, example 93.5=94 m2
if the first decimal is 5 and if the number before the decimal is even round down, example 94.5=94 m2

Is it possible to set this up as a rule for a property in AC22 by using expressions?

Stig
1 REPLY 1
poco2013
Mentor
You might try:

IF ( {Property:Expressions/frac} > 5, ROUNDUP ( {Property:Expressions/num}, 0 ), IF ( {Property:Expressions/frac} < 5, ROUNDDOWN ( {Property:Expressions/num}, 0 ), IF ( MOD ( {Property:Expressions/dig}, 2 ) = 0, ROUNDDOWN ( {Property:Expressions/num}, 0 ), ROUNDUP ( {Property:Expressions/num}, 0 ) ) ) )

Where:

num = your measurement in a raw number (no units)

frac = QUOTIENT ( MOD ( {Property:Expressions/num}, ROUNDDOWN ( {Property:Expressions/num}, 0 ) ) * 10, 1 )
QUOTIENT ( MOD ( {Property:Expressions/num}, ROUNDDOWN ( {Property:Expressions/num}, 0 ) ) * 10, 1 )

dig = QUOTIENT ( MOD ( {Property:Expressions/num} / 10, ROUNDDOWN ( {Property:Expressions/num} / 10, 0 ) ) * 10, 1 )
QUOTIENT ( MOD ( {Property:Expressions/num} / 10, ROUNDDOWN ( {Property:Expressions/num} / 10, 0 ) ) * 10, 1 )

i can't imagine that anyone would use such a complicated expression.
This just demos the "left turn" Graphisoft took in developing expressions?
Gerry

Windows 11 - Visual Studio 2022; ArchiCAD 27