# Thread: Dynamic Blocks and Calculations

1. ## Dynamic Blocks and Calculations

I am trying to have a line drawn at a length that is to be calculated from other components of the dynamic block.

That is, the length of Line A = (Value of Action Parameter B)^2*(Attribute A - Attribute B)/(Value of Action Parameter B/.

From what I could find, I should be able to go into Parameters Manager and type into the Expressions column the formula. However, I cannot get C3D to recognize the Action Parameters or Attribute as valid variables in an expression. I can add User Parameters and reference those, but not those I need. I get an error "A dependent expression cannot be evaluated. The syntax is incorrect or a variable is not defined."

See the image. Any help?
Dynamic Block.JPG

2. ## Re: Dynamic Blocks and Calculations

I realize this is a simpleton response but could it be that the Slopeout (and In) needs to be capitalized like it is in the Attrib list?

3. ## Re: Dynamic Blocks and Calculations

Nope, Charles.

That doesn't make a difference. What the Help says is to select the attribute and actually copy it and paste it into the expression. Doesn't matter. It still doesn't work.

Thanks anyway. Anyone else have a thought?

4. ## Re: Dynamic Blocks and Calculations

My guesses.... Take this with a grain of salt as it has been a while since I used formulas in AutoCAD.

That your taking a number and trying to multiply a percent?

You have a space or something in a parameter somewhere that your not seeing?

You need a few more (). Like((xdistance1)^2)*((...

Do you need an = sign at the front?

Did you pick the parameters or did you have to type them in? I believe you have to pick them in AutoCAD...

5. ## Re: Dynamic Blocks and Calculations

Have you tried breaking the formula down into smaller, user parameters, and substituting those into this formula? It doesn't seem like it would be necessary but it might help you isolate which part is triggering the Parameter Error msg.

Dave.

6. ## Re: Dynamic Blocks and Calculations

I think I may finally have an answer for this. Double click that Expression. Then right-click it and open the Expressions window. What you'll see is a listing of expressions AutoCAD will accept. Raising a number to a power using the carat (4^2) isn't supported. You need to use something like this: pow(Expr1;Expr2).

This may get you rid of the Parameter Error dialog.

Good luck!
Dave.

expressions.png

7. ## Re: Dynamic Blocks and Calculations

Dave,

For a second, I thought you had something. But, then I realized that I had tried to break down the expression to debug it when I started, and it won't even let me do a single parameter reference. In addition, the caret does seem to work (at least for squared) because I use it in expressions within this very block as a work around. See attached.

Just out of curiosity, is this a problem that you have been able to duplicate? That is, if you have an action parameter, can you create a dimensional constraint parameter that includes the action parameter as a variable? Or does it choke for you too?

Thanks
Scott

DependentExp.JPG

8. ## Re: Dynamic Blocks and Calculations

Scott,

First, I confirmed for myself that an expression like Dist2=Dist1^5 will work in a Dimensional constraint. So that's not the issue. But I cannot make an Action parameter work with a Dimensional constraint either. AutoCAD doesn't seem to be able to pass that information to the constraint expression. You may have to create a User expression for that information. I was able to reproduce what you saw, and it's tricky getting out of that error dialog once you create that kind of a mess!

Sorry I can't help much more than this.
Dave.

9. ## Re: Dynamic Blocks and Calculations

My theory is that AutoCAD needs the values of the expression before they can be evaluated, meaning, the way you are trying to do it now, everything needs to happen simultaneously. The error seems to say that the variable in the expression you are trying to create do not exist yet, because they are both tied to one another, i.e. you cannot create a chicken and an egg at the same time.

-I could be totally wrong, but that's my \$0.02.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•