cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X

Conditioned Loop

IRarch
7-Bedrock

Conditioned Loop

Final goal is to output a Graph with X and Y values.

 

I am having problems with the generation of the Y values. The Y values depend on weather an initial value is "Yes" or "No" under the variable Assembly.

 

I would like to replace matrix B and C for a single matrix that will take into account the Matrix called Assembly. 

 

If you look at both examples, SW-1 and SW-3, you will notice that matrix B depends on weather Assembly starts with a "Yes" or a "No". Matrix C is simply the cumulative addition of matrix B.

 

I was thinking of creating a Loop that starts with Matrix ShearWall.Gap and applies the multiplication ShearWall.Gap0 times (v.shearwall-v.diaphragm) if Assembly is "Yes" or -ShearWall.Gap0 times (v.diaphragm) if Assembly is "No" and then continue doing what Matrix B and C are doing. Stack the C values and be able to graph them.

 

Thanks for any of your input.

2 REPLIES 2
LucMeekes
23-Emerald III
(To:IRarch)

You can use a condition in a calculation:

 

B:= (Assembly="yes")*3+(Assembly="no")*7

 

Will make B be 3 when Assembly equals "yes",

will make it 7 when Assembly equals "no",

will produce an error when Assembly is undefined

and will make B be 0 when Assembly has any other value.

 

Of course you can prevent that last situation with:

B:= (Assembly="yes")*3+(Assembly=/="yes")*7

(where =/= is the 'unequality' symbol).

 

Success!
Luc

Hi Luc,

 

If I understand correctly, I think this would be a good way to start a loop. I believe I need a loop because Assembly can vary in the number of inputs in its matrix e.g. Assembly can have three "Yes" and two "No" or 10 "Yes" and nine "No". And it can start with either a "Yes" or a "No".

 

I am uploading the file again. Example SW - 1a has the graph correctly. SW - 1b has the intended B Matrix and C Matrix where the intention is to do what SW - 1a does. SW - 2 is another possibility of the inputs for Assembly.

Top Tags