Revit MEP

Reply
Mentor
michaelmead
Posts: 290
Registered: ‎03-02-2012
Message 1 of 2 (137 Views)
Accepted Solution

WHILE loop?

137 Views, 1 Replies
08-23-2013 12:52 PM
Can you do while loops in revit? If not, how do you track three variables? For example If 10<20, and 20<30, then C=1. the only problem is that C can have 4 values and logically can have more t...

michaelmead wrote:
"Can you do while loops in revit? If not, how do you track three variables? For example If 10<20, and 20<30, then C=1. the only problem is that C can have 4 values and logically can have more than one correct value based on the values of A and B...? any programers out there? Thanks!"

 

A while loop is not possible within Revit's... less than stellar formulaic abilities. You can use a series of nested IF/THEN/ELSE statements. For example, this formula defines the Integer Value of "ParamC" based on the values of "ParamA" and "ParamB":

 

if(and(ParamA>20, ParamB>20), 35, if(and(ParamA<20, ParamB>20), 25, if(and(ParamA<20, ParamB<20), 15, 5)))

 

This formula checks the conditions and returns the results as listed below:

 

          IF AND...             THEN…
"ParamA" "ParamB"    "ParamC"=
   >20           >20                35
   <20           >20                25
   <20           <20                15
None of the above              5

 

Hope that helps!

*Expert Elite*
CADastrophe
Posts: 3,401
Registered: ‎08-28-2009
Message 2 of 2 (129 Views)

Re: WHILE loop?

08-23-2013 01:26 PM in reply to: michaelmead

michaelmead wrote:
"Can you do while loops in revit? If not, how do you track three variables? For example If 10<20, and 20<30, then C=1. the only problem is that C can have 4 values and logically can have more than one correct value based on the values of A and B...? any programers out there? Thanks!"

 

A while loop is not possible within Revit's... less than stellar formulaic abilities. You can use a series of nested IF/THEN/ELSE statements. For example, this formula defines the Integer Value of "ParamC" based on the values of "ParamA" and "ParamB":

 

if(and(ParamA>20, ParamB>20), 35, if(and(ParamA<20, ParamB>20), 25, if(and(ParamA<20, ParamB<20), 15, 5)))

 

This formula checks the conditions and returns the results as listed below:

 

          IF AND...             THEN…
"ParamA" "ParamB"    "ParamC"=
   >20           >20                35
   <20           >20                25
   <20           <20                15
None of the above              5

 

Hope that helps!

Corey D.                                                                                                                  ADSK_Logo_EE_2013.png    AutoCAD 2014 User  Revit 2014 User
──────────────────────────────────────────────────────────────────────
⁞|⁞ Please use Mark Solutions!.Accept as Solution and Give Kudos!Give Kudos as appropriate to further enhance these forums. Thank you!
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!