Continue to Site

Welcome to MCAD Central

Join our MCAD Central community forums, the largest resource for MCAD (Mechanical Computer-Aided Design) professionals, including files, forums, jobs, articles, calendar, and more.

"Line too long" in relations

2ms1

New member
I have a line in my relations that represents a pretty large mathematical equation, but I was still surprised that ProE wouldn't accept it, giving me a "line too long" error when I hit the OK button after entering it in the relations window.


Here's the equation:


twistadjusty=(maxhpalmside/2)*(((((maxhpalmside*tan(twist)/2 )^2)-(maxhpalmside/2)^2)^(1/2))-maxhpalmside/2)/((maxhpalmsi de/2)+(((maxhpalmside*tan(twist)/2)^2-(maxhpalmside/2)^2)^(1 /2)-maxhpalmside/2))


Anyone else ever encountered this problem? Anyone know what the limit on line length is? Anyone have ideas on how toaddress the problem other than by creating a bunch of newvariableson different lines totake out portions of this line, instead subbing the the portionsinby variable names?


ps -- I see abobe that there is a newweird space stuck in the code. I assure you that that is something happening on the forum server side of thingsbecause it is not in the text I pasted in.
Edited by: 2ms1
 
Ahhh. Thanks. Do you by any chance know how long a line is allowed to be
before you have to split it?
 
Ok I know this isn't directly related to the original purpose of thread, but I have a new question now that I've learnedthe solution for the original problem.Canyou or any other relations experts looking at this thread help me with this new one?:


I get error "Invalid data type combination at right side of expression" with the following expression:


twistadjusty=(maxhpalmside/2)*((sqrt(((maxhpalmside*tan(twis t)/2)^2)-(maxhpalmside/2)^2))-maxhpalmside/2)/sqrt((maxhpalm side*tan(twist)/2)^2-(maxhpalmside/2)^2)



The only two variables I'm using are definitely of the correct data type...What's causing this?


thanks
 
Yeah it got a space there twice while coping and posting on this forum and I noticed it the first time but, have checked the code again and rewriting the word again making sure enter now space, it's still not working. Don't know why it showed that space it's weird, but the code doesn't have that space and it's still not working
smiley5.gif



here's what I'm using again:


twistadjusty=(maxhpalmside/2)*((sqrt(((maxhpalmside*tan(twis t)/2)^2)-(maxhpalmside/2)^2))-maxhpalmside/2)/sqrt((maxhpalm side*tan(twist)/2)^2-(maxhpalmside/2)^2)
 
you might try creating some additional parameters to break it up some like


maxp=(maxhpalmside/2) then use that inthe formula


twistadjusty=(maxp)*((sqrt(((maxhpalmside*tan(twis t)/2)^2)-(maxp)^2))-


so on and so forth... make it a bit shorter and easier to follow.. and you have that one 4 times... my guess it your brackets don't add up right or are in wrong seq.


but then I thought it was the space
smiley36.gif
 
Ok I tried using the following:


s=twist



halfmaxh=maxhpalmside/2



twistadjusty=halfmaxh*((sqrt(((maxhpalmside*tan(s)/2)^2)-hal fmaxh^2))-halfmaxh)/sqrt((maxhpalmside*tan(s)/2)^2-halfmaxh^ 2)


It still doesn't work with same error
smiley7.gif



I've gone through the parentheses and if there's anything amiss with them I can't find it and never will bc, according to my understanding of where you need to put parentheses, they are all correct. I suppose this understanding could be wrong, but someone would have to correct me in order for me to know. I feel like it can't be the parentheses and yet I can't find anything else wrong either.
Edited by: 2ms1
 
I would take it a step further then simplify it a little more


add the parameters to your model tree and cross check the values to see if they are even in the ball park..you will probably catch the error there easier than anywhere else


.it's looks way too busy to me, sorry best advice I can offer
 
I'm about to break my computer and walk away from engineering forever or something here...


If anyone has any ideas on why I'm getting the two messages shown below please pipe in because I'm getting to the point where I have no idea whatsoever else to try:


twist=19.32
maxhpalmside=52
q=twist
halfmaxh=maxhpalmside/2
sqrtterm=abs(sqrt(((halfmaxh*tan(q))^2))-halfmaxh^2)
warning: Probable error in function evaluation.
twistadjusty=halfmaxh*(sqrtterm-halfmaxh)/sqrtterm
error: Invalid data type combination at right side of expression

Edited by: 2ms1
 
try this


sqrtterm=abs(sqrt((halfmaxh * tan(q))^2) - (halfmaxh^2))
twistadjusty=halfmaxh*(sqrtterm-halfmaxh)/sqrtterm

just re-wrote it.

bad brackets is all.

hope i preserved the maths tho.
 
2ms1, have you tried to solve this equation ?


I tried to simplify it as much as possible to see what's going on.


View attachment 4036


this is only the first part from your relation, next these values will be used with a sqrt function.


and it will be something like:


twistadjusty=(b*sqrt(c-b))/(sqrt(c))


so it will be sqrt(-597) and I don't think pro-e can handle such relation.


Now it could be my mistake, it's morning here and I'm trying to wake up.


Have a look at your relation ad try to solve it and see what values you get.
 
Vlad, I didn't even know it was possible to lookup the values of the parameters that way, as obvious as it may seem to others, I never knew you could click on "Local Parameters" to view everything. I'vehaven'thad the problem of taking sqrt of a negative number though.


However, by jove it works now after removing a pair of parentheses as puppet did!!


If I'm not missing something, the only reason it choked on what I initially had was an extra pair of parentheses that are merely unnecessary by conventional standards and the laws of arithmetic -- the extra parentheses were not wrong by standard conventions of math and computation in general, they were just extra/redundant!


I would have never found out that that was the problem other than by random chance because my notion, as is valid with everything else Ive used such as calculators, matlab, methematica, etc, is that extra parentheses are just fine and even useful just to be safe when you are trying to route out bugs -- they're never wrong!


Anyway, so it works now. Unless I'm missing something, which I don't think I am, the lesson is: Do not use any more parentheses than is absolutely necessary in Pro/E relations
smiley4.gif

Edited by: 2ms1
 
2ms1,
i am often writing out equations to preserve design intent, the best rule of thumb would be to go "verifying" as to go entering the equations. Even if these incomplete equations will give you unusable values at least you know its compile once you have finished.

Saves going back after writing pages of equations.
 
What do you mean by verify exactly? I need to get good at this. I'm using relations for basically everything in this project
 
in ur relations editor.

there is a icon. which looks like a sheet of A4 paper with a green tick on it.
AkA Verify/Exectute.


Last one on the right.
 
The line can be maximum 80 characters, and as posted above a slash makes the equation or whatever continue on the next line. Just like linsey lohan :)
 

Sponsor

Articles From 3DCAD World

Back
Top