View Full Version : Array formula

Randy_CaS

June 19th, 2012, 07:28 PM

I added an array to a nested family and the parameter "DropCount" is not giving me the results I expect. Based on Hood Length, the drops are always 12" from the sides and max spacing is 36". So, at 61" hood length, the count result should be 3. The if stateemnt in the DropCount parameter is there so the count never goes below 2, which would break the array. Am I taking the wrong approach here?

8516

Alex Cunningham

June 19th, 2012, 11:20 PM

Try this. You may need to fine tune it to the sizes you need.

2012-06-19_1617 - Alex_Cunningham's library (http://screencast.com/t/8hheqOQF)

You can play around with the Array Lenght formula to get it the react the way you need it too. Its basicaly a min or max for the distance between the array.

i had to upgrade the family to 2012 as well.

Clear as mud?

Randy_CaS

June 20th, 2012, 12:23 PM

Thanks for your suggestion Alex. It looks like your array length will return either a 12" or 36" value. This value would need to be variable, since the hood length can be anywhere from 30" to 14'-0" long. Sorry for not pointing this out.

I am going to try using the spacing (created via "second") rather than overall array length (created via "last") in formula, adding 1 to DropCount if spacing < 36"

alexo4141

June 20th, 2012, 12:57 PM

Based on Hood Length, the drops are always 12" from the sides and max spacing is 36". So, at 61" hood length, the count result should be 3.

If you're working on 2012, try that formula :

if(Hood Length < 61", 2, (roundup(DropArrayLength / 36") + 1))

This way, you'll get the max spacing at 36" (At least of what I have tested)

Randy_CaS

June 20th, 2012, 01:07 PM

Unfortunately I am still on 2010 :hide:

alexo4141

June 20th, 2012, 05:39 PM

Ok then, use that one and it should do the trick...

if(Hood Length < 61", 2, DropArrayLength / 36" + 1.49)

Imagine you want a max. spacing of 36" and that you use that formula : (Drop array length / 36) + 1

If you have 37", you'll get 2 (which is the not right answer)

By adding 1.49, Revit will round it up if it's not an exact number.

37/36=1.03

1.03+1.49=2.52

Revit rounds up to 3

If the number you are dividing is exact, Revit will automatically round it down.

72/36=2

2+1.49=3.49

Revit rounds it down to 3 because it stills under the 0.5 rounding limit.

Hope it makes sense...

Randy_CaS

June 20th, 2012, 07:06 PM

I got it working and to be honest, I am not quite sure how lol. I futzed with it until I got the expected result. I did something a little different than your above suggestion, but I think it is the same concept.

I figured since it was a rounding issue, I need to compare the number to the integer, so I added a number parameter with the same formula. I guess there are more than one way to get around the lack of rounding in 2010. Thanks again, Alex

8543

alexo4141

June 20th, 2012, 07:17 PM

Nice to see it working.

It's not that complicated but I really think you should try the +1.49... If it works fine, it will be much more simple.

Just my 0.02

Randy_CaS

June 20th, 2012, 07:31 PM

I will do that, I am curious as well.

edit:

I tested all possibilities with your 1.49 method and you are absolutely correct, it functions the same and is much less wonky. Thanks for making it so easy Alex

alexo4141

June 21st, 2012, 03:25 PM

I'll post that trick in the "Revit Formulas for everyday usage" thread. It could be useful for somebody else.

Thanks for being test subject ;)

Powered by vBulletin® Version 4.2.5 Copyright © 2020 vBulletin Solutions, Inc. All rights reserved.

AutodeskŪ and RevitŪ are registered trademarks or trademarks of Autodesk, Inc., in the USA and other countries.