If/Then Formula

If/Then Formula

Anonymous
Not applicable
5,715 Views
16 Replies
Message 1 of 17

If/Then Formula

Anonymous
Not applicable

Hello,

 

I am trying to create an if/then formula in my family types. I do not have experience in doing this and researched quite a bit but still having no luck. I'm trying to create a formula:

 

when Point "A" moves, than Object "B" automatic moves with it.

 

I have created visibility instance parameters with each. Point "A" parameter is "L_Ref_Point" while Object "B" parameter is "WWT_L". In my family types (see attached pic) how do i initially set up these formulas. Like I've said i have researched but do not know the exact text to add. Thanks!

0 Likes
Accepted solutions (1)
5,716 Views
16 Replies
Replies (16)
Message 2 of 17

Anonymous
Not applicable

hi,

 

 I don't quite get what you are trying to figure out. But if you want to make a point dependent to another, you can just tie them up with a locked dimension.

 

anyways the formula for an IF statement is:  if(condition, true, false) 

each are seperated by a comma.

 

e.g. 

condition: Length>100mm

true: Width*2

falss: Width/2

 

more info here

https://knowledge.autodesk.com/support/revit-products/learn-explore/caas/CloudHelp/cloudhelp/2014/EN...

 

If you could detail how would you like the parameter to function maybe we could help you more.

 

Regards,

Z

Message 3 of 17

RDAOU
Mentor
Mentor

HI @Anonymous

 

when you say A move along with B, it has nothing to do with visibility.

 

  1. To move means the object/geometry/element need to be constrained and the dimension set as parameter which u can change later
  2. for a second object to move alone and exactly the same with it in same direction doesn't require a formula. In such case the two elements are locked/constrained to each other or to same plane
  3. if they move in different direction but together you still do not need an if because the the parameter controlling the movement of A will be = to parameter B

you need the IF only when it is conditional...ie: element B will move with A ONLY IF A moves more than 10cm (example) THEN ... U enter the remainder of the condition... The format is as follows

 

IF( Condition, Action 1, Action 2)

 

condition: example A > 10cm

Action 1: Revit executes this action if the condition is true example: Parameter A = Parameter B

Action 2: Revit executes this if the contrition is false example: 0  or any other value or nested formula

 

Parameter B = If(Parameter_A > 100mm, Parameter_A, 0mm)

 

 

if you attach the family maybe someone can help you or assist you with a screencast

YOUTUBE | BIM | COMPUTATIONAL DESIGN | PARAMETRIC DESIGN | GENERATIVE DESIGN | VISUAL PROGRAMMING
If you find this reply helpful kindly hit the LIKE BUTTON and if applicable please ACCEPT AS SOLUTION


Message 4 of 17

Anonymous
Not applicable

So if i just lock the dimension in the family, than when one point moves the other will automatically move with it? Its that simple?

0 Likes
Message 5 of 17

RDAOU
Mentor
Mentor

@Anonymous

 

From what you have described and from what I could understand or visualize (what u r trying to do) Yes it can be as simple as that 

 

I personally prefer to lock elements to reference planes and constrain with locked dimensions (not directly to elements)

YOUTUBE | BIM | COMPUTATIONAL DESIGN | PARAMETRIC DESIGN | GENERATIVE DESIGN | VISUAL PROGRAMMING
If you find this reply helpful kindly hit the LIKE BUTTON and if applicable please ACCEPT AS SOLUTION


Message 6 of 17

Anonymous
Not applicable

Yes you need to tie them up to reference planes and not on the elements. you might want to add an instance length parameter to one of ref plane to enable the drag points when you load them to the project.

 

1.JPG

Message 7 of 17

Anonymous
Not applicable

Please see attached picture. I am still trying to figure out how to make these ref. points, ref. lines and the arrows (created from Autocad) move in both directions, left to right. 

0 Likes
Message 8 of 17

RDAOU
Mentor
Mentor

@Anonymous

 

  1. That's Massing environment...things are hosted and constrained a little bit different than other families... to save us the guessing game, can you upload you file so someone can have a look and make a screencast for you to follow?
  2. Also define how you want them to move and where? Vertically? Horizontally? Or just float in space
  3. also please clarify what is that family as in what is it supposed to be!

YOUTUBE | BIM | COMPUTATIONAL DESIGN | PARAMETRIC DESIGN | GENERATIVE DESIGN | VISUAL PROGRAMMING
If you find this reply helpful kindly hit the LIKE BUTTON and if applicable please ACCEPT AS SOLUTION


0 Likes
Message 9 of 17

Anonymous
Not applicable

@RDAOU

 

1. Please see attached file.

 

2. I would like the ability to move horizontally left and right following the plane.

 

3. The family was created using the template "Generic Model Adaptive" 

 

Thank you very much for you help!

0 Likes
Message 10 of 17

ToanDN
Consultant
Consultant

Attached is the file I attempted to fix.

 

In all honesty, I don't understand why you need to use an adaptive family for this.  You don't even have any adaptive points in the family.  If you want to control the movement of elements via reference planes and parameters, there is no need for an adaptive family.  A regular family will work just fine.

 

Maybe others can have different insights.

Message 11 of 17

Anonymous
Not applicable

@ToanDN

 

The model you sent is exactly what i am looking for. Thank you for your help.Could you briefly tell me how you were able to create the L1 & L2=2'-0" parameter and link the arrows with it? I really i just need to know the steps.

 

This family needs to be adaptive because it will be pushed through a work program into a wire frame coordinate system project. It's for a complex curtain wall system. This family will multiply 2,000x and the reason for the arrows is to be able to pin point certain locations on the project.

0 Likes
Message 12 of 17

ToanDN
Consultant
Consultant

@Anonymous

 

Below are my steps:

 

  1. Create reference planes for left, right, and the two elevations
  2. Add dimensions and associate them with parameters
  3. Lock the each reference point to the proper reference planes
  4. Lock the center of each instance of the Red arrow family to the reference planes
  5. Open Family Type dialog, change the dimensions parameters, and watch if the family flexes properly
Message 13 of 17

RDAOU
Mentor
Mentor
Accepted solution

@Anonymous @ToanDN

 

I still do not understand the purpose of this family and what it is supposed to do...besides that the generic 2D model with symbol inside isn't somethin which I really dig or encourage. They wont break but when you start rotating and flipping a 2D element in 3D space it will look pretty much awkward... so imagine 2000 of these!!!

 

You know the sun dial? how its shadow shrinks and grows with respect to the angle of the sun? 2D element in 3D models are the same!!!

 

So good luck 🙂

 

Below is just an example of how I would handle control of elements in an adaptive family...Again this is just an example there are other ways to do so depending on the purpose of the family and how it is supposed to function...

 

Cheers

 

YOUTUBE | BIM | COMPUTATIONAL DESIGN | PARAMETRIC DESIGN | GENERATIVE DESIGN | VISUAL PROGRAMMING
If you find this reply helpful kindly hit the LIKE BUTTON and if applicable please ACCEPT AS SOLUTION


Message 14 of 17

Anonymous
Not applicable

@RDAOU

 

Thank you so much for your screen cast. Very helpful. I do have, hopefully one last question, at minute 8:09, i see that we are trying to insert my generic model symbol WWT_L & WWL_R. I am not able to select a placement (Place on Face/Place on work plane) for these symbols. If you see below, 809.png is a screenshot of your screen cast and Revit Pic 4.png is a screen shot of mine. The ribbons are different. I made sure to also change the work plane for this reference point and nothing is seeming to do the trick. I will also attach my model if you need more information. Thanks again.

0 Likes
Message 15 of 17

Anonymous
Not applicable

I actually just figured it out. IN that block family, i have to check Work Plane-Based in the properties! Thanks

Message 16 of 17

Kazim_RazaR9R9H
Community Visitor
Community Visitor

if(Check box, 1000 mm, **Retain typed value**)
Is there a way we can fix a certain dimension if condition meets but retain the typed value if it fails, or similarly vice versa. I know it can be done by creating a new parameter for the failure part but maybe we could do it directly (as in Excel)? 

0 Likes
Message 17 of 17

Alfredo_Medina
Mentor
Mentor

No, but you can simply make that value be equal to another value, if Check box is not true, such as:

 if(Check box, 1000 mm, Another value)


Alfredo Medina _________________________________________________________________ ______
Licensed Architect (Florida) | Freelance Instructor | Profile on Linkedin