Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

ProE if function inquiry

Status
Not open for further replies.

GrayIntel

Mechanical
Feb 9, 2012
11
0
0
US
Since ProE's help files are so da.n hard to navigate, I'm having to ask users here the exact format/syntax of the if function within the relations dialog. I know the logic & how it works in Excel and Solidworks, HP because provided examples are easy to follow along with nice literature. So please show me the ProE if function at work with proper syntax if you would be so kind, before I disown WF4 for life.
 
Replies continue below

Recommended for you

This is a simple relation that opens and closes a door assembly:
/*firebox door
if firebox_door=="fbdc"
d0:17=0
else
if firebox_door=="fbdo"
d0:17=180
endif
endif
 
This is the IF statement I'm getting errors on with spacing just as shown: IF L_LENGTH > 2 THD_LENGTH = 1.75 ELSE THD_LENGTH=L_LENGTH-1/THREAD_PITCH*2 ENDIF. What am I doing wrong?
 
The proper syntax is what I'm looking for: spaces, parenthesis & other delimeters for the IF since I'm simply doing a number comparison involving a nested equation. Why is Pro E so dang hard to accomplish mundane task? Excell is very explicit with such Boolean logical functions & SolidWorks walks all over ProE in this regard & many other aspects. So what is the exact syntax using the IF function in relations when I compare 2 defined variables(numerical) & then declare an equation to be evaluated. Sorry for the confusion & I've used ProE WF4 for 3 hair raising years.
 
You've got working examples posted. It's pretty dang simple.
You've used the software for 3 years haven't figured out the help system?

In 30 seconds I've found this (which may not upload properly is this site)

About Operators Used in Relations
The following operators can be used in relations, both in equations and in conditional statements.

Arithmetic Operators
+
Addition


Subtraction

/
Division

*
Multiplication

^
Exponentiation

()
Parentheses for grouping
for example, d0 = (d1–d2)*d3


Assignment Operator
=
Equal to


The equal (=) sign is an assignment operator that equates the two sides of an equation or relation. When the equal sign is used, the equation can have only a single parameter on the left side.

Comparison Operators
Comparison operators are used when a TRUE/FALSE value can be returned. For example, the following relation returns TRUE whenever d1 is greater than or equal to 3.5. It returns FALSE whenever d1 is less than 3.5:

d1 >= 3.5

The following comparison operators are supported:

==
Equal to

>
Greater than

>=
Greater than or equal to

!=, <>,~=
Not equal to

<
Less than

<=
Less than or equal to

|
Or

&
And

~, !
Not


Note: The "equal to" assignment operator is different from the "equal to" comparison operator.

The operators |, &, !, and ~ extend the use of comparison relations by enabling several conditions to be set in a single statement. For example, the following relation returns TRUE whenever d1 is between 2 and 3, but not equal to 2.5:

d1 > 2 & d1 < 3 & d1 ~= 2.5

Conditional Statements in Relations
Note: Relations containing conditional statements are not sorted. A condition is an expression that is either TRUE (or YES) or FALSE (or NO). These values can be used interchangeably in the conditional statement. For example, the following statements can all be evaluated the same way:

IF ANSWER == YES
IF ANSWER == TRUE
IF ANSWER

IF Statement
You can add IF statements to relations to create conditional statements. For example,

IF d1 > d2
length = 14.5
ENDIF
IF d1 <= d2
length = 7.0
ENDIF

ELSE Statement
By adding the ELSE statements in the branches, you can create more complex conditional constructions. With these statements, the previous relation may be modified as follows:

IF d1 > d2
length = 14.5
ELSE
length = 7.0
ENDIF

There can be several features listed between the IF, ELSE, and the ENDIF statements. In addition, the IF|ELSE|ENDIF constructions can also be nested within feature sequences.

The syntax of the IF clause is as follows:

IF <condition>
Sequence of 0 or more relations or IF clauses
ELSE <optional>
Sequence of 0 or more relations or IF clauses <optional>
ENDIF

Consider the following rules:

ENDIF is spelled as one word.

ELSE is added on a separate line.

Equal in conditional statements is entered as two equal signs (==). Assignment is entered as a single equal sign (=).


Was that so HARD??????????

----------------------------------------

The Help for this program was created in Windows Help format, which depends on a feature that isn't included in this version of Windows.
 
Thanks btw for these tips, but the dang help files in WF4 are nothing short of a pain. I'm an engineer & have been designing/modeling since the early 90's, but I've never encountered a program so difficult & non intuitive to use in all my career such as ProE & I'm certainly not the only one in this regard. Thx for your help ntl.

Mark
 
I have found more information on the knowledge base at ptc.com than the help system but the information is definitely out there. As far as what your doing wrong I would start by giving a little more detail as to what the error is that is reported by ProE. Also the first two examples were in correct syntax line by line whereas yours was a single line. I'm not sure why you would put your if statement on one line after two examples suggested otherwise.

Here is some help with relations but you must have access to the knowledge-base.

 
Here is my not so hard example if statement

if holeloc1=8
errorLogical expression expected.
hole_dia=3
endif

All variables are predefined in my simple model. The function button in the relations interface fx list the syntax as if(). And as usual I'm getting the very explanatory error msg called ...Relations have errors
 
Thanks guys, I got it to work by splitting the continuos line into multiple lines & further understanding of the if statement.


Mark-bonehead
 
Status
Not open for further replies.
Back
Top