You can use conditional statements in formulas to define actions in a family that depend on the state of other parameters. With conditional statements, the software enters values for a parameter based on whether a specified condition is satisfied. Conditional statements are useful in certain circumstances; however, they make families more complex and should be used only when necessary.
For most type parameters, conditional statements are unnecessary because the type parameter itself is like a conditional statement: If this is the type, then set this parameter to a specified value. Instance parameters are a more productive place to use conditional statements, particularly when they are used to set a parameter that does not vary continuously.
This means that the values entered for the parameter depend on whether the condition is satisfied true or not satisfied false. If the condition is true, the software returns the true value.
If the condition is false, it returns the false value.
To express such a comparison, you can use a logical NOT. The following are sample formulas that use conditional statements. For example, you can use conditional statements to. In Revitarrays can only have an integer value of 2 or greater.
In some situations, it may be useful to create a conditional formula that maintains an array parameter of 2 even if the calculated value is 1 or 0. With such a formula, if the calculated array value is 2 or greater, the formula retains the value. However, if the calculated value is 1 or 0, the formula changes the value to 2. In this example, when the condition is met truethe MuntinVis parameter value is selected, and the muntin geometry is visible.
Conversely, when the condition is not met falsethe MuntinVis parameter is cleared, and the muntin geometry is not visible. For example, you can use conditional statements to Prevent an array parameter from taking a value less than 2.
Valid Formula Syntax and Abbreviations
Parent topic: Formulas.Great post, which prompted this one from me. Nice job, Maller.How to make a Polar Array
The trig reminds me a lot of AP Physics with Kessel. We did a lot of those calcs back in the day Glad someone remembers : "Pull through Maller! Pull through!
Post a Comment.
I do regret that there hasnt been much going on in the last month or two that has been worth mentioning in a Revit blog Thats a byproduct of a few jobs being at the wrap up stage, and a couple others being pretty early on.
I havent had to craft up many things Until yesterday. Someone in the office was tasked with finding a linear distance around an arc, where the arc was not a full semi-circle. Furthermore, scheduling said distance, around several windows. Now, recently, i know there have been several posts on AUGI asking for "list parameters," or parameters that are driven by the geometry, but dont inflict the gemometry.
I suppose any parameter works, in that sense As long as its formulated by other parameters, which is what we did here. As with all Revit families and formulas, we quickly realized that we didnt need all these for the calc. We needed them to constrain things. T, for instance. If you work your way backwards from our end result, the parameter for Length T is never used But we had to constrain the Reference Lines endpoints to get angle Theta. To constrain them, we needed value T to adjust correctly with the radius and chord changes.
Parameter "": We still may not need this one.
But in a formula, i couldnt figure out how to type in "degrees" as a unit, so i made a static angle parameter, lol. Chime in if theres a way to type in a value like "35 degrees" directly in a formula, haha. So CIRC was irrelevant at that point, but the point is, we needed the circumference, one way or another.
In any event, we started deriving the formulas Anyone else have an issue with this? I couldnt wrap my head around how i multiplied degrees and Length, to come up with a mathemtatical unit besides degree-inch, lol. So i called in a favor:. My good friend Brian last name with held is a Math Specialist at a local school district.
He happened to be out at happy hour with some other math teachers. So i got him to hand the phone around the Chili's bar, which his teacher friend Secondary Education math teacher reminded me that i would have to convert Theta in to a length, using Pi. More accurately, i could take Theta's proportion to the overall circle degreesand ise that proportion times the circumference of the circle CIRCand i could then get the "length" of the arc length.
In finished form, it looks so simple, as the formulas obviously make all the reference planes end up in such a fashion that it looks easy to obtain. Maybe it is for you, i dont know This took a few minutes for me to figure out, i might be slow, haha. This brings up a host of other Revit questions that we could discuss based on this issue though:.You don't have to hardwired the value 1 as a formula. You can make it a value that can be changed by users to 0 or 2, 3 etc - but if you do that then you'll need to put in error checking formulas too.
Can you answer this? Hi Unknown. The count parameter has to be a number or integer. Your formula has "" quotes, which implies you are using text parameters, which won't work.
In every other case where i have converted a real number to text this has worked. Mind you, I normally use this formula to print the result of a shelf that got streched or something, so the math is visible in a parameter somewhere Your calculation works per line, not on the totals, even when you don't itemize every instance. Have a look at "Using Totals in Formulas" on my blog to solve this.
Anyone who has tried to master Revit Schedules would have encountered all kinds of limitations. Labels: calculatecountformulaintegernumberparameterRevitscheduletexttotaltypevalue. Beauclarc 18 October at RevitCat 18 October at Maguaer 9 January at Unknown 10 April at RevitCat 10 April at Unknown 11 April at RevitCat 11 April at Newer Post Older Post Home.Formulas allow you to create parameters that depend on other parameters for their values.
A simple example would be a width parameter set to equal twice the height of an object. In practice, formulas can be used in many ways, both simple and sophisticated. Typical uses include embedding design relationships, relating a number of instances to a variable length, and setting up angular relationships.
For example, formulas can be used to. If a formula contains 2 or more variables, then the parameter value is grayed out and cannot be changed directly. The value of the parameter must be derived by changing the input variables of the formula. For example, formulas can be used to Calculate area or volume of geometry Create a clearance dimension parameter controlled by element size Convert continuously variable values into integer values Add shelves as the height of casework increases Add diagonals in an open web joist as the length increases Note: When a formula is used to calculate the value of a parameter and contains only one variable, the value of the parameter can be changed in two ways: indirectly, by changing the value of the variable used in the formula.
Parent topic: Formulas.Formulas support the following arithmetic operations: addition, subtraction, multiplication, division, exponentiation, logarithms, and square roots. Formulas also support the following trigonometric functions: sine, cosine, tangent, arcsine, arccosine, and arctangent. The valid formula abbreviations for arithmetic operations and trigonometric functions are. You can enter integers, decimals, and fractional values in formulas, using normal mathematical syntax, as shown in the examples below:.
Parameter names in formulas are case sensitive. For example, if a parameter name begins with a capital letter, such as Width, you must enter it in the formula with an initial capital letter. Formulas support standard arithmetic operations and trigonometric functions.
Function syntax Description Examples round x The round function returns a value rounded to the nearest whole number. It doesn't take into consideration rounding direction. Note: It is recommended that you do not use a dash - when naming parameters. Parent topic: Formulas. The round function returns a value rounded to the nearest whole number. The roundup function returns a value to the largest integral value greater than or equal to x. The rounddown function returns a value to the smallest integral value less than or equal to x.I was wondering if there was a way to make conditional formulas with a parameter?
On the pulldown to enter the field under properties. I want there to be 3 choices i. If the user tries to enter any value other than the 3 values specified whether by typing or pulldowna message comes up stating they cant do that. The names for the systems have been simplifed for this example but the spelling is critical to the external database.
X because thats the first conditional value. It works fine for the first teo dimension tests but when I add this last one I get the error. Is it possible to read the current wall thickness of a door's host and use that dimension in a conditional statement to locate the frame's setback? If the wall is deeper than the frame I want the door flush with the wall, if the frame is deeper than the wall, I want the door centered.
I set up a Wall Width paramenter in my door family but I keep getting the "Inconsistent units" error message. I have been working on creating windows for the place I work.
I want to make my windows so they are quick and easy to create new ones without having to add in new information like if the glass is tempered or if its an egress window. I would like to set up formulas for these. I am stuck at my egress window parameter.
Use Formulas in the Family Editor
I have included an image of what I am working on and the calculations and formulas I have so far. I would like to have my egress check box to say yes if the Opening Width is greater then 20", the opening height is greater then 24" and the opening sf is greater then 5.
How would I set this parameter up? I've created an area schedule that divides my plan into seperate appartments. I would like to sort mu window schedule by this parameter- is there an option to link a window to a specific area, just like it's linked to floors? How I can get the finished floor material from the floor in the room tag?Results 1 to 4 of 4. Thread Tools Show Printable Version. Login to Give a bone. Hey guys, I would like to be able to have 5 parameters toggle off when any one of the others are selected using formulas to do such a thing.
I think this is possible, am I wrong? Any help would be appreciated. Thanks, Also, if you have a better way please let me know. Attached Images Not picture. PNG You cannot. Or, you use a profile family, and then a Family Type parameter to control which profile it displays. Cheers, Jeff S. Buckminster Fuller. Thanks guys I appreciate the help. I went with the integer option that CADastrophe suggested. It did exactly what I wanted. I have done what you posted in the past but I was doing this in a note with parameters for options for a specifications list.
Once again thanks for the info. Replies: 5 Last Post:PM. Multiple Visibility Parameters By autocad. Replies: 2 Last Post:AM. Adding Multiple Parameters at Once?
By stuntmonkee in forum Revit Architecture - General. Replies: 1 Last Post:PM. Replies: 3 Last Post:PM. Replies: 0 Last Post:PM.