Equation evaluation order
Equation evaluation order
(OP)
I am using several equations to drive the starting angles and lengths of a number of helices. I have about 6 equations that need to be evaluated in order, since the 6th uses a value generated in the 5th, and so forth.
Solidworks evaluates the equations in order, but does NOT rebuild the gemoetry after each equation (it waits until the end). This means that solidworks effectively evaluates all equations at the same time. The second equation can't reference parameters set in the first, because the parameters set in the first haven't been applied yet.
Example: If StartingAngle1 is at 90, and I apply the following equaionts:
1. StartingAngle1 = 0
2. StartingAngle2 = StartingAngle1+180
it evaluates to:
1. StaringAngle1 = 0
2. Starting Angle2 = 270 !!!! not 180
I have to rebuild again to correct StartingAngle2. help?
Solidworks evaluates the equations in order, but does NOT rebuild the gemoetry after each equation (it waits until the end). This means that solidworks effectively evaluates all equations at the same time. The second equation can't reference parameters set in the first, because the parameters set in the first haven't been applied yet.
Example: If StartingAngle1 is at 90, and I apply the following equaionts:
1. StartingAngle1 = 0
2. StartingAngle2 = StartingAngle1+180
it evaluates to:
1. StaringAngle1 = 0
2. Starting Angle2 = 270 !!!! not 180
I have to rebuild again to correct StartingAngle2. help?






RE: Equation evaluation order
I was - and he did. So at least I didn't get coal.....
OK, OK, It's a reference to my holiday sig. "Be naughty - Save Santa a trip..."
RE: Equation evaluation order
RE: Equation evaluation order
I was - and he did. So at least I didn't get coal.....
OK, OK, It's a reference to my holiday sig. "Be naughty - Save Santa a trip..."
RE: Equation evaluation order
We start with angle1 = 0, angle2 = 90, angle3 = 180
My equations:
1. Angle1 = 90 evaluates to 90 (desired)
2. Angle2 = Angle1 + 90 evaluates to 90 (undesired, i wanted 180)
3. Angle3 = Angle 1 evaluates to 0 (undesired, i wanted 90)
If i could use temp variables, I could write a system of equations like so:
1. X = 90 evaluates to 90
2. Y = X + 90 evaluates to 180
3. Z = X evaluates to 90
4. Angle1 = X evaluates to 90 (desired)
5. Angle2 = Y evaluates to 180 (desired)
6. Angle3 = Z evaluates to 90 (desired)
evaluation of the first three variables is not dependent on the model gemoetry. After I've done all the calculation, I can set every value absolutley, with no interdependency.
RE: Equation evaluation order
Regards,
Scott Baugh, CSWP

http://www.3dvisiontech.com
http://www.scottjbaugh.com
FAQ731-376
RE: Equation evaluation order
I have done a little investigation and I think I know where the problem lies, though I have not gone to the length of pinning it down in detail.
Your equations are using dimensions- in this case angular dims. When you have two lines and an angular dimension, there are a number of possibilities to how the dim is DISPLAYED. They depend on where the witness lines are placed. For example with 90, there are three quadrants that could have a 90 deg value in the dim TEXT and one that could have 270. However, mathmatically the smallest angle would be what the system would use for calculation ( since the ends are constrained by other things and there is no ambiguity. I suspect that the equation in your case is not necessarily using the actual value displayed in the TEXT of the dimension ENTITY on the sketch but the logical mathematical choice. So when you go, say, to 90+90, since the dim display (text location etc.)is already positioned, it reads 180, but infact the system says these lines are parallel so the math angle for calculation is 0.
I was - and he did. So at least I didn't get coal.....
OK, OK, It's a reference to my holiday sig. "Be naughty - Save Santa a trip..."