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.

Rounding up to user defined intervals

Anonymous
Not applicable
Hi all , l'm very new to AC 22 new expressions feature and was wondering if there is a way to round up to a user defined length/number

Say if you had a plasterboard sheet length at a given length and you wanted round up to standard sheet sizes (user defined intervals)
13 REPLIES 13
poco2013
Mentor
use MROUNDUP as in:

MROUNDUP(beam length, interval)

This will round up to highest number evenly divisible by interval.
Gerry

Windows 11 - Visual Studio 2022; ArchiCAD 27
Anonymous
Not applicable
Thanks for quick response

The only problem is that as far as I can see i can only enter one number as the multiple
Eg. Say I enter 2400 as the first interval this will only round up to 2400 intervals . What if I want the next interval to be 3000 if from 2740 measurement. Ideally I'd like intervals to be 2400,3000,3600,4500,4800,5400,6000
poco2013
Mentor
In that case you need to chain multiple IF statements as in"

IF length <2400, MROUNDUP(length,2400),IF length >= 2400 and length < 3000,MROUNDUP(length,3000),ETC.))

AND CONTINUE ON for seven if commands. A long expression, but you only have to do it once.
Gerry

Windows 11 - Visual Studio 2022; ArchiCAD 27
Anonymous
Not applicable
Thanks for your input, i’m sure i’ll get there but i can’t seem to find where the error is in the following expression
poco2013
Mentor
The error says you set the data type of the expression to numeric, but it looks like your returning a length.
A expression must return the data type configured. You must either ser a length data type or convert the length(s) to numeric.

Also the last if statement does not have a false value to return, if's must have a true and false condition to return
Gerry

Windows 11 - Visual Studio 2022; ArchiCAD 27
Anonymous
Not applicable
Thanks gerry, but still after making changes i’m getting errors
poco2013
Mentor
The false statement of the last IF returns a true/false which is not a length. All possible returns must match the property data type whether they can be reached or not. try 0 mm.

Fix that first and recheck for errors.
Gerry

Windows 11 - Visual Studio 2022; ArchiCAD 27
ChrisB
Participant
I use the MROUNDUP method suggested by Gerry to produce timber/steel member schedules (see example attached) but use it slightly differently…

Timber in the UK is normally supplied in standard lengths (your preferred sizes with the exception of one), starting @2400mm increasing in size by multiples of 600mm e.g. 2400, 3000, 3600, 4200, 4800, 5400, 6000 etc. So…

I divide the actual member length (3D length, length etc) by 600, then roundup this figure to the nearest whole number and multiplying this result by 600 (see attached image of formula used). As an example, a timber measuring 1546mm long would give…

1546/600 = 2.57
round up to nearest whole number = 3
3 x 600 = 1800

I don’t mind the schedule reporting timber lengths of less than 2400mm as all smaller lengths (multiples of 600) can be combined to make a standard length e.g. schedule reports 2no @1800, so we only need 1no @3600. This keeps the waste to a minimum.

The beauty of doing it this way is that the formula can be easily adjusted to suit other standard length intervals e.g. change the 600 to 400

Note the bug on the schedule (I need to report this separately to GS) for the figures given in the ‘Length (cut)’ field. Merge uniform items is ticked for this schedule but for some reason the schedule sums up the values in this field even though all the lengths are identical e.g. 7th row shows 16,616 but this should show 2077 (it does if you highlight the field). However, it works correctly for the ‘Length (uncut)’ field & the flagged totals which gives me the information I need.
AC16-24 Solo (latest version)
OSX 10.15.6 - MacBook Pro 16" 2.4 GHz 8-Core Intel Core i9 - 64Gb DDR4 - AMD Radeon Pro 5500M 8 GB
Anonymous
Not applicable
Thanks again for the responses.
The reason I’m persisting with with Gerry’s method is that it opens up countless opportunities to use for other scenarios, (that is if I can get it to function)

Gerry would you mind posting a functional nested if statement as maybe I can cross check to see where I’m going wrong ,I keep jumping from a syntax error to a numeral error at the end of the expression statement