Maximum and Minimum Values to revit Parameters

Maximum and Minimum Values to revit Parameters

Anonymous
Not applicable
9,525 Views
11 Replies
Message 1 of 12

Maximum and Minimum Values to revit Parameters

Anonymous
Not applicable

We want to make a signage family that reflects the real-world substrate sheet sizes: 1200x2400mm.

 

We have worked out how to make a height constraint that is between 0-2400mm, and a width constraint between 0-2400mm, which is half way there.

Height = if(Height Input < 0 mm, 0 mm, (if(Height Input > 2400 mm, 2400 mm, Height Input)))

Width = if(Width Input < 0 mm, 0 mm, (if(Width Input > 2400 mm, 2400 mm, Width Input)))

 

What we also want to add in, is the restriction that if the height is between 1200-2400mm, then the width must be between 0-1200mm, and if the width is between 1200-2400mm then the height must be between 0-1200mm. (Basically you can have a landscape sign maximum size 2400x1200 or a portrait sign maximum size 1200x2400.)

 

IE: The height should be between 0-2400mm, unless the width is greater than 1200mm, in which case it can only have a maximum width of 1200mm (and vice versa).

 

We tried a couple of options but got "if" and "comma" errors.

 

I feel like this post might have some good formulas but I can't see them all:

https://forums.autodesk.com/t5/revit-mep-forum/parameters-and-scheduling/m-p/6890693

 

Any tips gratefully received.

0 Likes
Accepted solutions (1)
9,526 Views
11 Replies
Replies (11)
Message 2 of 12

Corsten.Au
Advisor
Advisor

Hi

I think you should not use " Zero " anywhere in the input.. you need some minimum value...

those " 0" are breaking the formula.... ex : length cannot be " minus" logically...

 

Cheers

Corsten
Building Designer
Message 3 of 12

Avaris.
Advisor
Advisor

First attempt:

if(Height Input < 10 mm, 10 mm, (if(not(Width Input > 1200 mm), (if(Height Input > 2400 mm, 2400 mm, Height Input)), (if(Height Input > 1200 mm, 1200 mm, Height Input)))))

 

if(Width Input < 10 mm, 10 mm, (if(not(Height Input > 1200 mm), (if(Width Input > 2400 mm, 2400 mm, Width Input)), (if(Width Input > 1200 mm, 1200 mm, Width Input)))))

 

I made the minimum width 10, because an extrusion cannot be 0 in width, it will break your family. This formula tests the input for height as width in order to set the maximum at 1200 or 2400. One disadvantage, if someone uses two values above 1200, it will not give preference to one of them. And makes them both 1200.

 

If you want preference for width, put your original formula in width (and vice versa).

 

PS: You don't need the input height/width in your view; they can be parameters which don't appear as dimension.

Message 4 of 12

ToanDN
Consultant
Consultant
Perhaps a lunch break education so that your employees understand the limitation of the sheet dimensions can go a long way.
Message 5 of 12

Ilic.Andrej
Advisor
Advisor
Accepted solution

Hello,

 

I would advise to create yes/no parameter called "Landscape" and then use it as a condition. The user chooses  landscape over portrait by checking "Landscape".

 

parameter Height:

 

if(Landscsape,
    if(Height Input < 1 mm,
        1 mm,
        if(Height Input > 1200 mm,
            1200 mm,
            Height Input
        )
    ),
    if(Height Input < 1200 mm,
        1200 mm,
        if(Height Input > 2400 mm,
            2400 mm,
            Height Input
        )
    )
)

condensed form:

if(Landscsape,if(Height Input < 1 mm,1 mm,if(Height Input > 1200 mm,1200 mm,Height Input)),if(Height Input < 1200 mm,1200 mm,if(Height Input > 2400 mm,2400 mm,Height Input)))

 

 

parameter Width:

 

if(Landscsape,
    if(Width Input < 1200 mm,
        1200 mm,
        if(Width Input > 2400 mm,
            2400 mm,
            Width Input
        )
    ),
    if(Width Input < 1 mm,
        1 mm,
        if(Width Input > 1200 mm,
            1200 mm,
            Width Input
        )
    )
)

condensed:

if(Landscsape,if(Width Input < 1200 mm,1200 mm,if(Width Input > 2400 mm,2400 mm,Width Input)),if(Width Input < 1 mm,1 mm,if(Width Input > 1200 mm,1200 mm,Width Input)))

 



Andrej Ilić

phonetical: ændreɪ ilich
MSc Arch

Autodesk Expert Elite Alumni

Message 6 of 12

Anonymous
Not applicable

Touche, @ToanDN. Yes, we will be educating the team on sheet sizes as we do training. I just got excited that we could program this stuff in to objects, and thought I'd try (or at least get AKN help!) and get the formulas implemented. It's so cool! I've never had the opportunity or time to really investigate this stuff, so I'm enjoying the experience. Plus, I'm a bit in love with all the online support and expertise in the AKN. Such an awesome forum.

0 Likes
Message 7 of 12

ToanDN
Consultant
Consultant

Your safe bet is with @Ilic.Andrej.  He is the crowned king of formulas.

 

p/s:  I was messing with a similar approach yesterday.  Yes/No parameters for Portrait Landscape to simplify the complexity.  But I was rather slow at writing formulas, didn't finish, and gave up when I saw his post.

0 Likes
Message 8 of 12

Ilic.Andrej
Advisor
Advisor

Thanks @ToanDN 🙂 I just use this way of writing to make it faster. The programmers always write the code in hierarchy. So, in my opinion the best way to write long formulas is just like they do functions. This way, I don't get confused looking at a bunch of symbols or make mistakes. We can nest 10 code blocks and still keep track of all the parenthesis and commas 🙂

 



Andrej Ilić

phonetical: ændreɪ ilich
MSc Arch

Autodesk Expert Elite Alumni

0 Likes
Message 9 of 12

Anonymous
Not applicable

I haven't had the chance to test this yet, @Ilic.Andrej, but I am using it as inspiration for another signage family, where the manufactured size is larger than the frame (they have to add in between 2mm and 7mm to give a bit of tolerance depending on the size of the frame). So excited to practice parametric coding. Getting my nerd on! Haha.

0 Likes
Message 10 of 12

Anonymous
Not applicable

We're using:

if(W < 999 mm, W, if(W > 1000 mm, W + Tolerance, W))

 

But also tested:

if(W < 1000 mm, W, (if(and(W > 1001 mm, W < 2000 mm), W + 2 mm, W)))

 

🙂 

Message 11 of 12

Ilic.Andrej
Advisor
Advisor

@Anonymous wrote:

We're using:

if(W < 999 mm, W, if(W > 1000 mm, W + Tolerance, W))

 

But also tested:

if(W < 1000 mm, W, (if(and(W > 1001 mm, W < 2000 mm), W + 2 mm, W)))

 

🙂 


Yes, its ok but those sentences can be even shorter. This should give the same result:

if(W > 1000 mm, W + Tolerance, W)

if(and(W > 1001 mm, W < 2000 mm), W + 2 mm, W)



Andrej Ilić

phonetical: ændreɪ ilich
MSc Arch

Autodesk Expert Elite Alumni

Message 12 of 12

Anonymous
Not applicable

Love it, @Ilic.Andrej! It's like the cake from the French patisserie (delicious AND beautiful) versus the cake from the supermarket (delicious but kind of ugly). Haha.

0 Likes