Skip to main content
1-Visitor
March 20, 2020
Question

Conditional Statements in a Curve by Equation w Cylindrical Coordinates

  • March 20, 2020
  • 2 replies
  • 3227 views

Ok this should be simple, problem I am working is way more complex...

 

I would like to use IF / conditional statements to revolve an equation driven curve that is utilizing a cylindrical coordinate system.  I CAN NOT get it to work.

 

Example:

Create a coordinate system to revolve around

Create a Datum / Curve / From Equation <dialog opens>

Change to Cylindrical / Pick the Reference Coordinate / Equation <now in a relation editor>

Eqns:

z=0

theta = 360*t

r=2*t

 

No problem, you get a linearly increase radius curve that starts at R=0 and grows to R=2 thru 360°

 

Now I would like to create a curve that starts at 0 goes to 180° increasing in radius from 0 to 1, then continue on at a constant radius of 1 from 180° to 360°.  I do believe the equation would be as simple as below, but, it does not work, just get a failed curve feature.

z=0
theta=360*t
IF theta<180
r=2*t
ELSE
r=1
ENDIF

 

Is this due to the sudden change in the curvature?. 

 

I can work around by making many curves each from their own start/finsh but, would rather just run it through one equation with multiple changes in the relationship of radius to the t value.

 

Thanks,

Erik

 

 

 

 

 

 

 

2 replies

tbraxton
22-Sapphire II
22-Sapphire II
March 21, 2020

I do not think this is a case of curve discontinuity. Conditional statements are not permitted in this context. This from the Creo  documentation.

You cannot use the following statements in an equation that defines a datum curve: abs, ceil, floor, else, extract, if, endif, itos, and search.

 

Assuming that the conditional statements are mathematically valid you should be able to in theory write relations for the parameters to drive two curve from equation features and apply the conditional tests to each curve. With your example I think you would have a discontinuity at the transition which you could resolve with a third curve.

 

If you were to clarify the design intent of what you need you may get some more ideas on how to handle it. Have you considered a helical sweep feature?

17-Peridot
March 22, 2020

Multiple features with a Pro/PROGRAM and a reference startpoint to chain them?

21-Topaz II
March 21, 2020

It is very much the fact that you cannot use conditional statements or any of the others given by tbraxton.

I've come across this problem myself in the past, with a similar needed curve. The trick in this case is to use the "min" function.

z=0
theta=360*t
r=MIN(2*t,1)

Regrettably, you will likely find, like I did, that there is a discontinuous "kink" in the curve at the transition point at t=0.5. Be sure to zoom in to the curve and see how it looks.

1-Visitor
March 22, 2020
Is there a limit to the number of min statements?

Actual problem is for a lobe of a cam profile I am working on that goes through a change in shape derived from higher order equations and had six or so changes in shape but always growing or reducing dependent on theta.
tbraxton
22-Sapphire II
22-Sapphire II
March 22, 2020

Regarding the cam profile, I gather from your statement that you have six changes in the defined curvature through a full 360 deg. If you plot these curves in cylindrical coordinates are there any discontinuities? Does the angular velocity in use require that acceleration and jerk are considered for performance? If so then you will need a higher order of continuity where the curves connect and that will complicate the problem as getting more than tangent continuity is likely going to drive you to splines.

 

If you can not define a single parametric planar curve and plot it such that it is continuous then I think you would have to break it down into piecewise continuous segments. Does the profile have a plane of symmetry? If so you may only need 3 curve segments.