What's wrong with this formula?

What's wrong with this formula?

Sahay_R
Mentor Mentor
5,657 Views
48 Replies
Message 1 of 49

What's wrong with this formula?

Sahay_R
Mentor
Mentor

Capture.PNGI am trying to create a line based Detail Component family. I would like the array to round down if it is placed to a dimension that isn't perfect - and all I get when I place the formula for Length is the dreaded Inconsistent Units error message. Doesn't ROUNDDOWN work for dimensions?


Rina Sahay
Autodesk Expert Elite
Revit Architecture Certified Professional

If you find my post interesting, feel free to give a Kudo.
If it solves your problem, please click Accept to enhance the Forum.
0 Likes
Accepted solutions (1)
5,658 Views
48 Replies
Replies (48)
Message 2 of 49

barthbradley
Consultant
Consultant

Unfortunately Rounddown is Unitless. But, you can use its value in a formula for a Length value. 

Message 3 of 49

barthbradley
Consultant
Consultant

...maybe 3 more parameters: .

 

Number Parameter: Formula=Length/1.

Number Parameter2: Formula=Roundown(Number Parameter)

Length Parameter2: Formula=Number Parameter2*1' 

 

 

0 Likes
Message 4 of 49

ToanDN
Consultant
Consultant
Not answering your question but if it is a Line based family, the built-in Length parameter shouldn't be driven by a formula.
Message 5 of 49

Sahay_R
Mentor
Mentor

Point conceded, @ToanDN. However I do not want it to try to place items at random spaces at the end of the array when the Length is not perfect - hence the Rounddown. Right now I have it without the Length parameter formula and it works fine for smaller distances. It's when I flex the family up to 20'+ that the fun starts. Maybe I should just sit back and accept it as is......


Rina Sahay
Autodesk Expert Elite
Revit Architecture Certified Professional

If you find my post interesting, feel free to give a Kudo.
If it solves your problem, please click Accept to enhance the Forum.
0 Likes
Message 6 of 49

Sahay_R
Mentor
Mentor

So @barthbradley, if I divided all the length based parameters by 1 the formula would work?


Rina Sahay
Autodesk Expert Elite
Revit Architecture Certified Professional

If you find my post interesting, feel free to give a Kudo.
If it solves your problem, please click Accept to enhance the Forum.
0 Likes
Message 7 of 49

barthbradley
Consultant
Consultant

I'm saying the if the "Length" Parameter in my 1st Formula is the unvarnished, true length; the one you want to Rounddown. The 3 additional parameters will find "Length2" which is your "Length" rounded down. 

 

....I'm responding to:

 



@Sahay_Rwrote:

So @barthbradley, if I divided all the length based parameters by 1 the formula would work?



 ..So, in your case, you enter "Length2" in the formula field for "Length". Which means, you actually need a 4th parameter which has the formula you've written for "Length" minus the Rounddown. This 4th parameter becomes the "Length" parameter in my 1st formula.  Confused yet? 

 

Message 8 of 49

FAIR59
Advisor
Advisor

I think the rounding is accomplished in the formula of parameter Array_Number.

you can find the "adjusted"length as follows:

 

Length2 = (Array_Number-1)* Array_Distance + ( 2* End + W4 )

0 Likes
Message 9 of 49

barthbradley
Consultant
Consultant

@FAIR59wrote:

I think the rounding is accomplished in the formula of parameter Array_Number.

you can find the "adjusted"length as follows:

 

Length2 = (Array_Number-1)* Array_Distance + ( 2* End + W4 )


Why minus 1? But, why anything? Number * Length works (e.g. 2 * 2'-0" = 4'-0"). 

0 Likes
Message 10 of 49

FAIR59
Advisor
Advisor

@barthbradleywrote:


 

 

Why minus 1? But, why anything? Number * Length works (e.g. 2 * 2'-0" = 4'-0"). 

minus 1 to get the number of intervals in the array.


 

0 Likes
Message 11 of 49

barthbradley
Consultant
Consultant

@FAIR59wrote:


minus 1 to get the number of intervals in the array. 

 

 

Intervals? Not following you. Minus 1 is only subtracting 1 from the Array number (e.g. 4-1=3).  

0 Likes
Message 12 of 49

ToanDN
Consultant
Consultant
I still don't understand what this entire exercise is supposed to accomplish. To report the true overall length of the Array; or to limit the length of the Line driving the Array to a nice round figure? If the former, just add a reporting parameter; if the latter, well, it seems kinda pointless.
0 Likes
Message 13 of 49

barthbradley
Consultant
Consultant

@ToanDNwrote:
I still don't understand what this entire exercise is supposed to accomplish. To report the true overall length of the Array; or to limit the length of the Line driving the Array to a nice round figure? If the former, just add a reporting parameter; if the latter, well, it seems kinda pointless.

Actually, I think it's both.

 

But, then again: it's all about perspective today; isn't it? Smiley Wink

 

Contradiction.jpg

 

Message 14 of 49

ToanDN
Consultant
Consultant

@barthbradley wrote:

@ToanDNwrote:
I still don't understand what this entire exercise is supposed to accomplish. To report the true overall length of the Array; or to limit the length of the Line driving the Array to a nice round figure? If the former, just add a reporting parameter; if the latter, well, it seems kinda pointless.

Actually, I think it's both.

 


Then just add the reporting parameter to report the true length of the Array, then after draw the line family in project, look at the value of the reporting parameter and enter it to the Length parameter.  Voila!!!  Nice and round and still pointless.

Message 15 of 49

barthbradley
Consultant
Consultant

@ToanDNwrote:


Then just add the reporting parameter to report the true length of the Array, then after draw the line family in project, look at the value of the reporting parameter and enter it to the Length parameter.  Voila!!!  Nice and round and still pointless.


Ours not to reason why, ours but to do and die.

- Alfred Lord Tennyson 

Message 16 of 49

ToanDN
Consultant
Consultant

@barthbradley wrote:

@ToanDNwrote:


Then just add the reporting parameter to report the true length of the Array, then after draw the line family in project, look at the value of the reporting parameter and enter it to the Length parameter.  Voila!!!  Nice and round and still pointless.


Ours not to reason why, ours but to do and die.

- Alfred Lord Tennyson 


"Thou shall not trust everything written on an internet forum.

- Isaac Newton - 1729

Message 17 of 49

Sahay_R
Mentor
Mentor

OMG. I stepped away for a little while and look at the resulting pandemonium!

 

I will take a nicely rounded - and yes, pointless - solution. Let me see if I can plug in the input from this conversation and actually reach a successful result.


Rina Sahay
Autodesk Expert Elite
Revit Architecture Certified Professional

If you find my post interesting, feel free to give a Kudo.
If it solves your problem, please click Accept to enhance the Forum.
0 Likes
Message 18 of 49

Ilic.Andrej
Advisor
Advisor

@Sahay_R  The roundown function creates the "Number" result but it still can be used in a formula of a length parameter.

 

So, this is your formula:

 

Length:    rounddown(((Array Number/1)*Array Distance)+(2*End)+W4)

 

So what you have here is this:

 

rounddown ( (unitless/feet)*feet + square feet + feet)

 

This is because in length parameters, Revit assigns units to the numbers you write- so its not just 2, its 2' . Even though the rounddown turns everything into the number at the end, I'm not sure if this operation inside it can be processed. Second, lets say that it can - you still have the Number as a result - not Length.

 

Try this formula:

 

rounddown ( this operation needs to have consistent units and then whatever unit was left will be removed) * a value needs to be used to give a new unit to the final result so that Number will be turned into Length

 

Length:    rounddown((Array Number*Array Distance+2*End/1+W4)/1)*1

 

   rounddown ((unitless*feet + square feet/feet + feet)/feet) * feet

= rounddown ((feet + feet + feet)/feet) * feet

= rounddown (unitless) * feet

= unitless * feet

= feet



Andrej Ilić

phonetical: ændreɪ ilich
MSc Arch

Autodesk Expert Elite Alumni

Message 19 of 49

Ilic.Andrej
Advisor
Advisor

@Ilic.Andrejwrote:

@Sahay_R  The roundown function creates the "Number" result but it still can be used in a formula of a length parameter.

 

So, this is your formula:

 

Length:    rounddown(((Array Number/1)*Array Distance)+(2*End)+W4)

 

So what you have here is this:

 

rounddown ( (unitless/feet)*feet + square feet + feet)

 

This is because in length parameters, Revit assigns units to the numbers you write- so its not just 2, its 2' . Even though the rounddown turns everything into the number at the end, I'm not sure if this operation inside it can be processed. Second, lets say that it can - you still have the Number as a result - not Length.

 

Try this formula:

 

rounddown ( this operation needs to have consistent units and then whatever unit was left will be removed) * a value needs to be used to give a new unit to the final result so that Number will be turned into Length

 

Length:    rounddown((Array Number*Array Distance+2*End/1+W4)/1)*1

 

   rounddown ((unitless*feet + square feet/feet + feet)/feet) * feet

= rounddown ((feet + feet + feet)/feet) * feet

= rounddown (unitless) * feet

= unitless * feet

= feet


it was edited- I had to correct smthg.



Andrej Ilić

phonetical: ændreɪ ilich
MSc Arch

Autodesk Expert Elite Alumni

Message 20 of 49

ToanDN
Consultant
Consultant
@Ilic.Andrej

I admire your expertise in understanding formula rules but I think you missed the key point that this is a line based family. The built-in Length parameter is necessary to be left untouched so that you can draw the line properly in the project. If any formula needed to calculate a round distance, it should be assigned to another parameter, such as Length2 as suggested by @FAIR2. And a reporting parameter can accomplish the same, without a single formula.