cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 
Collaborate forum

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
Advisor
use MROUNDUP as in:

MROUNDUP(beam length, interval)

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



Windows 10 - Visual Studio 2019; ArchiCAD 26

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
Advisor
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 10 - Visual Studio 2019; ArchiCAD 26

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
Advisor
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 10 - Visual Studio 2019; ArchiCAD 26

Anonymous
Not applicable
Thanks gerry, but still after making changes i’m getting errors

poco2013
Advisor
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 10 - Visual Studio 2019; ArchiCAD 26

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

poco2013
Advisor
Attached is a Expression property file. Referencing Beam Length and a schedule.
Gerry



Windows 10 - Visual Studio 2019; ArchiCAD 26

Anonymous
Not applicable
Wow thanks mate. I wasn’t expecting you to do it for me but thank you so much for doing so. i feel with your many responses on expressions in this forum you should be on AC’s payroll. thanks again and thank you Archicad-talk

poco2013
Advisor
Ooops---

Double checked and I think I made a small error. I returned 6000 mm if length was greater than 6000 mm, SHOULD be just the actual length,

Attached is revised expression
Gerry



Windows 10 - Visual Studio 2019; ArchiCAD 26

ChrisB
Participant
Ozi,

No problem…you’ve got to go with the method that works best for you.

However, one thing to make you aware of…

Gerry’s formula makes it’s calculation based on the beam property ‘Length Left’. This isn’t a problem if the beam is horizontal but will give inaccurate actual real world beam lengths when inclined, as ArchiCAD cuts the ends of the beam to suit the incline specified. The rounding up element will compensate for this most of the time but when an actual beam length is close to a round up figure, the beam could end up short. To overcome this problem, use the property ‘3D Length’ instead.

For other interested parties, alternative beam property attached (beams over 6000mm are rounded up to the nearest 600mm)
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

Start a new conversation!

Still looking?

Browse more topics

Back to forum

See latest solutions

Accepted solutions

Start a new discussion!