Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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:  
LINEAR, means that the parameter is a linear value in the selected linear units of measure.  
ANGULAR, means that the parameter is an angular value in the selected angular units of measure. (only degrees are available at this time)  
TEXT, a text string;  
FONT, a font name;  
COLOR, an RGB color value;  
MATERIAL, a material name;  
CHECKBOX, a logical value, either ON or Off

<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:  
Set(<value>,...) — a list of permissible values of the parameter parameter Interval(<minvalue>, <maxvalue>) — sets the minimum and maximum values of the parameter;  LessThan(<value>) — indicates that parameter value should be less than the specified value value LessOrEqual(<value>) — indicates that parameter value should not be greater than the specified value value GreaterThan(<value>) — indicates that parameter value should be greater than the specified value value GreaterOrEqual(<value>) — indicates that parameter value should not be smaller than the specified value value
Set(FolderList) --- particular particular case of Set operator, when a list of permissible values are defined by operator FolderList.  
Restrictions should not contradict each other. For example, you cannot combine GreaterThan(5) with LessThan(2).  
When specifying parameter restrictions, it is not allowed to use identifiers or expressions that directly or indirectly depend on other parameters, as arguments of the above-mentioned functions. Only constants or constant expressions can be used, for example: LessOrEqual(PI/2).

...

<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
Note:  The plane of the path and the plane of the profile must not be parallel.

<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.  
Point(xc,yc,zc) is the middle point of an edge to be filleted (for example in the TurboCAD "Fillet Edges" operation, this point is marked with a blue square). Array of Points defines a set of edges to be filleted.

<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.  
Point(xc,yc,zc) is the middle point of an edge to be filleted (for example in the TurboCAD "ChamferEdges" operation, this point is marked with a blue square). Array of Points defines a set of edges to be chamfered.

<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:  
Point(x1, y1, z1), Point(x2, y2, z2).  
The line must lie on the solid face selected for bending.

<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.  
The following values of characteristics are allowed:  

For Justification:  
LEFT, CENTER, RIGHT, TOP, MIDDLE, BASELINE, BOTTOM BOTTOM

For Text Effects:  
BOX, UNDERLINE, STRIKETHROUGH, AllCAPS AllCAPS

For Style:  
BOLD, ITALIC


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
RTF5f5265663231313134373438
RTF5f5265663231313134373438

Anchor
RTF5f546f633231313137333832
RTF5f546f633231313137333832
Anchor
RTF5f546f633231313836363530
RTF5f546f633231313836363530
Special functions and operators

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:  
== (equal)  
< (less than)  
> (greater than)  
<= (not greater than)  
>= (not less than)

<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
An  An <object> can can be represented by either a value, or the <identifier> of a value, or by a Point(x,y,z) function.

...

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