Revit Architecture Forum
Welcome to Autodesk’s Revit Architecture Forums. Share your knowledge, ask questions, and explore popular Revit Architecture topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Integers - maximum and minimum

2 REPLIES 2
Reply
Message 1 of 3
phillipesfy_
188 Views, 2 Replies

Integers - maximum and minimum

phillipesfy_
Contributor
Contributor

Hi all,

 

Just wondering if it's possible to add a maximum and minimum to an integer. I am currently using numbers 1-3 for visibility parameters, and would like to cap it to those numbers.

 

Thanks

0 Likes

Integers - maximum and minimum

Hi all,

 

Just wondering if it's possible to add a maximum and minimum to an integer. I am currently using numbers 1-3 for visibility parameters, and would like to cap it to those numbers.

 

Thanks

2 REPLIES 2
Message 2 of 3
MetalFingerz
in reply to: phillipesfy_

MetalFingerz
Advocate
Advocate

Hello @phillipesfy_ ,

 

You need to use a second parameter that will constrain the values of the first one. That second parameter is the one that you will use for your object while keeping the first one as a input.

 

So, let's say your input parameter is named VisibilityInput, then you would need another one that you could call VisibilityInputConstraint. Then VisibilityInputConstraint will be have a formula that would look like this :

if(VisibilityInput < 1, 1, if(VisibilityInput > 3, 3, VisibilityInput))

And like that, VisilibtyInputConstraint will always be between 1 and 3 and you will be able to use it to have values that are constrained between the minimum and maximum you want.

 

I would advise to have your minimum and maximum values as parameters as well so you do not have to hardcode them into the formula above.

if(VisibilityInput < VISIBILITY_MINIMUM, VISIBILITY_MINIMUM, if(VisibilityInput > VISIBILITY_MAXIMUM, VISIBILITY_MAXIMUM, VisibilityInput))

But that would also require you to have two additional parameters in your list so it's up to you and how many more parameters you're fine with.

0 Likes

Hello @phillipesfy_ ,

 

You need to use a second parameter that will constrain the values of the first one. That second parameter is the one that you will use for your object while keeping the first one as a input.

 

So, let's say your input parameter is named VisibilityInput, then you would need another one that you could call VisibilityInputConstraint. Then VisibilityInputConstraint will be have a formula that would look like this :

if(VisibilityInput < 1, 1, if(VisibilityInput > 3, 3, VisibilityInput))

And like that, VisilibtyInputConstraint will always be between 1 and 3 and you will be able to use it to have values that are constrained between the minimum and maximum you want.

 

I would advise to have your minimum and maximum values as parameters as well so you do not have to hardcode them into the formula above.

if(VisibilityInput < VISIBILITY_MINIMUM, VISIBILITY_MINIMUM, if(VisibilityInput > VISIBILITY_MAXIMUM, VISIBILITY_MAXIMUM, VisibilityInput))

But that would also require you to have two additional parameters in your list so it's up to you and how many more parameters you're fine with.

Message 3 of 3
syman2000
in reply to: phillipesfy_

syman2000
Mentor
Mentor

I had similar formula that works with lengths but it should work integers as well. Check the screenshot

 

syman2000_0-1695914746891.png

 

Check out my Revit youtube channel - https://www.youtube.com/user/scourdx
0 Likes

I had similar formula that works with lengths but it should work integers as well. Check the screenshot

 

syman2000_0-1695914746891.png

 

Check out my Revit youtube channel - https://www.youtube.com/user/scourdx

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report