Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations KootK on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

IF statement with and

Status
Not open for further replies.

vinerunner

Aerospace
Sep 4, 2013
11
Hello!

I would like to combine several curves in one curve in proe.

My idea was the following:

ang=t*360

x=t
z=0

IF ang>0 AND ang=<120
y=cos(ang)
ENDIF

IF ang>120 AND ang=<200
y=sin(ang)
ENDIF


etc.

but it doesn't work bcause of the "AND"

I hope you understand the problem.

Can you help me how can I solve this?

Thanks!
 
Replies continue below

Recommended for you

Just to understand my aims:

I would like to use the curve later as control function of a part in creo mechanism.
So I would like to control the motion of a part with this function which is a sum of several curves.
 
I believe the syntax for logical AND is && but I am also pretty sure you cannot use if statements in curve equations.

Hope that helps and good luck,
 
I think it is a single '&' for comparisons. I'm pretty sure it's correct that IF/ENDIF are not allowed in sketches, but am looking for support.

From a reference: (| = or, & = and, ! = not, ~ = not)
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

***
One can create a graph that covers the domain (0-200) and use evalgraph() to return a value. The graph can have sharp corners, but needs to be continuous and have unique Y values for each X value.
 
Thanks guys for the fast answers!

Since then I moved one step forward. Now I've started to solve my problem from the other and so I started to set up a serv motor in mechanism. I can see that it is possible to define the position by several curves using an expression an a time domain however I'm really getting pissed of because of the following:

the equatation for the curve is the following:

20/pi*((3*t*360)-sin(3*t*360))

I would like to use this between zero and 120°

I made it in excel, it is a nice NON LINEAR, growing curve.
But if I write this equatation to creo with 0 < t < 1
I get a linear curve which is non sense.

I'm simply not able to understand the problem (maybe I'm too tired...).

I've already started to make the curve in excel and import the points in a tab file, which seems to work, but I'm very anxious about why is that expression a linear curve in proe.

Any ideas?

Thanks!
 
Can you use a graph feature instead?

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

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.
 
It's not an equation until there's an equals sign. What Coordinate system type is being used and what are the entire set of equations? If the curve is a straight line, there's is something wrong.

As to the range: if you want 0 < t < 1 to map to 0 < theta <120 then use theta = 120*t
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor