PDA

View Full Version : length limiting IF statement



t1.shep
2009-02-25, 12:11 AM
I'm trying to make a component with a parameter that limits the maximum length a component can be...

Here is what I want: LENTH= IF(LENGTH < 6', LENGTH,0)
I want to define what the length is, but if I enter a value greater than 6' want it to fail or give me some error that won't allow the length to be greater than 6'. Since the geometery is tied to the LENGTH parameter that is the one I want to control. However, with this IF statement it gives me a circular reference error and won't let me do it.
Here's what I have...
A component with geometry locked to LENGTH
I created a MAX LENGTH parameter = 6
Also created LENGTH USER VALUE
Then another parameter LENGTH LIMIT = IF(LENGTH USER VALUE < MAX LENGTH, LENGTH, 0)
This will give me the correct value in the LENGTH USER VALUE, but that isn't tied to any geometery. I can make LENGTH = LENGTH USER VALUE, but it doesn't really do anything. If I try to do something like LENGTH USER VALUE = LENGTH, I get a circular reference error.
How do I do this?

bwbarch
2009-02-25, 12:52 AM
I think the simple way to do this is to manipulate your geometry by an override parameter, rather than with LENGTH. You could still keep LENGTH in your list of parameters, but use an override parameter to actually changes the geometry. That way, the user would set the value of LENGTH to whatever, and the override parameter would test its value and change the geometry (or not) accordingly.

See if this works for you:

1. Use LENGTH as the parameter the user interacts with in your list of parameters, but is not actually tied to your geometry. It is just a place for the user to enter their desired value.
2. Setup an override parameter CalcLENGTH as the actual parameter controlling your geometry that the user won't be able to change. I usually put these override parameters in the "Other" section to keep them out of the way visually.
3. Setup LENGTH LIMIT, also in the "Other" section, and give it your desired value.
4. Then set CalcLENGTH to equal: IF(LENGTH < LENGTH LIMIT, LENGTH, 0)

clog boy
2009-02-25, 12:31 PM
This is much easier if you work in a country that hasn't English as native language. 'Length' overhere is 'Lengte', nearly the same.

I would use Lengte as input, and Length as actual controled dimension. For Length I would use the formula
IF (lengte < 6', 0, lengte)

Beware though! If you set a parameter to 0 and want to change it's value then chances are it will always give an error.

greg.mcdowell
2009-02-25, 04:31 PM
Instead of setting Length (or whatever) to zero which will break the family as clog boy said, I would suggest setting the Length to, in your case, 6'-0". I do this frequently and think it works well. Seems to make more sense for us to have the family stop at a given size rather than completely error out and not understand why (from the user's point of view).

t1.shep
2009-02-25, 04:44 PM
Thanks everyone for your replies. I was able to get my family to work the way I want.
I like that the family will error, rather than set the max value automatically if a user enters a value greater than the max. I feel that, in my case, this will be better so that they won't input something and think that they have the right length, only to find as things progress that they're really using a max value that they may not have realized was set for them.
Ideally there would be a warning that tells the user that they've maxed out the parameter, rather than the sometimes vague "constraints not met" warning. Obviously you can enter the info into a note parameter, but that doesn't mean they'll see it.

twiceroadsfool
2009-02-25, 07:16 PM
If you really want to go wild over-idiot-proofing it:

Consider the following, for the flexible element "Object"-

Length Input (length, instance)= User input
Object Visible (Yes/No, instance) = Length Input < 6'-0"

Plus Model Text saying "Bad value dummy"
Object Invisible (Yes/No, instance) = not (Object Visibile)


Much more satisfying than a constraints error. :)