...
A simple example of a parametric part is a rectangle where the width, height and rotation angle are defined though parameters. The script of such part might look as follows:
Code Block |
---|
// Here is a description of simple rectangle. |
...
H = Parameter("Height", |
...
5, LINEAR, Interval(0, |
...
100)); |
...
L = Parameter("Length", |
...
10, LINEAR, Interval(0, |
...
200)); |
...
Angle = Parameter("Angle", |
...
0, ANGULAR, Interval(0, |
...
360)); |
...
Rect1 = Rectangle(H, L); |
...
Rect = RotateZ(Rect1, Angle); |
...
Output(Rect); |
Let's examine each line of this example:
LINE 1
Code Block |
---|
// Here is a description of simple rectangle. |
The '//' indicates a comment. Comments do not affect the behavior of a part. All text following '//' to the end of the line are contained by the comment.
LINE 2
Code Block |
---|
H = Parameter("Height", |
...
5, LINEAR, Interval(0, |
...
100)); |
The second line specifies the definition of the 'H' parameter. Let's break out each element of the line to define its function:
H This is the identifier (name) of the parameter in the part description
= The equals sign associates the identifier with its definition
Parameter This is a function. 'Parameter' defines that H is a Parameter
( Specifies the start of the Parameter function's properties
"Height" The name of the parameter that will appear in the Properties dialog
, Indicates the end of one property and the beginning of the next
5 Assigns the default value for H
, Separates properties
LINEAR Specifies that H is a linear value
, Separates properties
Interval(0, 100) Specifies the allowable values for H as an interval from 0 to 100
) Specifies the end of the Parameter function's properties
; End of definition for H
LINES 3 – 4
Code Block |
---|
L = Parameter("Length", |
...
10, LINEAR, Interval(0, |
...
200)); |
...
Angle = Parameter("Angle", |
...
0, ANGULAR, Interval(0, |
...
360)); |
The next two lines in the example are similar to the previous one. They define the characteristics of L and Angle parameters in a similar layout. Note that the 'Angle' parameter uses an ANGULAR interval rather than LINEAR.
LINE 5
Code Block |
---|
Rect1 = Rectangle(H, L); |
This line uses the Rectangle function to define a rectangle called 'Rect1'. It uses the previously defined H and L parameters to specify its properties, height and length. The center of this rectangle will be at the world origin (x=0,y=0,z=0) in the drawing. More on the rectangle tool will be covered later.
LINE 6
Code Block |
---|
Rect = RotateZ(Rect1, Angle); |
This line defines a new rectangle called 'Rect' which is a rotated version of 'Rect1', using the Angle parameter to define the rotation.
LINE 7
Code Block |
---|
Output(Rect); |
The last line specifies that the output of the script will be the rotated rectangle called 'Rect'. This is what the be drawn as the part.
...
Examples of correct expression syntax:
Code Block |
---|
(D \--1/4) * k; |
...
Polyline(Point(0, |
...
0.25 |
...
- |
...
1/8), Point(0, D), Arc1(L-C, - m, m), Point(0,0)); |
...
A = B + |
...
0.5; |
...
B = |
...
7; |
Arithmetic Operations
Arithmetic operations may use the standard arithmetical operators '+' (addition), '--'(subtraction), '*' (multiplication), '/' (Division) and parenthesis '('and ')', to determine the sequence of performing arithmetic operations. Object identifiers and numbers serve as operands.
...
are not allowed. The first case A and B define each other directly. In the second case A is defined by B through C, and B is defined by A through D. This also means that an identifier is not allowed to depend on itself. For example, you cannot use an operator of this form:
H = H*1.05;
Panel |
---|
NOTE: |
...
The sequence of script operators is not important (except certain special cases that will be described later); because operators are sorted before the script is run. |
...
Basic Functions
Probably the most significant advantage of this method of creating parametric parts is the compact size and clarity of the text description of parametric parts in script form. The set of basic functions used in such a description, determines the level of clarity and simplicity of scripts for a particular class of parametric parts.
Note: It is intended that the set of basic functions will expand from version to version.
...
Format:
<id> = Parameter(<name>, <default value>, <type>[, <condition1>][, <condition2>]..);
Panel |
---|
NOTE: |
...
The '<>' markers are used to designate elements in the expression, and the '[ ]' markers are used to indicate elements which are optional. |
<name> | The name displayed in the user interface; |
<default value> | The default value of the parameter; |
<type> | Defines the parameter type. The following example values are possible: |
<condition> | These are optional. They define possible restrictions imposed on parameters. Restrictions can be listed in arbitrary order and may take on the following forms: |
...
<profile> | This defines the profile using a 2D polyline |
<path> | This defines the path, along which the profile is "dragged"; the path is defined by a 2D polyline polyline |
<rotation angle> | This optional argument, defines the rotation angle of the profile relative the Z axis; by default, the argument is equal to zero |
...
<Object> | Defines the 3D object whose edges are to be rounded |
<Edges> | Defines the edge or multiple edges, which are to be filleted. Each edge is defined by Point(xc,yc,zc) or Array of Points. |
<Radiuses> | Defines the Fillet radiuses. Fillet radiuses are set by Array function. For a single edge the Array contains pair of values, for multiple edges - multiple pairs of values. |
...
<Object> | Defines the 3D object whose edges are to be chamfered |
<Edges> | Defines the edge or multiple edges, which are to be filleted. Each edge is defined by Point(xc,yc,zc) or Array of Points. |
<Radiuses> | Defines the Chamfer distances. These are set by Array function. For a single edge the Array contains a pair of distance values, for multiple edges - multiple pairs of distance values. |
...
<Object> | Defines the 3D object which is to be bent |
<Line> | Defines a line about which the solid object will be bent. It is defined by 2 Points: |
<Angle> | Defines the bending angle. The angle is measured from the plane of the bent face. |
<Radius> | Defines the bending radius |
<Depth> | Defines the Neutral Depth to set the distance into the depth of material along which there will be no tension or compression |
...
<list of characteristics> | Defines the text characteristics separated with commas. |
Example:
Tstyle = TextStyle(LEFT, TOP, UNDERLINE);
...
x0 = PointX(P0); // x0=1 for P0 = ParameterPoint(0, l, -l, 0);
y1 = PointY(P1); //y1=0 for P1 = ParameterPoint(1, 0, 0, 0);
z1 = PointZ(P1); //z1=0 for P1 = ParameterPoint(1, 0, 0);
Anchor | ||||
---|---|---|---|---|
|
Anchor | ||||
---|---|---|---|---|
|
Anchor | ||||
---|---|---|---|---|
|
IF
The IF function allows various actions to be performed depending upon whether the specified condition is fulfilled or not fulfilled. It plays the role of a conditional operator, and can be used to create branches in the logic of building a parametric part.
...
<Condition> | Defines the condition under test using the following comparison operations: |
<ExprOnTRUE> | Defines the value of the IF function when the value of <Condition> is TRUE; |
<ExprOnFALSE> | Defines the value of the IF function when the value of <Condition> is FALSE; |
...
<list of objects> | list of numerical values or geometric objects objects |
...
PI | LINEAR | TEXT | |
ANGULAR | MATERIAL | FONT | |
COLOR | CHECKBOX | ITALIC | |
BOLD | UNDERLINE | BOX | |
ALLCAPS | STRICKETHROUGH | TOP | |
MIDDLE | BOTTOM | BASELINE | |
LEFT | CENTER | RIGHT | |
Call | Array | + | |
- | * | Div | |
Mod | / | - | |
sin | cos | tan | |
atan | min | max | |
** | = | == | |
!= | < | > | |
<= | >= | & | |
Solid | Extrude | ||
UNIQUE | GraphicId | VertexId | |
Vertex | Face | ||
Edge | Source | Bound | |
Intersect | OperationList | BlendArg | |
BlendParam | BlendType | BlendRadiusMode | |
BlendSetback | BlendRadiusBlendSmooth | BlendRadiusParam | |
BlendOffsetParam | BlendFaceEntity | BlendFaceEdge | |
BlendFaceVertex | BlendEdgeEdge | BlendEdgeVertex | |
BlendEdgeVertexMain | BlendEdgeVertexAux | ShellArg | |
ShellThickness | ShellFace | ShellEdge | |
FaceEditArg | Transform | ScaleX | |
ScaleY | ScaleZ | ShearXY | |
ShearXZ | ShearYZ | RotateX | |
RotateY | RotateZ | TranslateX | |
TranslateY | TranslateZ | Path | |
Profile | LateralFace | LateralEdge | |
CapFace | CapEdge | JointEdge | |
Profiles | HighLight | FaceMaterialArg | |
FaceMaterial | FaceOffsetArg | FaceHoleArg | |
FaceHole | BendId | BendRadius | |
BendAngle | BendNeutral | BendFlag | |
BendPosition | BendFlangeHeight | BendAxialDistance | |
BendAzimuthAngle | BendEdgeStartPosition | BendEdgeEndPosition | |
Face2FaceLoftArg | Face2FaceLoft |
| |
AssemblyAxis | Input | Output | |
Include | Units | StaticSymbol | |
FolderList | Macro | Parameters | |
Parameter | ParameterPoint | PointX | |
PointY | PointZ | Set | |
Interval | LessThan | GreaterThan | |
LessOrEquail | GreaterOrEqual | Circle | |
Rectangle | Polyline | Point | |
Arc0 | Arc1 | Fillet | |
IF | Move | Thickness | |
Sweep | Cone | BooleanUnion | |
BooleanSubtract | BooleanIntersect | G3Fillet | |
G3Chamfer | G3Shell | G3Offset | |
G3Slice | G3Bend | ExtentsX1 | |
ExtentsX2 | ExtentsY1 | ExtentsY2 | |
ExtentsZ1 | ExtentsZ2 | Text | |
TextFont | TextStyle | Group | |
SetProperties | PatternCopy |