-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Syntax scripting language
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Syntax scripting language
Script - is the code in a language similar to SI, which determines the nature of the object database software parameters, the plane impact on the response object. Automatic installation of dependencies, etc. A script comprises a series of blocks, which perform defined events from outside the object.
Identifiers
Identifier is a sequence of characters representing the name of a variable, function, or operator. Rules describe identifiers MechWizard similar to the rules in C:
- Identifier can consist of letters of the alphabet, numbers, and the underscore character.
- The identifier must begin with a letter or underscore.
- Identifiers consisting of identical sequences of letters, but in a different case (uppercase / lowercase) are different identifiers.
- The maximum identifier length is limited to 50 characters.
Recommendations to the name variable names are listed in the document.
Keywords
Keywords - are reserved identifiers that are endowed with a certain sense. They can be used only in accordance with the value of the known macro-language interpreter. Keywords cannot act as an identifier.
List of key words listed in the annex.
Data Types
In the macro language, there are five main types of data:
- Valid floating-point number (double analogue in C). Range-1.7e308 .. 1.7e308.
- Line.
- Three-dimensional point (Point)
- Three-dimensional vector (Vector)
- Plane defined by the reference point and a normal vector (Plane).
The script made an agreement to the names of real type variables prefixed r, to add a prefix to a string variable str or s, to the point type variables prefixed pnt or p, the variables of vector type to add a prefix or vec v, and the plane denoted WP (WorkPlane).
Initialization of variables is carried out without prior specification as in BASIC. To declare a variable, you just need to assign it a value. If the variable is not described in the header function in the sections ActHeader Public or Protected, it will be considered local and will retain its value from the first moment until the end of the definition, in which it is described.
StrName = "ObjectA"; rPI = 3.1415926; rA = 2.0;
To initialize the points and vectors used special constructor functions Point (), Point (x, y, z), and Vector (), Vector (x, y, z) respectively.
pnt2=Point();//handle length pnt1= Point(1.0, 10.0, 10.0); //This is the point with specific coordinates vec1 = Vector(); // vector of unit length, which coincides with the axis OX (1,0,0) vec1 = Vector(1.0, 1.0, 0); //Vector specific coordinates
To separate the coordinate point or vector can be accessed using the qualifier:
pnt1:x = 12.5;//Removing the abscissa of the point vec1:y = 25.6;//Removing the ordinates of the point
Plane used to initialize a constructor function Plane (pnt, vecNormal).
WP1 = Plane( pntBase, vecNormal ); //pnt- This is the basic point for the plane WP1 //vecNormal- This is the normal vector to the plane of WP1
Eg
WP1 = Plane( pntOrigin, vecDirection);
Indexing variables
If you declare a number of variables of any type with names that differ only by the number in the end, then these variables can be accessed by index, as an array.
rParam1 = 1.0; rParam2 = 2.0; rParam3 = 4.0; ... rParam[2] = 45.7; rParam[3] = 9.1223;
Comments
Comments in the script begins with the double slash line and ends at the end of the line.
//First set up a plane in counter-clockwise order vecNormal=getLocalNormal(vecDirection,vecPlane); WP1 = Plane( pntOrigin, vecDirection ); WP2 = Plane( pntOrigin-vecPlane*(0), -vecPlane ); //Right side WP3 = Plane( pntOrigin+vecNormal*(b/2), vecNormal ); WP4 = Plane( pntOrigin+vecNormal*(b/2)+vecPlane*h, vecNormal ); WP5 = Plane( pntOrigin+vecPlane*(h), vecPlane );
Operators
All operators of the macro language can be divided into the following categories:
- arithmetic operators
- Boolean operators
- conditional operator
- loop operator
- other operators (empty statement, the assignment operator, the operator access to internal members)
All operators end empty statement - a semicolon ";".
Empty operator
Empty statement consists only of a semicolon. When this statement is executed, nothing happens. This statement is a delimiter for other operators, functions, and lines in the script.
Composite operator
A compound statement is a few operators and announcements enclosed in curly braces {}. Execution of the compound is in the sequential execution of its constituent operators. At the end of a compound statement the semicolon is placed.
The assignment operator
The assignment operator is denoted by the sign of equality.
expression A = B; means that variable A is assigned the value of expression B, and the type of the variable A type of expression is established B.
Operator access to internal members of the complex data types
To access the internal members of the complex data types, a special qualifier operator ":". For example, it can be used to access the individual coordinates variables of type Point and Vector.
Arithmetic and logical operators
Syntax of arithmetic and logical operators in macro language script syntax is similar to SI.
Arithmetic |
Puzzle |
||
A + B |
Addition |
A == B |
A is equal to B |
A - B |
Subtraction |
A != B |
A nonequilibrium In |
A * B |
Multiplication |
A > B |
A more in |
A / D |
Division |
A < B |
And in less than |
A && B |
A and B |
||
A || B |
A or B |
For arguments of type Point subtraction result is a vector. A multiplication of a vector by a new vector will equal the scalar product of the vector by.
vecDirection = pntEnd - pntStart; vecScaled = vecDirection * rScale;
The conditional operator
Format statement:
if ( <expression> ) operator_IF1; else operator_ELSE1; //<expression>- it is a logical condition to perform operator
As operatora_IF1 and / or may act _ELSE1 composite operator, ie group of statements enclosed in braces.
Execution if the operator starts with the evaluation of expression.
Further execution is as follows:
- if the expression is true (ie, different from 0), then the operator _IF1.
- if the expression is false (ie, equal to 0), then the operator _ELSE1
- if the expression is false and there is no operator _ELSE1, then the following if statement in
Block of statements after else may be missing along with the word else. In this case, the conditional statement is as follows:
if ( <expression> ) operator_IF1;
As an expression can be any logical or arithmetic operator or a sequence of statements separated by parentheses.
if (A>1) operator_IF1; if ((A>1)&&(B<5)&&(C==25)) operator_IF1;
You can use nested conditional statements, ie conditional statement can be included in the design if the design or else another conditional statement.
if (A > 1){ if (B < 5){ if (C == 25) operator_IF1; } };
Cycle Operator
Format statement:
while (expression) operator_BODY;
Requirements for the expression, such as in the if statement. _BODY Operator called the loop body.
Executing the cycle begins with the evaluation of the expression. Further execution is as follows:
- If the expression is true (not 0), the loop body is executed.
- If the expression is false, then the next while the operator.
- The cycle is repeated from step 1.
Functions
Function - a set of operators and other function call. Each function has a name. Function declaration begins with the keyword function. The function body is enclosed in braces. In this version of the browser functions have no parameters.
Format function:
function Function_Name{ operator_1; ... operator_N; }
Allowed to call one of the other functions, but called from funcA functions must be declared above in the body of the script.
Example:
function user_Function_1{ MessageBox("This is my first feature"); } function OnInitialization{ user_Function_1(); // The correct call. The called function is declared above! user_Function_2(); // Wrong call. The called function is declared below! } function user_Function_2{ MessageBox("This is my second feature"); }
The interpreter has a number of built-in functions as listed in Appendix 2.
Specifying the object plane
Target abstract object geometry (points vectors planes) may be in coordinate form (almost not used) or relative to the local coordinate system. Position of the points defined by specifying operators addition point and plane. In the example, the position of the reference point is defined as the plane
pntWP4=pntOrigin+vecDirection*(b/2)+vecPlane*h
Normal vector of the plane collinear insert vecDirection
Consequently, she illuminated plane WP4 will be set as
WP4=Plane(pntWP4,vecDirection);
If the surface normal vector is not orthogonal coordinate system, it is often determined by the operator or RotateBy GetLocalNormal.
For example, for lining the conical bottom, surface normal vector is defined as the WP2
vecNormal=getLocalNormal(vecDirection,vecPlane); vecFitting = rotateBy(vecDirection,90-ang/2,vecNormal); //ang - is the angle of the bottom in terms of
Apart from the above identified, operators are used to find the vector normal plane and the base point:
pntWP1 = Point(WP1); vecWP1 = Vector(WP1);
To find the distance between the point and the plane used the difference point and plane
rDistance = WP1-pntOrigin;
Vector length (distance between points) define the operator vecLen:
rLength = vecLen(pntWP1 - pntOrigin);
Orthogonal vector operator is getPerp:
vecPlane = getPerp(vecDirection);
Worksheet
To work with the table object used by two operators and LoadInCache SelectInCache.
The operator loads the LoadInCache specifies the parameters in the cache of the table. This operator in the new versions must be called only when the sample is forced with an expression to evaluate the parameters of the (..., "+", ...).
SelectInCache operator selects from the table according to the specified criteria (see syntax in the appendix)
Sampling by "kFirst" selects one first row. Sampling by "kFilter" selects a range of records from a table that match the specified filter.
Dining sample-specific parameters "~" - the approximate equality parameter selects the value in the record. "=" - An exact equality, "+" - the sample on the filter. Picks by filter oznachet that if the logical filter condition is satisfied, then the record is selected from the table (subjected to further checks on the conditions).
For example, the
SelectInCache("kFirst", "dr", "~", rdr, "L", "+", "L>=rMinLen&& L<=rMaxLen&& (L-b<=rTrLen)");
selects the first record of the table, where the combination of parameters dr, L, b such that dr?rdr, rMinLen<=L<=rMaxLen, (L-b)<=rTrLen.
Function SelectInCache important order of the sampling conditions. This means that in the first place will be selected from the table entry corresponding to the first condition, then - of which selects records corresponding to the second condition, etc.
If there are multiple items in the tables, then the coincidence parameter names must enable the checkbox "Use the table name as a prefix to the parameters" in the context menu of the corresponding table.
In this case, an appeal to the parameter in the script will be as follows:
<Name of the table>.<Parameter name>
For example:
If (Table0.dr==Table1.Thread1) { ... };
To provide a sample of the first table is not necessary to modify the operator SelectInCache.
For example, if you need to select from the table Table1 parameter dr, equal to 10, then the first condition in the operator to select from a table must follow the table index (starting from 0):
SelectInCache(1, "kFirst", "dr", "~", 10);
For a table with imenenm Table0 table name can be omitted. Ie it is also true, and another expression:
SelectInCache ("kFirst", "dr", "~", 10, "L", "~", 50); SelectInCache ("0","kFirst", "dr", "~", 10, "L", "~", 50);
Dialog object. Making function UniDialog
View Insert Object dialog box is defined by specifying the key features UniDialog.
See the appropriate section of the application.
It should be easy to compare that
DBFLD - the defining table parameters.
DBINF - reference table settings.
VFLD - are arbitrary parameters and reference data.
VIDS - a list of versions of the object (possibly omitted if there is only one execution.
TVIDS - different views of the same design (possible keys - by type, All - those present, AnyWBK - opposing views generated mirror (for symmetrical objects).
VIEW - thumbs species.
Key OnDglBeforeSelParam in ActHeader determines whether the dialog is called before the dynamic parameter selection.
Connecting UserForm
If an object is given shape, then in order for it to be called, you need to function in place of the function OnDialog UniDialog cause concrete form.
For example, if the object is given form named frmMain, you should write the following:
functionOnDialog{ ShowForm("frmMain"); }
Similarly, the terms can cause several different forms of the object, referring to them by name using the operator ShowForm.
Set dependencies
Operators set up dependencies implement geometric and parametric dependence.
Parametric dependencies
SetParamConstraint(< param >,obj,EXPR,< expression to constrain>,bBidirect);
<param> - name of the parameter object to which the time dependence.
Obj - which object set.
EXPR - so far only the dependence on the expression
<expression to constrain> - arithmetic combination of parameters on which dependence is placed (must be in quotes).
bBidirect - bidirectional or unidirectional relationship.
Geometric constraints
SetGeomConstraint(rTYPE, rDIRECTION, obj, < WPname >, < WPtoConnect >,offset,bBidirect); SetGeomConstraint(ANGE,CODIRECT,< obj >,< wpSourcePlane >,< wpObjPlane >,< rAngle >,< bBiderect >);
Types of dependencies rTYPE = INSERT (inset)) MATE (alignment on the plane) AXIS (alignment axis) DIRECTION (aka ANGLE) (angular orientation).
Direction rDIRECTION = CODIRECT (co-directed) CONTRDIRECT (opposite directions).
<WPname> - The name of the plane, which are attached.
<WPtoConnect> - The name of the plane, joined.
Offset - numerical or parametric expression that defines:
INSERT - axial distance between the planes.
MATE - the normal distance between the planes.
AXIS - relative displacement in terms of the axes.
DIRECTION - angle relative orientation of the planes.
For dependencies DIRECTION (ANGLE) there are certain conditions:
Syntax:
SetGeomConstraint(ANGE,CODIRECT,< obj >,< wpSourcePlane >,< wpObjPlane >,< rAngle >,< bBiderect >);
ANGLE - keyword angular dependence.
CODIRECT - always for the angular dependence. It is believed due to the minimal angle.
<obj> - which object set.
<wpSourcePlane> - the plane of the source object to which dependence is placed.
<wpObjPlane> - the plane of the object to which you subscribe.
<rAngle> - numerical value of the angle in degrees, depending.
<bBidirect>=(TRUE,FALSE) - unidirectional or bidirectional relationship. Default FALSE.
Depending on the type ANGLE should be added after the dependency type INSERT, MATE, AXIS.
When the dependency type INSERT, MATE or AXIS rotation is relative to the axes of the planes dependence.
In the absence of dependency type INSERT, MATE AXIS or move it in the normal to the plane in which both vectors lie in the direction of the minimum angle of rotation.
If we consider the vectors are collinear, move it about the axis OX.
Example:
SetGeomConstraint(ANGLE,CODIRECT, obj,WPnormal,obj.WPnormal,45); SetGeomConstraint(ANGLE,CODIRECT, obj,OYPlane,obj.WP2,15,TRUE);
Examples of different types of dependency can be found in the appendix.
Function ShowValue
Using the debugger windows can detect errors in the script and determine the values of parameters during the execution of the script. Syntax, see Appendix.