Simple formulas in dimensions

Simple formulas in dimensions

Marlec
Enthusiast Enthusiast
7,793 Views
14 Replies
Message 1 of 15

Simple formulas in dimensions

Marlec
Enthusiast
Enthusiast

hello,

I'm on Revit Architecture 2017.2, and because of the law where in Québec, it's in french...

So, i'm creating a family with some dimensions that needs to be considered: the part cant be shorter than 4" (102mm minimum, metric project).

I've checked the help section to see how do I write my formula, but I dont know if it's a translation thing, the exemples shown dont work, tried ones that are not related to what I need and keep getting errors in the formulas...

My dim's name is "LONG1" in the parameters box (i'm translating here...), default value is 200, my formula was: "=LONG1 > 102.0", wich gives me an "incompatible values"...

Also used "= LONG1 > 102.0" and "= (LONG1 > 102.0") and some others...

Where's my mistake? 

And is there a place / link that precisely tell where a space is needed or not in a formula? is it the same "language" as Autocad?

 

Thanks in advance for your help!

 

Marlec

0 Likes
Accepted solutions (1)
7,794 Views
14 Replies
Replies (14)
Message 2 of 15

barthbradley
Consultant
Consultant

you using an IF Statement; correct? For example: =if(Long1>102, 200, Long1) 

 

...IF (<condition>, <result-if-true>, <result-if-false>)

 

 ...here's an EXCELLENT reference. Check it out. Print it out. Pin a hardcopy of it above your workstation. 

 

https://www.revitforum.org/tutorials-tips-tricks/1046-revit-formulas-everyday-usage.html

0 Likes
Message 3 of 15

Marlec
Enthusiast
Enthusiast

Thanks for the reply!

I've put 200.0 just to have something to work with... those are aluminium panel that the general dimensions changes from one manufacturer to another, but if bended, the minimum lenght of the bent part is 102mm... so I thought it would be from 102mm to "beyond"...

I didnt think a "condition" (IF) was needed...

So what would be my formula?

 

btw: do you have a link to making formulas (from the basics I mean) ?

 

Marlec

0 Likes
Message 4 of 15

barthbradley
Consultant
Consultant

@Marlec wrote:

 


So what would be my formula?

 


I'm not sure. What's the condition you want to evaluate?  What value do you want to be returned if that condition is met?  What  value do you want to be returned if that condition is not met? 

 

 

0 Likes
Message 5 of 15

Marlec
Enthusiast
Enthusiast

see attached files...

the goal is that not everyone in the office knows the restrictions on such panels...

I wanted to add the formula so that when people stretch the panel, they cant make it shorter than 102mm (166mm including all parameters... 102+3+29+22+10)

 

0 Likes
Message 6 of 15

barthbradley
Consultant
Consultant

Oh, that's an easy one to solve. What you want to do is create a control parameter for the Length Parameter. That control parameter would be the one that actually drives the labeled dimension for the Length of the element. For instance, call it Length Crtl.  Then create another parameter called Length. This would be the one that users enter a value into. Now write a formula for Length Ctrl. Let's say you want the minimum to be 200, then the formula for Length Ctrl would read: =if(Length<200, 200, Length).  

 

Get it?

0 Likes
Message 7 of 15

patrick.emin
Alumni
Alumni

Hello @Marlec FYI we have a french Revit forum: Revit et BIM - Français - Autodesk Community 


Patrick Emin animateur de la communauté francophone


Vous avez trouvé un message utile? Alors donnez un "J'aime" à ce message!
Votre question a eu une réponse satisfaisante? Voulez vous avoir l'amabilité de cliquer sur le bouton
 APPROUVER LA SOLUTION  en bas de la réponse qui apporte une solution?
Signez notre Livre d'Or
0 Likes
Message 8 of 15

barthbradley
Consultant
Consultant

Vive la France!  

 

Smiley Wink

Message 9 of 15

Marlec
Enthusiast
Enthusiast

So I need to rename the 2 lines in the parameter box. 

(can I delete one since both are same and apply it to when ever needed on multiple dimensions/parameters?)

 

I'm trying to understand: "Length Ctrl would read: =if(Length>200, 200, Length)."

- "=if" : starts the conditionnal formula...

- "(Length>200" : says that the length has to be equal or higher than 200

- ", 200, Length)" : this part i'm trying to figure out there meaning / use...

 

 

0 Likes
Message 10 of 15

Marlec
Enthusiast
Enthusiast

No not "Vive la France"...

more a "Vive le Québec libre!" quote from French General Charles DeGaulle in the 60s...

Smiley Wink

Message 11 of 15

ToanDN
Consultant
Consultant

syntax: if (Statement, Result if True, result if False)

your formula: Length Ctrl = if(Length>200, 200, Length)

meaning: If Length > 200 then Length Ctrl = 200; if Length < or = 200 then Length Ctrl = Length

 

 

p/s: Go to the Revit FORMULAs link in my signature for more information.

Message 12 of 15

barthbradley
Consultant
Consultant

I thought we were talking MINIMUM LENGTHS.

If so, the formula should read "<" (e.g. if(Length<200, 200, Length)). If you use ">", that would mean any number in excess of 200 would return 200.  

0 Likes
Message 13 of 15

Marlec
Enthusiast
Enthusiast
Accepted solution

thank you all for the help!

it works, and I'll do some reading to improve...

 

Regards,

 

Marlec

0 Likes
Message 14 of 15

barthbradley
Consultant
Consultant

@Marlec wrote:

thank you all for the help!

it works, and I'll do some reading to improve...

 

Regards,

 

Marlec


 

 

You're welcome, @Marlec.  Can you mark my post as the accepted solution please? 

 

...Excellent resource here.  Print it out and keep a hardcopy by your workstation for quick reference.  

0 Likes
Message 15 of 15

samih__ayad
Participant
Participant

Hello 

i am trying to make 2 filters for area reinforcement 

one is less than 12m 

the 2nd one greater than 12m 

the point is that i want to show the rebars that have rebar length above 12m inorder to make splices for them so when am making vg then filter then adding those filters in the rule box there is only total rebar length and there is no rebar length .

plz helo i tried making parameters but not usefull because after making project parameters i am obliged to enter the bar length manualy 

help plz

0 Likes