PDA

View Full Version : Conditional statements in fields in attributes in dynamic blocks



70melbatoast
2008-10-09, 03:14 PM
Boy that was a long, buried title. I hope I can get some direction here. From all that I've read, it seems that I will be unable to do what I need to, but I'd thought I'd try anyway.

I have a dynamic block of a pier. Said pier has 2 linear parameters, one in the X direction and one in the Y direction. With appropriate stretch actions associated with them that are set at a defined list of sizes. There are fields in an attribute attached to the block that will read the x and y dimensions and produce a result: 30"x30" CONC. PIER FOOTING. The size updates as the block is stretched. No problem, works great.

What I want to do is add the third dimension: 30"x30"x15" CONC. PIER FOOTING. I want the third dimension to equal half of the smallest side of the pier. So, the condition would look like this (I'll use X and Y to denote each side): IF(X<Y, X/2, Y/2)
Right?
Here's my syntax in the formula editor: IF ((UpdatedDistance<UpdatedDistance), (UpdatedDistance/2), (UpdatedDistance/2)) Where UpdatedDistance is an inserted BlockPlaceHolder field assigned to either the x or y parameter.Why it says UpdatedDistance and not the names of the parameter is beyond me (X Distance and Y Distance). However, when each UpdatedDistance field is selected and edited in the formula it does point to the correct parameter.

After wasting nearly a day, I can't get it to work. It returns the ### every time. Is it simple syntax or am I missing something greater? Any help is welcomed and is greatly appreciated!
Thanks,

Chad

RobertB
2008-10-09, 10:38 PM
What if you simply divide the mininum of the two values by 2?

70melbatoast
2008-10-09, 11:31 PM
That is what I'm trying to do, but I want the software to do it. I want the user to be able to stretch the pier to size and have the formula calculate the depth automatically. That is why I believe I need an IF statement to determine the smaller of the two sizes (they're not always the same). The x direction could be 48" while the y could be 24". Maybe I am over thinking this?

Thanks.

RobertB
2008-10-13, 10:10 PM
Maybe I am over thinking this?I may be mistaken, but isn't there a MIN operator available in formulas?

MIN(x,y)/2

70melbatoast
2008-10-14, 05:24 PM
Thanks for the reply Robert. I did not know that expression existed. Formulas are a bit new to me and I'm learning at a snails pace. As an example, I've tried a simple expression (MIN(10,6)/2) and the more complex (MIN(UPDATEDDISTANCE,UPDATEDDISTANCE)/2) and I still get the ###. Whether I created the formula in simple mtext or as an attribute in my dynamic block makes no difference. Hmmm...:???:

RobertB
2008-10-14, 07:03 PM
Thanks for the reply Robert. I did not know that expression existed. Formulas are a bit new to me and I'm learning at a snails pace. As an example, I've tried a simple expression (MIN(10,6)/2) and the more complex (MIN(UPDATEDDISTANCE,UPDATEDDISTANCE)/2) and I still get the ###. Whether I created the formula in simple mtext or as an attribute in my dynamic block makes no difference. Hmmm...:???:Are you copying and pasting the field expressions for the two values in question into the formula, or simply trying to type the name of the dynamic property? I think you should copy the field expressions.

70melbatoast
2008-10-16, 07:50 PM
I have been copying the expressions or I will I use right-click insert or edit field.

randyspear
2009-09-04, 10:25 AM
you could just add another line that is half the distance and call it up with the field. Then add a visibility paramater and turn the display of the line off. Also, turn the visibility grip off. oh, and you'll also need to include the new line with the stretch parameters you are using.