I’m trying to set up an expression to join properties “Lenght (a)” and “Width” of an object, but I can’t figure out how to get the rounding correctly. Any help would be greatly appreciated.
What I want to do: Add an auto-text Label that returns the size of the OOTB wood stud object (DET_STUD 25) so that it shows 2x6, 2x8, 2x12 by picking up the “Lenght (a)” and “Width” and rounding them up.
The Problem: It works great with any stud that ends in 1/2" actual size ( 2x2, 2x4, 2x6), but studs over 2x8 which the actual size ends in 1/4" get automatically rounded down instead of up. Archicad will return the “Lenght (a)” and “Width” properties as nominal size in the following format: #'-#" so the numbers are already rounded when they go into the expression. I have wasted more time than I want to admit trying to get this to work and I keep getting incorrect data type error messages.
(See screenshots below)
The simple expression with which I started:
I have also tried replacing STRCALCUNIT( ) with STR( Width / 1 in) to no avail.
Below is where I see the expression heading; I want to be able to show (2) 2x# when changing from Single to Double, 2 digits if stud Width is greater than 7", or 1 digit if stud width is Less than 7".
Pink text is the expression inside of an auto-text label. you can see how it's currently working for the top and bottom objects but not the middle one that ends in 1/4"
iMac - MacOs Big Sur 11.6.6 Archicad 24 - Latest Build Archicad 25 - Latest Build
As you noted, this is not an issue of rounding since there is no way to "round" 11 1/4" to be 12". You are fighting with the north american nominal vs milled size of lumber which doesn't satisfy any mathematical formula. You can either do a table lookup process... or as you suggest in one of your screenshots, do a 'hack' that recognizes that you have to handle lengths greater than 8 by doing something weird like adding ½" and then rounding the result.
One of the forum moderators • AC 26 USA and earlier • macOS 12.6.1, iMac Pro 10-Core, Radeon Pro Vega 64
Simple rounding will round up or down as required.
However look at the available functions and you will see there are special round up/down functions as well as ones that can round to a multiple (i.e. in metric system timber is ordered in lengths of 300mm).
One of the forum moderators. Versions 6.5 to 25 Dell XPS- i7-6700 @ 3.4Ghz, 16GB ram, GeForce GTX 960 (2GB), Windows 10 Dell Precision 3510 - i7 6820HQ @ 2.70GHz, 16GB RAM, AMD FirePro W5130M, Windows 10