# If Expression to peform automatted Brep Selection

Hi Everybody,

I am trying to use the If Expression to perform the scaling function on a group of breps or only a single brep.

At present I have a length A. Length A is my new length I wish to scale to. I also have Length B, which is the Max & Min Extents of my 3 Breps. If A-B<0, the if expression returns True. If A-B>0, the if expression returns False. This part I am happy with.

Based on this True/False Answer, I would like to select which breps I perform my scaling function on. So if there answer is True, I would like to select all 3 breps and scale according to my scaling factor. If the answer is False, I would like to select only one brep and scale only this brep.

Is there a way to do this with the Expression function? Or do I need to be going round this problem a different way?

Below is my first Expression which returns true or false. From there on, I am not sure if a further if expression is the right way to go, as it will only return a List from either A or B depending on the True/False Statment!

Many thanks for any help.

…no variable declaration or IFS or LOOPS

Yes this should be possible, can you upload your definition with internalised geometry?

Hi Lando, Thanks for the reply.

To simplify the problem, It is okay to make Brep A, Brep B & Brep C (See image above) all cubes of length, width & height of 1m.

Therefore if you positioned Brep A at the Origin and then staggered B & C, the total length would be 3m in the x direction.

Back to original question, If I wanted the new total length to be 4m, the expression would only select Brep B (Cube in the middle) and scale by 2 in the x direction. However if I wanted the new length to be 1.5m, then the expression would select Brep A,B & C and scale by 0.5 in the x direction.

Don’t sure I answer the question, but you can use Stream Filter, it was difficult for me to discover this component Input a 0 in G and input 0 will the output
Input a 1 in G and input 1 will the output

The only problem is when you input a datatree in G. It doesn’t work (from what I remember). For that I made special components.

Here is one way using `Stream Filter` as @laurent_delrieu mentioned:

brepScaling.gh (15.3 KB)