Difference between revisions of "Bend Reduction Editor"
(→The Function's Result) |
(→Begin and End) |
||
Line 88: | Line 88: | ||
end;</pre> | end;</pre> | ||
+ | <br> | ||
+ | <br> | ||
+ | |||
+ | |||
+ | === Notes In Code === | ||
+ | |||
+ | Pascal allows for a few methods for putting note lines into code: | ||
+ | |||
+ | Using two forward slashes makes a line into a note line: | ||
+ | <pre> | ||
+ | // This is a note line | ||
+ | </pre> | ||
<br> | <br> | ||
<br> | <br> |
Revision as of 12:42, 7 March 2008
Contents |
Bend Reduction Editor Screen
Predicting elongation in a tube shape requires complex mathematics that changes per customer application. Benderlink for SolidWorks now allows operators to program their Bend Reduction formula into the program. This is the Bend Reduction Function editor:
The editor is very powerful because it allows you to enter action Pascal code to define the function that returns the adjusted arc lengths. This is an example bend reduction program included with Benderlink:
Sample Program
var BendAllowance: real; NewArc: real; begin BendAllowance := 0.64; NewArc := ((BendAllowance * blinksw(OD) + (PI/2 * (blinksw(CLR)-0.5 * blinksw(OD) ))) / 90) * blinksw(BENDANGLE); //MessageDlg('New Arc Length: ' + floattostr(NewArc), mtInformation, [mbOK], 0); result := NewArc; end;
The Function's Result
The value returned is called the "result". At the bottom of the code (just before the "end;" line), the...
result := NewArc;...line of code assigns the value in the NewArc variable to each arc length in Benderlink during conversion.
The function result type should be either "real", "double", or "extended" - which are all floating point types.
Accessing Benderlink's Values
There are three special functions that insert values from the bend data during conversion:
Insert the Outer Diameter
blinksw(OD)
Insert the Centerline Radius
blinksw(CLR)
Insert the Bend Angle
blinksw(BENDANGLE)
Each of these are should be formed as a complete word with no spaces between any of the characters.
Creating New Variables
Pascal is a strongly typed language that requires variables to be predefined in the "var" section like this:
var BendAllowance: real; NewArc: real;
Each variable is given a name like "BendAllowance" then its type is defined with a colon and the type. A few simple examples are:
var iValue: integer; bValue: boolean; rValue: real; szVal: string
All of this is placed before the "begin" statement.
Begin and End
Pascal starts and ends the actual formula section with the "begin" and "end" statements. They are required. Note that the "end;" statement has a semi-colon following.
begin end;
Notes In Code
Pascal allows for a few methods for putting note lines into code:
Using two forward slashes makes a line into a note line:
// This is a note line
Mathematical Function List
These are the available math functions:
blinksw(OD) blinksw(CLR) blinksw(BENDANGLE) sqr() sqrt() arctan() cos() sin() tan() abs() exp() ln() log() int() frac() trunc() round() arcsin() arccos() sign() not() PI ArcCos() ArcCosh() ArcCot() ArcCotH() ArcCsc() ArcCscH() ArcSec() ArcSecH() ArcSin() ArcSinh() ArcTan2() ArcTanh() Cosecant() Cosh() Cot() Cotan() CotH() Csc() CscH() CycleToDeg() CycleToGrad() CycleToRad() DegToCycle() DegToGrad() DegToRad() GradToCycle() GradToDeg() GradToRad() Hypot() IntPower() IsInfinite() IsNan() Ldexp() LnXP1() Log10() Log2() LogN() Max( Min() Power() RadToCycle() RadToDeg() RadToGrad() RandG() RandomRange() Sec() Secant() SecH() Sinh() Tan() Tanh()