nanoCAD Platform Help

DEVELOPER'S GUIDE DATABASE

Terms

Functions of the standard objects

The database of the standard details was created to help a constructor to create graphics. Use the details from the database to create graphics. The standard details behave intelligently in the drawing so that the number of additional actions in the development environment are decreased.

What can the standard details do

Insertion from the database. The database is organized as a hierarchical structure of objects having similar functions. (For example, the details of arbors, pipelines etc. are grouped). There are also different types of objects: the groups and the markers of the objects. You can search for the required standard in the database. When inserting a detail, specify the insertion point and the direction of the detail's local X axis (position and orientation of the detail). The details can be fully displayed or displayed as a representation of the base plane. The position of the detail is specified by a click, the orientation by a double-click.

CAD drafting DEVELOPER'S GUIDE DATABASE 0

If GOST of the detail contains the table of the parameters, it is recommended to limit the dimension values for the elements of the construction. One detail can have several tables. (For example, if the parameters of one element of the construction do not depend on the parameters of the other elements).

If the parameters of the object's graphic are not specified by GOST, the user specifies their values during insertion. Such parameters are displayed in the second tab of the insertion dialog. Such property is the length of the I-Profile.

CAD software DEVELOPER'S GUIDE DATABASE 1

Sometimes it is convenient to specify the parameters in the drawing according to the parameters of other details. In this case, dynamical selection of the detail's parameters is used. This mode is selected with the Selecting parameters dynamically button. The parameters are selected towards the insertion point, after the insertion point is specified. Dynamical selection can be executed from the table or by using other parameters. The values, selected dynamically, sometimes set additional constraints (the maximum and minimum values) to provide correct drawing.

CAD drawing DEVELOPER'S GUIDE DATABASE 2CAD drafting DEVELOPER'S GUIDE DATABASE 3

The grips are very useful tools to edit objects, and if the object has grips, they add additional functionality to the object. You can move, rotate and mirror the object, using the grips; you can also change the standard size of the detail, visually set the detail’s parameters and define the direction of the drawing.

CAD software DEVELOPER'S GUIDE DATABASE 4CAD drawing DEVELOPER'S GUIDE DATABASE 5

The standard database of the program behaves intelligently towards the other objects in the drawing. For example, when the pipe fitting with the internal cone is inserted, the nipple, inserted after it, will be automatically connected with the fitting. 

CAD drafting DEVELOPER'S GUIDE DATABASE 6CAD software DEVELOPER'S GUIDE DATABASE 7

It is achieved by specifying parametric and geometric dependences between the details. The dependences for the details should be set according to the standards. 

The user can set the dependences for the objects already placed in the drawing (for example, if the automatic connection is not specified). These dependences are custom and are stored in the drawing.

CAD drawing DEVELOPER'S GUIDE DATABASE 8CAD drafting DEVELOPER'S GUIDE DATABASE 9

The standard databases can also have additional functions that are used in the other tools.

Abstract model of the detail

A detail should be a black box for the user.

CAD software DEVELOPER'S GUIDE DATABASE 10

To specify a nominal size and graphic of the detail, use its parameters. It is necessary to specify these parameters, and not all parameters should be available for the user, but they should be known for graphic recognition. There are the public parameters, which the user can see, and the protected parameters, which define graphic, but the user cannot see them. These parameters can have values, defined by GOST, or the user can set their values.

When editing the detail with grips, you should define their number and the parameters they specify; define grips to specify the insertion point and the detail's orientation.

The view of the insertion dialog (or its data form) is also added to the user interface of the detail. Its view and behaviour is the black box of the detail, the form and the dialog should be convenient for the user to specify the nominal size and the parameters of the detail.

The geometric dependences are set by the detail's planes, which are a vector and a point together. The number and the position of these planes should be defined to set the dependences. The planes can be changed if they specify the detail's position according to the dependence with another detail, and unchanged (if another detail is linked to this plane); they do not change the insertion point of the detail according to the dependences.

The planes are defined according to the local coordinate system. The insertion point is its origin (pntOrigin). The direction vector (vecDirection) and vector in the drawing's plane (vecPlane), orthogonal to it, are X and Y axes.

The mathematically highlighted plane will be in the b/2 horizontal and in the h vertical distance from the insertion point. The Vector of the plane will be collinear to the vecDirection direction vector. It is enough to specify the new position of the detail if the plane is changed according to the dependence.

CAD drawing DEVELOPER'S GUIDE DATABASE 11

When changing a detail's parameters (when there are parametric dependences or when specifying the values of the parameter in the dialog), it is necessary to define new values for the parameters, select new values from the table, change the planes etc.

To define discrete values of the parameters, select them from the table. The table is organized in such a way that one row corresponds with one nominal size and the columns of the table contain the detail's parameters. The parameters can have String, Integer and Real types. The parameters have a comment, which is used in the insertion dialog. Columns and rows have unique identifiers, saved during the import and export processes of the table to provide the correspondence of the nominal sizes and already existing details in the drawing (selected rows and parameters in the table when editing the object).

Object's graphic

To display the object in the drawing, the orthogonal views are used. The views have different types: general, views with cuts and simple views with dimensions. The views with dimensions are system and hidden. Their graphic is realized when the dimensional view is inserted from the context menu.

The local coordinate system in 2D views is set that the X-axis is directed to the right and the Y-axis is directed up in the frontal view. The direction of the coordinate axes is defined by the projective dependence in the other views.

The parametric recognition defines the parameters and the relative position (horizontality, verticality, perpendicularity and parallelism) of the graphic primitives and their interaction with each other (intersection points, tangents etc.). It is necessary to specify the insertion point of the detail (origin of the local coordinate system). It is necessary to describe a view as a text (graphic parameterization).

Recommendations for creating 2D views.

     ·     Use the object snap for endpoints and intersections.

     ·     Use the polar tracking and ortho modes.

     ·     Arc segments and tangent arcs should be dimensioned.

     ·     Use the helping geometry for recognition (circles in the centres of the tangent arcs).

     ·     Dimension should be clearly set.

     ·     Sometimes to create a difficult graphic, the view is separated into parts, and null distance is set between the parts.

The purpose of the recognition is to define the position of all primitives towards the insertion point. The parameters and dimensions are set from it.

The requirements to graphic are specified in the particular recommendations.  

To make a 2D graphic parametrically controlled, set the detail's geometric parameters as dimensions instead of the nominal sizes. Some parameters are related to graphics.

Common properties: "Visibility" - is a logic expression or variable, defining whether or not to draw the primitive.

Linetype:

     ·     0 - main.

     ·     2 - thin.

     ·     4 - dashed.

“Work object” - an object that is used in the recognition, but is not added to the end graphic. It is a helping drawing.

CAD drafting DEVELOPER'S GUIDE DATABASE 12

Parameters of hatch - the angle of slope, hatch space and double hatch feature (logical condition)

Parameters of ellipse - the major axis of the ellipse and the minor axis of the ellipse. The start angle and end angle of the ellipse - if the elliptic arc is drawn.  The sloping angle to the OX axis is an angle, on which the local coordinate system of the ellipse is relatively rotated to the coordinate system of the object’s view.

Parameters of spline - the start and end tangent angle. All points of the spline should be dimensioned.

If the hatch contour does not follow the required contour, a closed polyline is created with the parameter - hatch contour.

Sometimes it is necessary to set a contour of suppression for the detail (if the automatically created contour does not follow the requirements of the detail). In this case, the parameter of the suppression contour is also set for the closed polyline.

Creating the dimensional views of the standard details

The same graphic is used to create the dimensional views of the standard details, as is used to recognize the main view.

Add only the required elements to the graphic of the dimensional view.

To recognize the dimensions as constructive objects, switch off the Work object checkbox in the Parameter dialog.

CAD software DEVELOPER'S GUIDE DATABASE 13

After that, specify the required view of the object and select Hidden view and Dimensional view for it.

CAD drawing DEVELOPER'S GUIDE DATABASE 14

Select the Recognize view from the context menu.

CAD drafting DEVELOPER'S GUIDE DATABASE 15

Specify the graphic in the drawing and confirm the selection. Save the object.

To test the dimensional view, insert the object with the created direction of view. From the context menu of this view, select the Add dimensional view.

CAD software DEVELOPER'S GUIDE DATABASE 16

Specify the insertion point of the dimensional view.

CAD drawing DEVELOPER'S GUIDE DATABASE 17

Note:

Dimensional views are inserted with the current dimension style and symbol scale.

Details in the database. Dependences

The details can be connected with each other. How does it happen By setting the parametric and geometric dependences. The parametric dependence - an expression meaning that one parameter of one object equals one parameter or the arithmetic expression of the parameters of another object. For example: the diameter of the bolt thread should be equal to the diameter of the screw thread which it is connected with.

CAD drafting DEVELOPER'S GUIDE DATABASE 18

The thread diameter parameter (dr) of the screw is equal to the thread diameter parameter (dr) of the bolt (dr=dr).

CAD software DEVELOPER'S GUIDE DATABASE 19

When setting the support for the shell, the dependence of the parameters' arithmetic expression is set: the diameter of the support is equal to the sum of two shell widths and the inner diameter of the shell. DA=D+2*s.

When setting the dependences there are a child and parent objects, the dependences can be one-directed and two-directed. The one-directed dependences affect only the child object (change of the parent object affects the child object, but change of the child object does not affect the parent object), the two-directed dependences affect two objects, change of one object affects the other object.

The geometric dependence between the objects is realized by movement and reorientation of the objects. The new position of the object is calculated according to the new position of the object's planes.

The views of geometric dependences:

INSERT - the combination of the insertion points and planes' vectors. The function has a parameter - offset - the distance between planes' points of the detail along the OX axis.

CAD drawing DEVELOPER'S GUIDE DATABASE 20

MATE - the collinearity of the direction vectors if the abscissae of the details are relatively equal. There is a parameter - distance along the OX axis.

AXIS - the combination of the direction vectors with the unfixed coordinates along the OX axis. The parameter of the dependence - distance along OY axis.

The combination along direction (angular dependence) - the collinearity of the direction vectors with the unfixed relative coordinates.

The geometric dependences can be codirectional and opposite directional according to the orientation of the local vector of the OX axis.

There is no need to connect all objects with all objects and that is why it is necessary to set the dependences automatically. The classification of the objects is set to define what details should connect with each other. The classification is made according to the number class (used in the program tools) and the public parameters of the object. These are strTheName, strTheType and strTheSubType variables. To connect a bolt and a screw there is a check of these variables and, if they coincide, the dependence is set. Fasteners are connected only with fasteners, not with pipe fittings, but both types have the thread diameter parameter. Every object has a unique identifier, used for the insertion from the browser.

Suppression contour and display order

Graphics, like the standard details from the database, have a suppression contour - a closed area, hiding the graphical primitives and other details. (For example, the contour of the screw overlaps a line of the bolt.).

Display order is set by the rZOrder variable. Details with an rZOrder value greater than the rZOrder value of other details will overlap them. This property works with the intervals divisible by 2000. The object from the database can have a suppression contour formed with its outer boundary, a specified suppression contour or have no contour at all.

Eventive Object's model

Flowchart of the script's functions.

CAD drafting DEVELOPER'S GUIDE DATABASE 21

ActHeader - the description of the object's parameters. It includes the description of the public and protected parameters, specification of the reserved variables and description of the subobjects.

During every activation of the object, the OnInitialization function is executed. Using set variable the single setting of the object's parameters needs to be checked.

The OnDialog function is activated after specifying the insertion point and direction from the context menu during the dynamical selection of the parameters.

The OnDialogChanged allows you to add interactivity in the insertion dialog of the object. It is executed every time the parameters are changed in the dialog. In the function’s body, it is possible to hide the controls to provide the correct selection of the object's parameters.

The OnInitSelect is executed before the dynamical selection of the parameters.  There is a tooltip string (for example, the current value of the length).

The OnSelectParam is executed during the dynamical selection of the parameters. It defines what and how parameters should be selected. It usually contains checks of request number for the selection of the parameters and checks of the current view.

The OnMakeParameters function is final. All final calculations of the parameters are executed and the classifiers and planes are specified. As this function is executed after all object events, the constraints for the parameters and the relative selection of implementations are added.

The SetGripPoint function sets grips for the object. Their number and position are set there.

The OnMoveGripPoint function receives the number of the edited the NMovingGrip grip, the relative position of the grips is processed and the object's parameters are changed according to it.

The BeforeConnect is executed before the dependences are set. The previous dependences are reset and a tooltip string is specified when selecting the object to connect.

The OnConnect function is executed when one object is connected to another object. It contains a check of the object's classifiers and operators for setting the dependences according to this check.

As the result of the OnConnect is a new value for the connected object, this is received as a new object. The OnChangeParameters function is executed when the object's parameters are changed according to another object's parameters using the parameters toolbar. This function determines the object's reaction to changing its parameters.

Localization mechanism

The following is a mechanism of localization:

The object's implementations are activated by their system names, which can be changed in the context menu of the Master of Objects.

CAD software DEVELOPER'S GUIDE DATABASE 22

Activation of the implementation in the script:

   if (strDesignName == "Implementation 1") {
      strPartName = @BOLT_M+dr+step+" # x"+L+@___GOST_7798_70;
   };
 

If the use of the string values in the local coding is required in the script, change them with the resources.

The resource is a reference to the table row containing the list of the string values according to the current application language.

CAD drawing DEVELOPER'S GUIDE DATABASE 23

To use the local resource in the table, call its name (Label) with "@" prefix.

   Public(
      L, @ROD_LENGTH,
      dr, @THREAD_DIAMETER,
      WP1, @WORK_PLANE_1,
      swTr, @SMALL_THREAD_STEP,
      rScrewOk, @BOLT_OK,
      s, @BOLT_HEAD_WIDTH,
      b, @THREAD_LENGTH,
      massa, @MASS
   );
 

When the script is executed in the specified location, the required values will be selected instead of the @<resource name> references:

   Public(
      L, "ROD_LENGTH",
      dr, "THREAD_DIAMETER",
      WP1, "WORK_PLANE_1",
      swTr, "SMALL_THREAD_STEP",
      rScrewOk, "BOLT_OK",
      s, "BOLT_HEAD_WIDTH",
      b, "THREAD_LENGTH",
      massa, "MASS"
   );
 

Requirements of the objects

Requirements of the standard details

The required functionality means that the objects can be inserted from the database, their parameters can be specified, changed, the details can be connected with each other etc.

The details should satisfy the standards (GOST, ISO, etc.) and engineering practice. It is required to follow not only the table parameters but also ESKD, Mechanical etc. requirements. The details should not break the rules of design and product documentation.

Standardization. To make the creation and classification process of the standard details easier, use similar graphics for the details that have similar functions.

As the database is used in multilingual applications, it can be localized; the names should be correctly displayed in English or in Russian.

The situation, where several people have developed ONE GOST, is very common. The standardization helps to transfer the product from the developers to the users.  Everybody should understand how the scripts are created.

Requirements of the objects. List of the requirements. Graphic and script creation of the objects from the database using MechWizard

The requirements should be applied for the newly created and edited objects from the database.

Object's properties

The name of the object should contain the name and number of its standard (for example, "GOST 7798-70", "ISO 657/16").

The comments attached to the name should contain the object's name according to the standard (for example, "Hot-Rolled I-Shape with Sloped Flange").

The specification string should be specified by the strPartName variable.

All the comment fields of the table parameters from the DBFLD and DBINF sections of the UniDialog function should be filled in with the descriptions. All the comment fields of the table should be filled in.

It is recommended to group the table fields so that they have the main parameters grouped to the left.

By default, the name of an implementation is "Implementation1" (without space), if another name is not specified by the standard.

If the Russian standard is used, GOST is set in the properties (if the detail was made by OST, TU or ATK).

Parameters

When creating the parameter's name you should take into account:

   1.     Similar parameters of the objects from the database (for example, dr - thread diameter, p - thread pitch, L- rod length).

   2.     Names of parameters in the standard (for example, D1 - flange outer diameter, Dy - drift nominal diameter, b - thread length. The function of the parameter should be specified by the comment in the table or by description of the public parameter.

   3.     Rules of the variable’s name for C language.

Rules to define the variables:

     ·     Identifier is a sequence of symbols, which are variable’s, function’s or operator’s names.

     ·     Identifier can consist of Latin letters, numbers and underscore character.

     ·     Identifier should be started from a letter or underscore character.

     ·     Identifier, consisting of the same sequences of symbols but in a different case (upper/lower case), are different identifiers.

     ·     Maximum length of the identifier is limited to 50 symbols.

Recommendations for variables names:

     ·     Use prefixes for variable types (r - real, i - integer, str - string, b - logic, vec - vector, pnt - point)

     ·     Use descriptive variables’ names (for example, rLength instead of L, bSection instead of sh)

     ·     Use different cases of letters in the long names of the variables (for example, rWP2offset, bUseFlatSeal)

The parameters should be described as public if:

1. It is needed to specify a connect for the object

2. It is needed to specify a nominal size for the object (the parameters are important)

3. It is needed to extract the parameter for further use (by universal marker or to add to the table fields and etc.)

In any other cases the parameter should not be added to the public section.

You can specify only values of the strTheName, strTheType and strTheSubType variables in English. The values of these parameters should be specified in a way to provide the maximum standardization of the connect procedures.

All parameters of the Public type should have descriptions. This also applies to the descriptions of the working planes. The descriptions of the parameters should be started from the object noun (for example, "Bolt head width").

It is not recommended to describe the parameters with dimensions in the Public section. The descriptions of parameters in the table and in VFLD field can have dimensions. In this case, the dimension is specified in SI units after a comma (for example, "Outer diameter, mm").

All parameters names of the VFLD and BFLD sections should be filled in. It is not allowed to use the variable name as the description of the variable (e.g.  L,”L”).

If the preview is set with the dimensions of the detail, it is allowed to use the comments of any parameters in the VFLD L, "L, Length".

It is recommended to specify the description for all parameters used in the script (as comments).

If a detail’s mass is specified in the standard, it should be added to the public parameters and in the UniDialog DBINF section.

The mass of the detail is specified as a "massa" parameter and in kilos per one detail.

If the mass of the implementations is specified in the table, these parameters have names: massa1, massa2 and etc.

To provide the correct localization of the scripts, all string values should be references to the resources, except for the implementation’s name strings, strTheName, strTheType, strTheSubType classifiers, form names etc.

Resource names are specified in English upper case letters without spaces.

For example:

 @DIAMETER_OF_THREAD
 @WORKING_PLANE_1
    

The system names should contain only English letters.

Script

It is recommended that the comments are created in English

It is not recommended to place several operators in one line.

When creating the script, follow the order of the functions:

   1.     ActHeader()

   2.     OnInitialisation()

   3.     (Custom functions)

   4.     OnMakeParameters()

   5.     SetGripPoint()

   6.     OnMoveGripPoint()

   7.     OnDialog()

   8.     OnDialogChanged()

   9.     OnChangeParams()

10.     OnInitSelect()

11.     OnSelectParam()

12.     OnMenu()

13.     BeforeConnect()

14.     OnConnect()

The operators, setting the strPartName and strPartDescription variables, should be placed at the end of the OnMakeParameters parameters.

The script version and the GOST description should be placed in the first lines of the script. General comments of the object can be placed after them. For example:

   SVersion = 2;
     ObjectDescription = "GOST 19425-74";
     // Slope of flange should be taken
     //between 4 and 10%.
     //In particular 8%
    

It is recommended to use the tabulation to specify an offset for the composite statement and is not recommended to use spaces.

Composite statements should satisfy the following requirements:

     ·     Open bracket is on the same level as the statement

     ·     Nested statements are placed in the same level with the 1 Tab offset.

     ·     Close bracket is on the same level as the composite statement.

Example:

 function OnConnect {
     if (rPart == 0) {
         if (obj.strTheSubType == "vaBottom") {
             setWorkId (0, obj.objectID);
             Handled = OBJ_HANDLED;
         };
         if (obj.strTheSubType == "vaShell") {
             setWorkId (1, obj.objectID);
             Handled = OBJ_HANDLED;
          };
      };
     …
 };
 

The UniDialog function should satisfy the following requirements:

     ·     The Function is formed as a composite statement

     ·     Every keyword is started from a new line

     ·     Every option of multi-version sections starts from a new line with the offset.

Example:

 UniDialog(
   DBFLD, seria, h, b,
   DBINF, num, mas1,
   VFLD,
     L,"length of I-Profile, mm",
     strRefDataHeader,"Reference data:",
     A, "A, sm^2",
     Ix, "Ix, sm^4",
     ix, "ix, sm",
     Wx, "Wx, sm^3",
     Sx, "Sx, sm^3",
     Iy, "Iy, sm^4",
     Wy, "Wy, sm^3",
     iy, "iy, sm",
   BFLD, bHid, "Show hidden lines",
   TVIDS,lViewType,"AnyWBK",
   VIEW,"Vids"
 );
 

It is recommended to break difficult arithmetic expressions over several lines, or use several additional variables.

It is recommended to use the descriptive comments to group lines of the code which have a close logic structure (for example, block of statements to specify working planes etc.).

Graphics

The drawing should provide recognition of the parametric 2D view of the object from the database with maximum legibility and contain all required views for the element (including the graphic for which the preview was created).

The expressions "single parametric element from the database", "detail" and "GOST" (in lower case so that the letters are not confused with the standards) are set as equivalent.

The drawing of the detail or details should be created in one file. The file name should contain all the numbers of the standards used to create the detail and, if needed, the description. (for example, "GOST 7798-70 Hexagon Head Bolts Product Grade A").

General requirements

By default the scale is set 1:1. The scale to draw a graphic is selected by the user, but the drawing should be legible. It is recommended to draw a detail according to its values from the table.

All objects are drawn in the model space. Default settings are used to create elements.

Layers

By default the line width is set to default for all layers and objects. 

Layers, used for the drawings:

Layers name

Parameter - linetype of the object

Colour

Objects

MAIN

0 or not specified

White

Objects, which should have this linetype

Insertion point

THIN

2

Red

Objects, which should have this linetype

Hatch

DASHED

4

Green

Objects, which should have this linetype

AXIS

Specified by the command

Red

Objects, which should have this linetype

WORKING

Checkbox "working object"

Yellow

Objects, which should have this linetype

DIMENSIONS

Not specified

Blue

Dimensions and text formulas

Names of GOSTs, implementations, views and other comments

The "centre Line" parameter should be set for graphic objects after their replacement on the specified layer.

Placement of graphic

The separate details and the separate implementations of one GOST should be separated from the other GOSTs and implementations in the drawing (zonally or with the rectangular frames).  If there is more than one GOST or implementation, the GOST number or implementation name should be written above of the group of implementation or GOST views.

The views should be in the projective connection in the drawing.

CAD drafting DEVELOPER'S GUIDE DATABASE 24

Figure 1. Placement Drawing Views.

The views, which are out of the projective connection, should have clear names to define the relation.

It is recommended to group the views with cuts, simplified views and views with dimensions near their projective views.

If one or several views belong to one GOST/implementation, they should have clear names to define the relation (for example: "Left-side view (all implementation)", "Frontal (GOST 7798,7805, 7806)"). The graphic of the details view should have a name.

The detail should be oriented that the detail's direction (vecDirection of script) should coincide with the OX axis (to the right for the frontal view). 

Dimensions

To set the dimension, take into account:

   1.     Correct recognition;

   2.     Legibility of the drawings;

   3.     Unified system for design documentation requirements.

It is not permitted to place the dimensions inside the hatched area (the hatch is not allowed to flow over the dimension values).

Hatch

Hatch should be executed by the "User defined" type, slope angle 45 degrees. A hatch step should be specified parametrically according to the width of the narrowest hatched part (s):

For example:

1. For thin-wall objects: s/2;

2. For massive objects: s/8;

3. Intermediate step: s/4.

A hatch type can be specified in absolute units divisible by 10 (0.1;1;10;100)

You can ignore these rules if you need to hatch in both sides.

Parameters

Using the "Set parameter" tool, set the parameter for the dimensions. It is possible to switch off the "Work object" checkbox for the dimensional view only.

It is recommended to avoid text formulas in the drawing fields (place the calculations in the script).

Text formulas are allowed to be placed in the drawing, if you need to calculate the parameters of the implementation's view and it is defined that their use is not needed in the script.

Use of non-English letters is only allowed in the names

When specifying the parameter's name take into account:

   1.     Similar names existing in the database

   2.     Parameters names in the GOST

   3.     Meaningful parameters names, corresponding to the syntax of the C language.

If possible, avoid difficult arithmetic expressions set in the dimension parameters (it is recommended to use the Protected variables).

Other requirements

The views names should be specified with text of 10mm height. Text formulas should have the text height of 5 mm. The views names are placed above the view, text formulas are placed below the view.

Specify meaningful names for the blocks in the array in English (for example, hole, chamfer etc.). The insertion point of the blocks, used for creating an axial array, should be placed in the centre of the axial array.

It is possible to add an image of the detail, copied from the GOST, into the drawing field, if it does not cause difficulties in legibility and overlap other objects.

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:

   1.     Valid floating-point number (double analogue in C). Range-1.7e308 .. 1.7e308.

   2.     Line.

   3.     Three-dimensional point (Point)

   4.     Three-dimensional vector (Vector)

   5.     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:

   1.     If the expression is true (not 0), the loop body is executed.

   2.     If the expression is false, then the next while the operator.

   3.     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.

Object versioning support

The object versioning is necessary in order for the new parameters in the updated object to be correctly displayed and used on the previously inserted objects.

The seted protected parameter is used to support the object versioning. The parameter is automatically generated when using the script wizard and can be renamed or added manually if necessary.

Consider the script for creating a rectangle (the script is not complete, only methods relevant for the example are shown):

            ...
 function ActHeader {
            NPart=0;
            Public(a,"Length", b,"Width");
            Protected(seted);
            Changeable(a,b );
            OnDlgBeforeSelectParam = 0;
            ShowWhenSelPnt = 1;
            ContourOnLine = 0;
 };
            ...
 function OnInitialization {
            if(seted == UnknownValue) {
                            seted=1;
                            a = 100;
                            b = 100;
            };
 };
            ...
 function OnDialog {
            UniDialog( VFLD, a,"Length", b,"Width", TVIDS,lViewType,"All",VIEW,"Vids");
 };
            ...
 

The ActHeader method specifies the seted protected parameter and the public length and width parameters.

In the OnInitialization method for an object that has no version, add the length and width parameters and set version 1.

In the OnDialog method, we call a dialog with the width and length fields.

 

Let's insert an object (hereinafter Object1). When placing an object on a drawing, a window with default parameters will open.

CAD software DEVELOPER'S GUIDE DATABASE 25

 

Suppose we need to add line thickness for the rectangle.

To do this, we add the "weight" parameter:

            ...            
 Public(a,"Length", b,"Width", weight, "Weight");
            ...
 function OnInitialization {
            if(seted == UnknownValue) {
                            seted=1;
                            rZOrder=100;
                            a = 100;
                            b = 100;
                            weight=1;
            };
 };
            ...
 function OnDialog {
            UniDialog( VFLD, a,"Length", b,"Width",weight,"Weight"  TVIDS,lViewType,"All",VIEW,"Vids");
 };
            ...                                                           
                                                                          

 

Let's insert an object (hereinafter Object2). The dialog correctly displayed the line weight to us.

CAD drawing DEVELOPER'S GUIDE DATABASE 26

 

Let's open Object1 for editing and see that the "Weight" parameter is displayed incorrectly.

CAD drafting DEVELOPER'S GUIDE DATABASE 27

The point is that Object1 already has version (seted) 1 and the weight is not assigned.

Let's fix the OnInitialization method. If there is no version, we will increase it to 2, add a condition if we have version 1.

 function OnInitialization {
            if(seted == UnknownValue) {
                            seted=2;
                            rZOrder=100;
                            a = 100;
                            b = 100;
                            weight=1;
            };
            if(seted == 1) {
                            seted=2;
                            weight=1;
            };
 };
 

Now objects of older versions will open correctly.

CAD software DEVELOPER'S GUIDE DATABASE 28

Appendix

Appendix 1. A list of keywords and reserved variables

SVersion=2;

The first line of the script, which determines the version of the interpreter

strTheType

Object type

strTheName

Object Name

strTheSubType

Subtype object

pntOrigin

Insertion point

vecDirection

Vector insertion direction

VecPlane

Orthogonal vector to vecDirection

Scl

Object Zoom

rZOrder

Ranking (used for overlap)

strDesignName

Execution system name

rXcoord

Relative abscissa cursor with dynamic selection of the parameters

rYcoord

Relative ordinate cursor with dynamic selection of the parameters

VecCoord

Mostly available in OnSelectParam

VecCoord: X - X coordinate of the relative

VecCoord: Y - Y coordinate of the relative

pntGrip#

(# Number) point pens with the number #

rPart

Serial number of the request.

rKbd

Flag keyboard input. Equal to 1 if the value is entered from the keyboard.

strPartName

Name of detail in the specification (section name)

strPartDescription

Part description in the specification (section designation)

strPromt

Help line (in the dynamic selection or when selecting items for a connection)

NSelect

The number of requests when inserting objects.

NPart

Number of selectable parameters if 0 or undefined then simply called dialogue.

BreakCur

End the current dynamic parameter selection

BreakAll

Complete the entire cycle of selection of dynamic parameters

NoVectorSelect

Does not indicate the vector inserts (used at a connection)

Handled

Result processing facility

NGrip

Number of Handles

NMovingGrip

Phone editable pens

lSimpleView

Variable specifies the type of species, UniDialog created and installed automatically.

If == 1 - a simplified view.

If == 2 - sectional view

scaleDisable

If this parameter is set to 1 in UniDialog prohibits the changing Scale

ShowWhenSelPnt

If this box is checked, the object will be drawn at the time of insertion, if not specified, it is enabled by default

ContourOnLine

Generation circuit is not drawing from a script, and on the fly after drawing

IsAHole

The object is a hole (Embedded object)

OnDlgBeforeSelectParam

Call dialogue before calling OnSelectParam.

IsACalculator

Is set equal to 1 for the calculations

No3dViews

Disables automatic views

AutoShift

 Automatic pseudo-pressing of the Shift button

UseOnlyZOrder

Used only for crossing rZOrder, do not use Z-coordinate

fUseCommonScale

Maintain external control scale

MINPOSSIBLEVALUE

The minimum acceptable value for the application

NotStdBody

If == 1, then the item is placed in the component catalog

SpecPartition

Unit specifications, which gets the item

UnknownVal=nknownValue=-0,12345

The value assigned to the default variable. If the variable is not defined, it is assigned a value.

Filter List function SelectInCache:

      ·    "kAsk" - Ask the user.

      ·    "kFirst" - Find the first value in the table that satisfies a specified condition.

      ·    "kLast" - Find FOLLOWING value in the table that satisfies a specified condition.

      ·    "kFilter" - all the values from the table that satisfy the specified condition.

      ·    "kAskIfNeed" - Ask user if the selection was not successful.

Values that the variable can Handled:

      ·    OBJ_UNHANDLED - Dependencies are not processed.

      ·    OBJ_HANDLED - Dependencies processed

      ·    OBJ_WAITMORE - Waiting for Input

      ·    OBJ_WAITMORE_M

      ·    OBJ_WARNING- Error installing dependencies. When returning this code, the parent object will seek to establish the same parameters as that of the child, and then update the child object is repeated.

      ·    OBJ_ERROR

Constants for the variable type lViewType

      ·    VFRONT - Front view

      ·    VLEFT - Top view

      ·    VRIGHT - Bottom View

      ·    VTOP - Left View

      ·    VBOTTOM - Right Side View

      ·    VBACK - Rear View

Types depending

      ·    INSERT - Insert

      ·    MATE - Combination by plane

      ·    AXIS - Combining axis

      ·    DIRECTION - Combining the direction

      ·    ANGLE - The angular dependence

Subtypes depending

      ·    CODIRECT - co-directional dependence

      ·    CONTRDIRECT - contra dependence

Recurrence dialog codes or function MessageBox:

      ·    IDOK

      ·    IDCANCEL

      ·    IDYES

      ·    IDNO

Codes for the function MessageBox:

      ·    MB_YESNO

      ·    MB_OKCANCEL

      ·    MB_OK

      ·    MB_ICONINFORMATION

      ·    MB_ICONQUESTION

      ·    MB_ICONERROR

      ·    MB_ICONWARNING

Example:

 MessageBox("Test");
 if(IDYES == MessageBox("Yes or No", MB_YESNO, MB_ICONQUESTION)){
     ...
 }
 
 

Appendix 2. Built-in functions

Mathematic functions to work with the surfaces

Function

Comment

sin(alfa) cos(alfa) tg(alfa)

Trigonometric functions.

alfa - angle in degrees

Returns a real number

asin(c) acos(c) atg(c)

Arc-trigonometric functions.

c - number

Returns an angle in degrees.

DegToRad(deg)

Function converts degrees to radians.

deg - angle in degrees

RadToDeg(rad)

Function converts radians to degrees.

rad - angle in radians

int(value)

Function rounds a real value to integer

value - real number

abs(value)

Function gets the modulus of the number

sqrt(value)

Functions returns the square root of the number

min(a,b) max(a,b)

Function returns maximum and minimum numbers from a and b

iff(expr, a, b)

Function is analogue of the if arithmetic operator.

Returns a, if the result of the expression expr >= 1, b otherwise.

VecLen(vec)

Function returns the length of the vec vector.

VecUnit(vec)

Function gets the normal vector (of unit length) from the vec.

VecCodirect(vec1,vec2)

Function checks if the vec1 and the vec2 are codirectional. Returns 1 if the vec1 and the vec2 are codirectional, 0 otherwise.

anglePi(vec1, vec2)

Function returns the angle between the vec1 and vec2 in the interval from0 to PI.

angleTwoPi(vec1,vec2)

Function returns the angle between the vec1 and vec2  in the interval from0 to 2*PI.

Point() Point(x, y, z) Point(plane)

Function returns a point. Can be used as a point constructor. If it is without arguments, it returns the P(0,0,0) point. If the argument is a plane, it returns a base point.

Vector() Vector(x, y, z) Vector(plane)

Function returns a vector. Can be used as a vector constructor. If it is without arguments, it returns the V(1,0,0) vector. If the argument is a plane, it returns a normal.

Plane(pntBase,vecNormal)

Function is a constructor of the plane. Returns the plane containing the pntBase point and having the vecNormal normal.

getPerp(vec)

Function returns a vector, orthogonal to the vec vector.

rotateBy(vec1,rAngle,vecNormal)

Function rotates the vec1 vector by the rAngle angle (in degrees) in the plane, having the vecNormal normal. Returns the result of the operation.

getPerpendicular(pnt1,pnt2,pntFrom,pntBase)

Function returns the length of the perpendicular from the pntFrom point to the line, specified between the pnt1 and the pnt2 points. In the pntBase variable, the point of the perpendicular base on the specified line is returned.

getMiddle(pnt1, pnt2)

Function returns a point in the middle of the line, specified by the pnt1 and pnt2 points.

 getLinesIntersect(pnt1,vec1,pnt2,vec2)
 getLinesIntersect(pnt11,pnt12,pnt21,pnt22)
     

Function returns a point of intersection of the lines, specified by the pairs of the points: [pnt11, pnt12] and [pnt21, pnt22] or by a point and a vector: [pnt1, vec1] and [pnt2, vec2].

if the lines do not intersect, the Z coordinate is -1 in the returned point.

getLocalNormal(vec1,vec2)

Function returns a vector product of the vec1 vector and the vec2.vector.

 projectOnPlane(pnt,plane2,rDistance)
 projectOnPlane(plane1,plane2,rDistance)
     

Function returns a projection of the pnt point in the plane, placed in the rDistance distance from the plane2 plane.

If the plane is a first argument, the function returns the plane through the Point (plane1) point projection on the plane, placed in the rDistance from the plane2 plane and having a normal vector, coinciding with the normal vector of the plane2 plane.

Subtraction of the point from the plane

Example:

d = WP - pnt;

Operation returns the distance of pnt point from the WP plane. If point pnt is on side where normal of WP plane points, direction is positive, negative otherwise.

Formation of the string by the numbers

To the string variable you can add a number. The result is a string.

Example:

 A = 1;         
 B = 5;        
 Str = "Type " + A + ". Modification " + B + ".";
      

The result is a string

"Type 1. Modification 5."

FmtText(text, number, formated_text,...,)

Returns an rtf text, if among the parameters there is even one formatted, ordinary otherwise.

Various numbers of the parameters can be a result of the function. Expressions can be used as parameters.

FmtSuper(Text); FmtSub(Text);

FmtSuper() - returns an rtf text, formatted as the Superscript (upper index) FmtSub() - for the Subscript (lower index).

Text can be a string or a number.

FmtDiv(Text1, Tex2, Splash)

FmtDiv() - returns a fraction,

if Splash != 0  the fraction will have a divisor.

Example of use:

a = "super"; b= 1; c = 3; strPosition = FmtText(         "beginning of the text",         "Upper index-", FmtSuper(a),         "Lower index-", FmtSub("sub"),         " Text",         "Frection- ",FmtDiv(b, c, TRUE),         "fraction without a divisor-",FmtDiv(b, c, FALSE) );

FmtDigit(rNumber, rDelimeter)

Returns a string, formatted by a decimal symbol.

rNumber - number or string, containing a number,

if the rDelimeter == 0  the divisor is a point,

if the rDelimeter == 1 the divisor is a comma,

if the rDelimeter == 2 the divisor is taken from the system local.

Example:

 a = 1.5;
 Formatted = FmtDigit(a, 1)
      

As a result the Formatted = "1,5"

Functions to process surfaces

Function

Comment

GetNearestPlane(pnt)

Function returns the name of the nearest plane to the pnt point of the selected object.

pnt - variable of the  Point type.

Example:

 function OnConnect{
  if(obj.strTheType == "StdJointParts"){
   // ...
  } else {
   strName = GetNearestPlane(pntOrigin);
   if(strName != UnknownValue){
    SetGeomConstraint(INSERT, CODIRECT, obj, WP1, strName, 0);
    NoVectorSelect = 1;
    Handled = OBJ_HANDLED;
   }
  }
 }
       

 //variant 1
 findNearest(
     pnt,
     Name1,
     Name2,
      ... ,
     NameN
 )
 //variant 2
 findNearest(
     pnt,
     arrName,
     arrIndexStart,
     arrSize
 )                        
     

Returns an index of the nearest point or plane according to the parameters types, specified with the Name1, ... NameN or arrName  names.

Function supports two types of call:

1) the particular names of the public parameters are specified as arguments

2) the array of the public parameters with the starting index for searching and calculating a number of the array elements, is specified as the arguments

pnt - variable of the Point type.

Name1, NameN, arrName - names of the public parameters of the selected object

arrIndexStart - starting index for searching in the array

arrSize - array size

Example:

 //variant 1
     rNearest = findNearest(pntOrigin, obj.WP1, obj.WP11, obj.WP21);
     // rNearest takes 0, 1 or 2 values
 //variant 2
     rNearest = findNearest(pntOrigin, obj.WP, 1, 4);
     // rNearest takes 1, 2, 3 or 4 values                                      
                                           

 //variant 1
 nearestPlaneName(
     pnt,
     Name1,
     Name2,
      ... ,
     NameN
 )
 //variant 2
 nearestPlaneName(
     pnt,
     arrName,
     arrIndexStart,
     arrSize
 )                        
    

Returns an index of the nearest point or plane according to the parameters types, specified with the Name1, ... NameN or arrName  names.

Function supports two types of activation:

1) the particular names of the public parameters are specified as arguments

2) the array of the public parameters with the starting index for searching and calculating a number of the array elements, is specified as the arguments

pnt - variable of the Point type.

Name1, NameN, arrName - names of the public parameters of the selected object

arrIndexStart - starting index for searching in the array

arrSize - array size.

Example:

 //variant 1
     strNearest = nearestPlaneName(pntOrigin, obj.WP1, obj.WP11, obj.WP21);
     // strNearest takes "obj.WP1", "obj.WP11" or "obj.WP21" values
 //variant 2
     strNearest = nearestPlaneName(pntOrigin, obj.WP, 1, 4);
     // strNearest takes "obj.WP1", "obj.WP2", "obj.WP3" or "obj.WP4" values
    

restoreBasis(vecOld, vecNormal, vecNew);

Function converts an old basis according to the new position of the vector.

Following combinations are applied in the next order:

(x, y, z, newX)

(y, z, x, newY)

(z, x, y, newZ) vRrev - previous vNext in the XYZ

MakeVectorsFromView(lViewType, vecDirection, vecPlane);

Sets the position of the vectors from the view type

Example:

MakeVectorsFromView(VTOP, vecDirection, vecPlane);

setBasePlaneForSelect(planeName, vecPlane = vecPlane);

Sets a plane coordinate system, where the SelectParam will work, i.e. the rXcoord, rYcoord will depend on this system.

Applying. When selecting non-symmetrical details whose selection direction depends on the fixed plane and the distance is calculated from any plane; for example, the standard ends of the arbors, not from the pntOrigin.

Example:

setBasePlaneForSelect(WP1);

Used for connecting the ends of the arbors.

Functions for working with tables

Loading a table from the database to Cache

LoadInCache(name1, name2, ... , nameN)

Loads the selected fields from the table.

Function has various numbers of arguments.

name1, ... , nameN - names of the table parameters.

Example:

 LoadInCache(D);
 LoadInCache(dr, dH);
   

Selection from the table

 SelectInCache(strFilterKey, strParamName, strOperation, Value
  ... ,
  strFilterKeyN, strParamNameN, strOperationN, ValueN)
   

Executes selection from the object's table  cache. Various numbers of arguments.

strFilterKey - key of filtration - string, taking the following values:

"kFirst" - select the first from the values, satisfying the filtration condition

"kLast" - select the last from the values, satisfying the filtration condition

"kFilter" - select  the range of the values

"kAsk" - ask user (activates the dialog for manual selection of the value)

"kAskIfNeed" - ask user if automatic selection cannot be preformed

strParamName -name of the table parameter - string, containing the name of the table parameter, on which selection is made.

strOperation - operation of filtration - string that can take values :

"=" - equals

">=" - more or equals

"<=" - less or equals

"~" - approximately equals

">" - more

"<" - less

"+" - calculation of the expression

Example:

 LoadInCache(dr, L);
 SelectInCache("kFirst", "dr", "~", 14, "L", ">=", 100);
 
 LoadInCache(dr, L, b);
 SelectInCache("kFirst", "dr", "~", rdr, "L", "r;+", "L>=rMinLen && L<=rMaxLen && (L-b<=rTrLen)");
 

Dialogs of the database objects

UniDialog function

 UniDialog (
     [DBFLD, D, Dn, ... ,]
     [DBINF, Number,Seria,...,]
     [VFLD, rA, "A", rB, "B", ... ,]
     [BFLD, bKey1, "Key1", bKey2, "Key2",... ,]
     [RADIO, rKey1, "Version1", "Version2", ... ,]
     [VIDS, strDesignName, "Design1","Design2", ... ,]
     [TVIDS, lVidType, {"F", "T", "R", "L", "All"},]
     [VIEW, {"Vids", "Hdr", "None"}]
 )                        
                           

The function activates the dialog to edit the standard object from the database. The function returns the IDOK, if the OK button was pressed, and the IDCANCEL, if the Cancel button was pressed.

[ ] - for optional parameters

DBFLD - keyword, after which the table's parameters are listed.

D,Dn, ... - names of the table parameters.

CAD drawing DEVELOPER'S GUIDE DATABASE 29

VFLD- keyword, after which the object's parameters are listed, announced in the Public or Protected sections.

rA,rB, ... - names of parameters with the comments.

CAD drafting DEVELOPER'S GUIDE DATABASE 30

BFLD - keyword, after which the checkboxes are listed - variables, taking only 1 (CHKD) and 0 (UNCHKD).

bKey1, "Key1",bKey2, "Key2" - names of the variables with names of the checkboxes.

A block of the parameters, starting form the BFLD keyword, is a list of the dialog's components, which are standard CheckBox(es) and has two modes: Checked and Unchecked. The parameter-variable, going after the BFLD, according to the checkbox mode takes 1 for Checked and 0 for Unchecked values. Such checkboxes are used for describing the properties of the standard objects in the application.

CAD software DEVELOPER'S GUIDE DATABASE 31

RADIO - keyboard, after which the group checkboxes are listed - variables, taking discrete integer values.

rKey1, "Variant 1", "Variant 2", ... - names of the variables of the group checkboxes with names of selection variants.

CAD drawing DEVELOPER'S GUIDE DATABASE 32

A block of the parameters, starting from the RADIO keywords, is a list of the dialog's components, which are standard drop-down lists with the permanent number of the unchanged strings. The parameter-variable, going after the RADIO, takes the index values of the selected string in the ComboBox. The top string has 0 index, the last is a subtraction of the number of strings and 1. Such checkboxes are used to select a material for the standard object in the application.

For the described example, the bCommon parameter takes 0 or 1 integer values, and the rd1 parameter takes 0, 1 or 2 values.

Parameters for the BFLD and RADIO can be described in the Public and Protected sections. Before activating the dialog, such parameters should be initialized (usually in the OnInitialization).

VIDS- keyword, after which all an object's implementations are listed.

strDesignName, "Design1", "Design2" - variable's name, storing the name of the object's implementation with the available implementations' names.

TVIDS- keyword, after which the object's views are listed.

lViewType- variable, storing the name of the object's view and taking values from the multitude {VFRONT, VRIGHT, VLEFT, VTOP, VBOTTOM,VBACK}.

"F" - view name "Frontal".

"R" - view name "Right-side view".

"L" - view name "Left-side view".

"T" - view name "Plane view".

"B" - view name "Bottom view".

"All" -names of all views.

VIEW - keyword, after which the slide's type goes from the multitude {"Vids", "Hdr", "None"}.

"Vids" - implementation's slides of the object

"Hdr" - slide of the object's header (Header)

"None" - there are no slides

Examples:

 LoadInCache(dr);
 UniDialog (
     DBFLD, dr,
     VFLD,
     Lthread, "thread length",
     Lhole, "hole length",
     d_hole, "hole diameter",
     VIDS, strDesignName, "All",
     TVIDS, lViewType,"All",
     VIEW, "Vids"
 );
 LoadInCache(Dn);
 UniDialog (
     DBFLD, Dn,
     BFLD, bCommon, "General purpose",
     RADIO, rd1, "Aluminium alloy", "45 steel", "Bronze",
     VIDS, strDesignName, "All",
     TVIDS, lViewType, "All",
     VIEW, "Vids"
 );
                           

Custom forms

ShowForm("FormName");

Activates the object's form with the FormName name.

MessageBox function

MessageBox(StrMessage[,mb_Buttons = MB_OK, mb_Icons])

The function activates the standard Windows pop-up message.

StrMessage - message string

mb_Buttons - parameter, defining the buttons in the MessageBox.

Can take one of the following values:

MB_OK - only OK button

MB_OKCANCEL - OK/Cancel buttons

MB_YESNO - Yes/No buttons

mb_Icons - parameter, defining the icons in the MessageBox.

Can take one of the following values:

MB_ICONWARNING - warning

MB_ICONINFORMATION - information message

MB_ICONERROR - error

MB_ICONQUESTION - question

The function returns the following values according to which button is pressed:

IDOK - OK button was pressed

IDCANCEL - Cancel button was pressed

IDYES - Yes button was pressed

IDNO - No button was pressed

Example:

MessageBox("Connection error!", MB_OK, MB_ICONERROR);

Message in the notifier

ShowMessage("Text"[, npIcon, objectID]);

Shows the notification message with the specified Text text.

npIcon can take the following values:

npSimple == -1, // without icon

npUsual == 0, // "page"

npWarning == 1, // " exclamation mark "

npCure == 2, // "cross"

npHint == 3, // "lamp"

npError == 4 //error

If the objectID was specified, the message with the button for editing the object is specified as the objecteID.

Note:

Message with the  objectID cannot be sent during the insertion process or the dialog activation.

The setting "Show pop-up messages" does not affect the messages with the npError key.

ShowValue function

ShowValue(StrMessage,Value);

The function shows the values of the transferred (value) parameter as an argument, with the strMessage string to the window of the special debugger - InDebMon.exe. Any parameter or variable can be used as a value.

Example:

 ShowValue("pntOrigin", pntOrigin);
 ShowValue("vecDirection", vecDirection);
 ShowValue("WorkPlane WP1", WP1);
 ShowValue("Dn", Dn);
 ShowValue("*****************", 1);
 ShowValue("OnConnect Start", 1);
    

Functions to work with dependences

Function

Comment

ResetAllConstraint(idFrom = NULL)

Switches off the dependences, set in the last OnConnect, when the insertion of the object with the selection of several objects is used.

idFrom - object identifier, from which the dependences should be switched off. By default it equals NULL; in this case, all dependencies from all objects are switched off.

 SetParamConstraint(        
  Parameter,        
  idFrom,        
  TYPE,        
  expr,        
  bBidirect = FALSE,         
  idTo = objectID

Sets the parametric dependence.

Parameter - parameter name

idFrom - object identifier from which the dependence starts

TYPE - the type of parametric dependence (EXPR is only used)

expr - expression, setting the parameter of the connected object

bBidirect - checkbox, TRUE - two-sided dependence,

FALSE (by default) - one-sided dependence.

idTo - object identifier to which the dependence is set

(By default is objectID - identifier of the current object)

Example:

SetParamConstraint(rDn, obj, EXPR, "obj.rDnE2", TRUE); SetParamConstraint(LTPlug, obj, EXPR, "obj.rLT");

 SetGeomConstraint(        
  TYPE,        
  SUBTYPE,        
  IdFrom,        
  PlaneTo,        
  PlaneFrom,        
  expr,        
  bBidirect = FALSE,         
  idTo = objectID );

Sets the parametric dependence.

TYPE - type of the geometric dependence. Can take the following values:

INSERT - Insertion

MATE - Coincidence by plane

AXIS - Coincidence by axis

DIRECTION - Coincidence by direction (angular dependence)

SUBTYPE - Dependence subtype. Can take two values:

CODIRECT - codirectional dependence

CONTRDIRECT - opposite directional dependence

idFrom - object identifier, from which the dependence is set.

PlaneTo - plane of the inserted object.

PlaneFrom - plane of the connected object.

expr - expression, setting the dependence parameter (for insert the INSERT - distance between planes)

bBidirect - checkbox, TRUE - two-sided dependence,

FALSE (by default) - one-sided dependence.

idTo - object identifier, to which the dependence is set

(by default equals the objectID - the identifier of the current object)

Example:

SetGeomConstraint(INSERT, CODIRECT, obj, WP1, obj.WP2, 0);

IsFixedParam(Parameter, bOnlyFixed =FALSE)

Function as used in the OnChangeParameters event handler.

Checks if the dependence for the parameter was set and if the parameter was changed, if the bOnlyFixed is TRUE.

Activation by default (from FALSE) is recommended when checking the parameters of objects with permanent geometry (screw). In this case, the function returns 1 if the  parameter is connected by the dependence and changed its value; and 0 otherwise. Activation (from TRUE) is recommended for objects with changing geometry (tubes, barrels); the function returns 1 if the parameter is connected by the dependence.

Example:

if (IsFixedParam(WP1, TRUE)) {     pntOrigin = Point(new.WP1);     vecDirection = Vector(new.WP1); }

Function - event handlers, activated by the base of the application

Function

Comment

ActHeader

Description of the object, list of the parameters, setting checkboxes.

Activated every time the object is opened.

OnInitialization

Initialization of the object.

Activated every time the object is called up.

BeforeConnect

Execution of the previous actions before the selection of the objects during the insertion.

Activated upon insertion of the object.

OnConnect

Setting of the dependences when connecting to other objects.

Activated upon insertion of the object.

OnChangeParameters

Setting of new values for the object parameters by another object.

Activated when connected by the dependences, the parameters are changed.

OnDialog

Editing the object parameters.

Activated when the dialog opens.

OnMakeParameters

Final preparation of all parameters.

Activated before closing the object.

SetGripPoint

Preparing the grip-points.

Activated when the object is selected.

OnMoveGripPoint

Reaction to changing the grip-points position.

Activated whengrip-points are moved.

OnAddObject

Setting of the inverse dependences to the connected objects.

Activated when insertion with selection of another object is executed.

OnDialogChanged

Interactive process of the input values.

Activated every time the object parameters are changed in the dialog.

OnInitSelect

Initialization of the prompt string and pop-up menu.

Activated before every step of the dynamical selection cycle of the parameters.

OnSelectParam

Process of the values input from the keyboard or mouse.

Activated in the body of the of dynamical selection cycle of the parameters. Align values by grid.

OnMenu

Menu handler.

Activated after the menu item is selected, created by the SetMenu function.

Function for working with objects’ identifiers

Function

Comment

setWorkId(index, id)

Saves the selected identifier in the special storage with the specified index.

index - integer value (index >= 0).

id - object identifier.

Every object of the application, when created, gets a unique identifier like GUID in Windows. To get access to the Obj1 identifier of the object in the script use the Obj1.objectID expression.

Example:

       
 id1 = getWorkId(0);        
 id2 = getWorkId(1);        
 If (id1 == id2) MessageBox("Attempt to connect to one object two times!", MB_OK | MB_ICONWARNING);
      

getWorkId(index);

Returns the saved identifier.

index - integer value (index >= 0).

Example:

 if (obj.strTheName == "MyEnabledObject") {
     setWorkId(0,obj.objectID);
 }
                                           

getObjData(WorkId,ObjName)

Function gets the public-parameters of the object, having the ididentifier from the database.In the case of successful execution it returns 1, otherwise 0. To access the received parameters, use the ObjName.Param1 expression etc.

getObjectConnectedTo(idOut, objToSerch, strExpression, ParamName);

Searches the objects, connected with the dependence, with the ParamName variable of the objToSerch object, satisfying the strExpression condition.

Condition can be null.

Other functions

setGlobalParam(var, val);

Sets the global var variable in the  val value.

Example:

  if(rLen2 <= B/4){
     SetGeomConstraint(INSERT, CODIRECT, obj, WP1, obj.WP2, 0);
     setGlobalParam(rSubType, CONTRDIRECT);
 } else if(abs(rLen1) <= B/4) {
     SetGeomConstraint(INSERT, CODIRECT, obj, WP1, obj.WP1, 0);
     setGlobalParam(rSubType, CODIRECT);
     } else {
         SetGeomConstraint(INSERT, rSubType, obj, WP1, obj.WP1, rLen1);
 };

GridRound(b)

Align the values by grid. The parameter of the grid is specified in the parameters or in prompt parameters (Ctrl+Shft+Q by default);

Example:

a = GridRound(b);

If the grid step is 5 and, b ==12.4, the function returns 10; If the b >= 12.5 function returns 15.

rDiameter = GridRound(abs(rYcoord*2));

paramByName(strName)

Returns the parameter value by its name:

Example:

strName = GetNearestPlane(obj); plane = paramByName(strName);

getChildrenCount()

Returns the number of child objects

getChildId(nChild);

Returns the identifier of the nChild child object.

Appendix 3. Object Classes

For some types of objects in the database has its own class reserved:

Number

Icon

Description

200

CAD drafting DEVELOPER'S GUIDE DATABASE 33

Default object. By default, when creating a new object, class 200 is assigned. The developer can assign his own class to created objects. All classes of objects, except for the ones described below, will have the same icon.

600

CAD software DEVELOPER'S GUIDE DATABASE 34

Blueprints. All object classes from 600 to 650, except for the ones described below, will have the same icon.

601

CAD drawing DEVELOPER'S GUIDE DATABASE 35

Tables, specifications

630

CAD drafting DEVELOPER'S GUIDE DATABASE 36

System object

631

CAD software DEVELOPER'S GUIDE DATABASE 37

Collection

632

CAD drawing DEVELOPER'S GUIDE DATABASE 38

Object project construction site

633

CAD drafting DEVELOPER'S GUIDE DATABASE 39

Object - building site signs

634

CAD software DEVELOPER'S GUIDE DATABASE 40

Master of Engineering

645

CAD drawing DEVELOPER'S GUIDE DATABASE 41

Batch file, when clicked, the command stored in the comment is sent

646

CAD drafting DEVELOPER'S GUIDE DATABASE 42

Bolted, riveted connections

647

CAD software DEVELOPER'S GUIDE DATABASE 43

Callouts

648

CAD drawing DEVELOPER'S GUIDE DATABASE 44

Markers

649

CAD drafting DEVELOPER'S GUIDE DATABASE 45

Templates

650

CAD software DEVELOPER'S GUIDE DATABASE 46

Object groups

670

CAD drawing DEVELOPER'S GUIDE DATABASE 47

Window

671

CAD drafting DEVELOPER'S GUIDE DATABASE 48

Wall

672

CAD software DEVELOPER'S GUIDE DATABASE 49

Wall modifier

673

CAD drawing DEVELOPER'S GUIDE DATABASE 50

Wall object

674

CAD drafting DEVELOPER'S GUIDE DATABASE 51

Architecture object

675

CAD software DEVELOPER'S GUIDE DATABASE 52

Column

676

CAD drawing DEVELOPER'S GUIDE DATABASE 53

Opening

680

CAD drafting DEVELOPER'S GUIDE DATABASE 54

Door

750

CAD software DEVELOPER'S GUIDE DATABASE 55

Piles

751

CAD drawing DEVELOPER'S GUIDE DATABASE 56

Additional crane objects

752

CAD drafting DEVELOPER'S GUIDE DATABASE 57

Load chart

806

CAD software DEVELOPER'S GUIDE DATABASE 58

Formats

807

CAD drawing DEVELOPER'S GUIDE DATABASE 59

Stamps

809

CAD drafting DEVELOPER'S GUIDE DATABASE 60

Cover Sheet and Cover Templates

820

CAD software DEVELOPER'S GUIDE DATABASE 61

Connectors

821

CAD drawing DEVELOPER'S GUIDE DATABASE 62

Track

822

CAD drafting DEVELOPER'S GUIDE DATABASE 63

Equipment with connectors

Line Type nanoCAD Mechanica

nanoCAD Mechanica It operates nine types of lines:

Title

Type in the platform

1

Solid thick main line

Solid

2

The solid thin line

Solid

3

The wavy line

GOST 2.303 3

4

Dashed thin (axial) line

GOST 2.303 5

5

Cross-hatching line

GOST 2.303 4

6

The dashed line is thickened

GOST 2.303 6

7

Open line

Solid

8

Continuous thin line kinked

GOST 2.303 8

9

Dashed with two dots thin line

GOST 2.303 9

Each line corresponds to its number in nanoCAD Mechanica.

Adjust the color and thickness of lines made "Settings - General settings - LineType".

Examples

Object - centre holes GOST 14034-74

 SVersion = 2; // The first line of the script determines the version of the interpreter
 // Description. It will be displayed in the Properties pane
 // You can also sort the objects in the field
 // Tabular data and mcqs
 ObjectDescription = "center hole";
 
 // This is the function description of the object
 function ActHeader {
   NPart = 2; // The number of requests to a dynamic selection of parameters
 
   // This section contains descriptions of the parameters open object
   // Visible to other objects
   Public (
     // Define the parameter size hole - the diameter
     d, "diameter",
   
     // Plane to install, depending on the shaft end
     WP1, "the beginning of the plane"
   
     rValType, "Shaft Type" // Type of shaft, which connect the hole
               // Set for overlap on
               // Kinds and with a cut without cutting
   
     Lhole, "The depth of the holes," // This is the total hole depth
     Lthread, "Thread length" parameter // length thread
     // Parameters specific performances
     DF, "shaft diameter to form F",
     DH, "The diameter of the shaft to form H"
   );
   // Private parameters used to plot
   // And calculate the limits of other parameters
   Protected (seted, freeLen, bBlind, rSuppressPointHeight);
 
   // This section lists the parameters of the open,
   // Which will be accessible from the outside for editing
   // This is only classified as specific actions under
   // Changing the parameters of external functions defined in
   // OnChangeParameters
   Changeable (d, WP1, DF, DH, rValType, Lhole, Lthread);
 
   // Show dialog box to insert dynamic selection parameters
   OnDlgBeforeSelectParam = 1;
   // Do not regenerate suppression circuit after insertion
   ContourOnLine = 0;
   // This is the part of the shaft member
   IsAValPart = 1;
   // And a built-in part of the shaft
   InsidePart = 1;
 
   // This element - opening (this variable is used to
   // Dimensioning in Inventor)
   IsAHole = 1;
 };
 
 // Initialize the object parameters
 function OnInitialization {
   // Load the table into the cache
   // Parameters table of the current line in the script is always available
   // Therefore loaded only one parameter d
   LoadInCache (d);
   // Variable seted is the default value UnknownValue
   // As initialized with this value
   // So, if we put the following test, this unit
   // Operators will be executed only once:
   if (seted == UnknownValue) {
     seted = 1; // Set seted 1 to the condition is not fulfilled
        // Again
   
     // Set initial values
     rValType = 1; // The hole is placed on the shaft portion
     rZOrder = 4220; // Ranking - initial value of
   
     // Select from a table initial values
     SelectInCache ("kFirst", "Form", "~", "FH", "d", "~", 10);
     //T.e. according to the syntax of the operator - selected the first record
     // Table where Form parameter is "FH", and a parameter
     // Hole diameter d is approximately equal to 10
   
     // Set, pursuant to which the object will be initially
     // Displays
     strDesignName = "Form F";
   
     // Set the initial value of arbitrary parameters
     Lhole = 30; // The length of the hole
     Lthread = Lhole-d / 2; // This is the minimum possible length of the thread
    
     // The variable that determines whether the hole deaf.
     // Default - blind.
     bBlind = TRUE;
   
     // This variable determines the value of the parameter is relative to
     // Height of the end point of the cone of suppression. (See the drawing)
     rSuppressPointHeight = tg (30) * (d-1.082 * p) / 2;
   };
 };
 
 // Setting function handles
 function SetGripPoint {
   NGrip = 3; // Total 3 pens
 
   pntGrip0 = pntOrigin; // The first - at the insertion point
 
   // The second handle - the handle length of the threaded portion
   pntGrip1 = pntOrigin + vecDirection * Lthread;
 
   // Third handle - handle is the total length of the hole
   pntGrip2 = pntOrigin + vecDirection * Lhole;
 };
 
 
 
 // This function determines the reaction of the object on the movement of the handles
 function OnMoveGripPoint {
 // Here comes the variable NMovingGrip, equal to the index with a slide
 // Handle the numbering of the array starts from zero.
 
   // When editing the first handle just move the item to
   // Where the cursor is with this pen. Ie move the insertion point
   // Where is the first pen
   if (NMovingGrip == 0) {
     pntOrigin = pntGrip0;
   };
 
   // This we stretch the length of the (second pen)
   // This defines the length of the threaded portion, depending on the current
   // Execution of holes
   if (NMovingGrip == 1) {
   
     // Determine the distance stretching as vector length,
     // Defines a point ruchki1 and ruchki0
     rDistance = vecLen (pntGrip1-pntGrip0);
   
     // For the execution (shaped hole) "P"
     if (Form == "P") {
      // The length of the thread should be limited to reduce the amount of
      // (L-d / 2). Obviously, the length parameter thread Lthread
      // Will be set to the relative position of the cursor
      // If it is greater than (L-d / 2).
      Lthread = max (rDistance, L-d / 2);
     };
   
     // For the execution of "F H"
     if (Form == "F H") {
      // The same goes for the execution of the thread length must be
      // Size is bounded below by (l + d / 2).
      Lthread = max (rDistance, l + d / 2);
     };
   
     // Finally, in this condition, we limit the length of the thread
     // On, since the length of the thread can not be more
     // The length of the hole. Therefore, we will pull out all the hole
     // According to the new diameter of the thread.
     if (Lthread > Lhole-d / 2) {
      //T.e. when you change the length greater than the length of the thread holes
      // Set the new length of the holes equal
      // Thread length plus half the diameter
      Lhole = Lthread + d / 2;
     };
   };
 
   // This section examines the movement of the third handle.
   // The result of editing it is increasing the length of the hole,
   // Without affecting the thread.
   if (NMovingGrip == 2) {
   
     // In this case, the current distance is defined as
     // Length of the vector formed by dots and ruchki0 ruchki2
     rDistance = vecLen (pntGrip2-pntGrip0);
   
     // For the execution of "P"
     if (Form == "P") {
      // The length of the hole is limited below the parameter L
      Lhole = max (rDistance, L);
     };
   
     // Dlyaispolneniya "F H"
     if (Form == "F H") {
      // Length of the restricted orifice parameters (l + d)
      Lhole = max (rDistance, l + d);
     };
   
     // If you change the length of the hole is less than the length of the thread
     // Move thread abroad
     if (Lhole > Lthread + d / 2) {
      // That is, if the length of the opening is smaller than Lthread + d / 2,
      // Recalculate the new thread length which is less than
      // Current length of the holes in the d / 2
      Lthread = Lhole-d / 2;
     };
   };
 
 };
 
 // Function of the final calculation of parameters
 function OnMakeParameters {
   // Name, surname and patronymic of the object
   strTheName = "CenterHole"; // Centering Hole
   strTheType = "ArborParts"; // Refers to detail shafts
   strTheSubType = "Simple"; // Type of opening - easy
 
   // Set the position of the plane WP1. It's just a plane
   // The base point at the insertion point and a normal vector,
   // Coincides with the vector direction of insertion
   WP1 = Plane (pntOrigin, vecDirection);
 
   // Realize the overlap for different occasions:
   // If the variable rValType, specifying the type section of the shaft, at the
   // Set that the hole is equal to 1 (this is a simple
   // Portion of the shaft), the order of the overlap is equal to 4220
   // (This number is given on the basis of the values ??of the order of
   // Portions of the shaft, so that the hole overlaps the shaft to its
   // Loop suppression
   if (rValType == 1) rZOrder = 4220;
   // For internal shaft portions and other portions where rValType not equal to 1
   else rZOrder = 2150;
   // The sequence will be different
 
 
   // This parameter constraints are found, depending on the version
   // For the execution of "P", more precisely, for the current record in the table,
   // Form that meets the hole "P".
   if (Form == "P") {
     // Limits the length of the holes parameter L
     Lhole = max (Lhole, L);
     // Limits the length of the thread parameter (Ld / 2)
     Lthread = max (Lthread, L-d / 2);
   
     // Define strDesignName in "Form P"
     //t.e. choose what the two-dimensional design, which corresponds to
     // The current parameters of the table
     strDesignName = "Form P";
   };
 
   // The same goes for the form "F H"
   if (Form == "F H") {
 
     // Limit the parameters of the holes and the length of the thread length
     Lhole = max (Lhole, l + d);
     Lthread = max (Lthread, l + d / 2);
   
     // This reassurance, if it does the user chose
     // Execution "P" in the two-dimensional forms, since the table
     // Exhibited parameter value in Form "FH".
     // In general, if you select the wrong version, the set
     // First correct.
     if (strDesignName == "Form P") {
      strDesignName = "Form F";
     };
   };
 
   // Limiting the length of the thread from the top, depending on the
   // Total length of the hole
   Lthread = min (Lthread, Lhole-d / 2);
 
   // The holes form P always deaf
   if (Form == "P") {bBlind = TRUE;};
 
   // This is to ensure that the correct path is drawn suppression
   // The schedule has a contour suppression, the position of one of the points
   // Which is specified by rSuppressPointHeight
   // So as to whether the user has selected the display
   // Blind or through-hole, set the parameter
   // RSuppressPointHeight desired value
   if (bBlind == TRUE) {// For blind hole
     rSuppressPointHeight = tg (30) * (d-1.082 * p) / 2;
   } Else {// For the through-hole (ie, not from the cone drill)
     rSuppressPointHeight = 0;
   };
 
   // This line simply sets specifications
   // Depending on the version adds the necessary letter
   // To the designated holes.
   if (strDesignName == "Form F") {strLetterForm = "F";};
   if (strDesignName == "FormaH") {strLetterForm = "H";};
   if (strDesignName == "FormaP") {strLetterForm = "P";};
 
   // Parameter strPartName - a string specification holes.
   // In addition, he also displayed hinte.
   strPartName = "Ed. Center." + strLetterForm + "M" + d + "GOST14034-74";
   // Format string automatically, ie
   // When adding a string value with
   // Numerical value is automatically converted to a string
 };
 
 // This function determines the type of dialogue the insertion hole
 function OnDialog {
   // Load the parameters of the cache work table
   LoadInCache (d);
   // Call the dialogue with the key
   UniDialog (
     // This defines the fields of the table hole
     // The shape and diameter. Output as a table defining the parameters
     DBFLD, Form, d,
     // The diameter of the shaft to form F and Form H
     // Output only as reference parameters
     DBINF, DF, DH,
     // Parameters asked randomly (subject to restrictions, of course)
     // Display on the Properties tab
     VFLD,
      Lthread, "thread depth"
      Lhole, "The depth of the hole"
     // Tag blind or through hole
     // Display on the properties tab in the form of a tick
     BFLD,
      bBlind, "Deaf"
     // Choices performances. Displays all performance
     VIDS, strDesignName, "All",
     // Displays all recognized types
     TVIDS, lViewType, "All",
     // Displays preview
     VIEW, "Vids"
   );
 };
 
 // This function is performed before the dynamic selection of the parameters
 function OnInitSelect {
   // This function comes variable rPart - sequence number
   // Prompt you to choose the dynamic parameters. counting begins at 0
   if (rPart == 0) {
     // For the first case indicate the diameter of the thread
     // Output a corresponding hint
     strPromt = "Enter the depth of the thread";
   };
   if (rPart == 1) {
     // For the second case indicates the depth of the hole (it zhe
     // Total length).
     strPromt = "Enter the hole depth";
   };
 };
 
 // This function defines the behavior of the object in the dynamic selection of the parameters
 function OnSelectParam {
   // For the first cycle of selection parameters. In principle, the limitations
   // The same as for the handles.
   // These variables come rXcoord and rYcoord - relative
   // Abscissa and ordinate of the cursor
   if (rPart == 0) {
 
     // Parameter range is determined
     // Module relative abscissa
     rDistance = Abs (rXcoord);
   
     // Limitations on choice of parameters depending on the version
     if (Form == "P") {
      Lthread = max (rDistance, L-d / 2);
     };
     if (Form == "F H") {
      Lthread = max (rDistance, l + d / 2);
     };
     if (Lthread > Lhole-d / 2) {
      Lhole = Lthread + d / 2;
     };
   };
 
   // For the second request
   if (rPart == 1) {
 
     // Parameter distance
     rDistance = Abs (rXcoord);
   
     // Restrictions.
     if (Form == "P") {
      Lhole = max (rDistance, L);
     };
     if (Form == "F H") {
      Lhole = max (rDistance, l + d);
     };
     if (Lhole < Lthread + d / 2) {
  Lhole = Lthread + d / 2;
  };
  };
 };
 
 // This function is performed when the parameters in the dialog insert
 function OnDialogChanged {
 // Function adds interactivity in the form of dialogue.
 // In this case we need to hide execution and daw "deaf"
 
 // Operator ShowDesign hides or displays performance.
 // Depending on the value of the first parameter (1 - Shows
 // 0 - hides.
 // Operator ShowBool ??hides and displays switches (tick)
 
 // For a start, execution and show all daw
 ShowDesign (1 "Form F");
 ShowDesign (1, "Form H");
 ShowDesign (1 "FormaP");
 ShowBool ??(1, "deaf");
 
 // If you choose such a line in the table where d3 is 0,
 // It is necessary to hide the performance of "Form H". (As defined in the guest,
 // That the performance is not used for such values
 // Settings
 if (d3 == 0) ShowDesign (0, "Form H");
 
 // If the selected row corresponding to the shape of the hole "P", then
 // To hide the other two performance (they can not be selected)
 // And daw "blind" because the shape of P is always blind.
 if (Form == "P") {
 ShowDesign (0, "FormaH");
 ShowDesign (0, "FormaF");
 ShowBool ??(0, "deaf");
 };
 
 // But for the chosen form of "FH", you need only to hide
 // Execution "Form F"
 if (Form == "F H") {
 ShowDesign (0, "Form P");
 };
 };
 
 // Function OnChangeParameters performed under external influence
 // Object. It is an attempt to establish a dependence or direct
 // Change the parameters of the object properties panel
 // This function determines the reaction of the object to such a change.
 function OnChangeParameters {
 // Here comes the object new, representing a
 // The same object with the new value of open options.
 
 // Random variable we can immediately assign new values
 rValType = new.rValType;
 Lhole = new.Lhole;
 Lthread = new.Lthread;
 
 // Here consistently given, how to choose a line from the table,
 // The new value of the corresponding parameters.
 // Check whether the changed parameter d
 if (new.d! = d) {// ie. If the new value is not equal to the old
 // Table is loaded into the cache
 LoadInCache (d);
 // And get out of it the first available record with a parameter
 // D, approximately equal to the new value.
 SelectInCache ("kFirst", "d", "~", new.d);
 // Then we check not change any other parameters
 } Else if (DH! = New.DH) {// change the diameter of the shaft H performance
 // Load
 LoadInCache (DH);
 // Select the first record
 SelectInCache ("kFirst", "DH", "~", new.DH);
 } Else if (DF! = New.DF) {// change the diameter of the shaft version F
 // Load
 LoadInCache (DF);
 // Select the first entry with an approximately equal value
 SelectInCache ("kFirst", "DF", "~", new.DF);
 };
 
 // Default processing completed successfully.
 //T.e. send the object to change the parameters that
 // Set the necessary parameters.
 // To do this, we assign the value of the variable Handled OBJ_HANDLED
 Handled = OBJ_HANDLED;
 
 // If after selecting from the table the shaft diameter is not established
 // The new value, it may require the cyclical update
 // Send a variable object variable
 // Handled equal OBJ_WARNING
 if (d! = new.d) {
 Handled = OBJ_WARNING;
 };
 
 // In this block operators recalculated the new position of the object
 // When you change its work plane
 
 // Variable fix to test the ability to move.
 // In general, in this case it could not be used
 // Because the hole does not change when you change its geometry
 // Planes.
 // This block is generated script wizard, so it has
 // This unified view
 
 fix = 0;
 
 // Check if the dependency has changed and whether the
 // PloskostWP1
 if (IsFixedParam (WP1)) {
 // Increase the value of the variable fix, for the follow-up audit
 fix = fix + 1;
 // Save the old value of the vector insertion.
 vecXOld = vecDirection;
 // Assign new value to the vector inserts match
 // To the new position of the plane WP1
 vecDirection = Vector (new.WP1);
 // And move the insertion point to a new position openings
 // PloskostiWP1
 pntOrigin = Point (new.WP1);
 
 // Restore the coordinate system on the basis of
 // Old and new values ??of the vectors
 restoreBasis (vecXOld, vecPlane, vecDirection);
 };
 // If all of a sudden hole with fixed geometry
 // Objects begin to stretch in different directions, then
 // Return an error
 if (fix > 1) {
     Handled = OBJ_ERROR;
   };
 };
 
 // This function is performed before each attempt to establish a relationship
 function BeforeConnect {
   // Here we just reset according to the latest
   // The following function to establish new
   ResetLastConstraint ();
 }
 
 // This function sets dependency. More specifically,
 // It determines exactly how to behave when an object
 // Accession to another object
 function OnConnect {
   // Check for the value of the variable rPart, defining
   // The sequence number of the request to join the parts.
   //T.e. if the relationship is set in two stages,
   // Or more, it is possible to install one piece
   // Depending on two or more parts.
   // But in this particular case, depending on established only
   // From one piece, so only one request and verification
   // RPart equal to 0
   if (rPart == 0) {
     // The function comes onConnect object obj - this is a detail,
     // To which we are trying to join. We can help qualifier
     // Access to the parameters of the parts to check whether
     // Automatically install dependencies or not.
   
     // Check whether the part to which are trying to join,
     // Shaft:
     if (obj.strTheType == "Arbor") {
     
      // Next - will set depending on the current execution
      // Holes. Ie different versions is implemented differently depending on the shaft.
      if (Form == "F H") {
      
        // Set for the opening of the shaft of the same type as that of the
        // Section of the shaft, which join (this is necessary for the implementation of
        // Overlap
        rValType = obj.rValType;
      
        // Find the nearest plane to the plane of the opening WP1:
        strNearestPlane = nearestPlaneName (WP1, obj.WP1, obj.WP2);
        // This takes into account only the plane WP1 and WP2 object
        //t.e. if these are not the nearest plane, strNearestPlane
        // Is uncertain.
      
        // Further - check the shaft type. for common areas (external):
        if (obj.rValType! = 1)
          // Set the geometric relationship
          // Type "insert" codirectional. By the object to which
          // Subscribe for planes WP1 details and found
          // The nearest plane. The distance between the planes - 0 mm.
          // Dependence unidirectional
          SetGeomConstraint (INSERT, CODIRECT, obj, WP1, strNearestPlane, 0, FALSE);
        
        // For the internal sections of shafts:
        else
          // Set the relationship with the same parameters,
          // But oppositely.
          SetGeomConstraint (INSERT, CONTRDIRECT, obj, WP1, strNearestPlane, 0, FALSE);
      
        // Set the parameter depending on the current execution
        // Holes.
      
        // To form the hole F must be equated
        // Parameter rDiameter (shaft diameter) to the diameter DF table hole
        if (strDesignName == "Form F") {
          // So if the test is performed, the
          // Set the parametric dependence on expression.
          // RDiameter equating to DF
          SetParamConstraint (DF, obj, EXPR, "obj.rDiameter");
        };
      
        // To form H is the same test, but establishes a relationship
        // Already diameter hole DH.
        if (strDesignName == "FormaH") {
          SetParamConstraint (DH, obj, EXPR, "obj.rDiameter");
        };
      
        NoVectorSelect = 1; // setting the variable NoVectorSelect 1
             // Disable the selection of the direction vector for details
             // Since been joined and established addiction
             // Then choose further it is not necessary.
           
        Handled = OBJ_HANDLED; // Set the variable Handled
          // Value OBJ_HANDLED, ie saying that according to
          // Set successfully.
      };
     
     };
   };
 }

Blind GOST 16076-70

Script:

 SVersion = 2;
 ObjectDescription = "16076-70";
 
 functionActHeader {
   NPart = 0;
   Public (
      // From outdoor settings need only determine the face
      // Diameter of a working surface for attachment
      // Material and reference weight.
      Dn,NOMINAL_DIAMETER,
      massa,MASS,
      sw0, @ MATERIAL,
      WP1, @ WORKING_PLANE1
   );
  
   Protected (seted, d, D, D1, D2, D3, D4, l, l1, L, type, type1);
   Changeable (Dn, WP1);
   OnDlgBeforeSelectParam = 1;
   ShowWhenSelPnt = 1;
   ContourOnLine = 0;
 };
 
 function OnInitialization {
   LoadInCache (Dn, d, D, D1, D2, D3, D4, l, l1, L, massa);
   if (seted == UnknownValue) {
      seted = 1;
      rZOrder = 100;
      // In the 6th version of all the titles in English versions
      // 1 = Implementation Ispolnenie1
      strDesignName = "Implementation 1";
      rd0 = 1;
      sw0 = 1;
    
      SelectInCache ("kFirst", "Dn", "~", 18);
   };
 };
 
 function SetGripPoint {
   NGrip = 1; // A handle at the insertion point
   pntGrip0 = pntOrigin;
 };
 
 function OnMakeParameters {
   // All localizable strings specified resource links
   // Starting with the dog.
   // Accordingly, they will be displayed depending on
   // The current application language.
   //
   strTheName = @ BLIND_GOST_16076_70;
   strTheType =ON_INTERNAL;
   strTheSubType =ON_INTERNAL;
   WP1 = Plane (pntOrigin + vecDirection * (0), vecDirection);
  
 
   if (rd0 == 0) type = "022";
   if (rd0 == 1) type = "012";
 
   if (sw0 == 1) type1 = "A"; else type1 = "";
  
 };
 
 function OnDialog {
   LoadInCache (Dn, d, D, D1, D2, D3, D4, l, l1, L, massa);
   UniDialog (
      // Type of dialogue - which determines the nominal diameter
      // And reference weight
      DBFLD, Dn,
      DBINF, massa,
      // Jackdaw overall performance
      BFLD, sw0,COMMON_IMPLEMENTATION,
      // Alternative Material
      RADIO, rd0, @ STEEL_45, @ 12X18H9T__X18H9T_,
      // These options affect the string specification covers
      VIEW, "Vids");
 };
 
 function OnDialogChanged {
 
 };
 
 function OnChangeParameters {
   if ((Dn! = new.Dn)) {
      LoadInCache (Dn, d, D, D1, D2, D3, D4, l, l1, L, massa);
      // When you change the diameter of the table, select the new value
      SelectInCache ("kFirst", "Dn", "~", new.Dn);
   };
   Handled = OBJ_HANDLED;
   if ((Dn! = new.Dn)) {
      Handled = OBJ_WARNING;
   };
   fix = 0;
   if (IsFixedParam (WP1)) {
      fix = fix + 1;
      vecXOld = vecDirection;
      vecDirection = Vector (new.WP1);
      pntOrigin = Point (new.WP1) - vecDirection * (0);
      restoreBasis (vecXOld, vecPlane, vecDirection);
   };
   if (fix > 1) {
      Handled = OBJ_ERROR;
   };
 };
 
 function BeforeConnect {
   ResetLastConstraint ();
 }
 
 strPartName = @ SPHERE_CAP_ + Dn + "-" + type + type1 + @ _ GOST_16076_70;

Steel welded neck GOST 12821-80

Script (only the BeforeConnect and OnConnect procedures)

Other can be seen in the database of the standard details.

// For flange necessary to geometric constraints
 // Have been installed on the gasket and parametric -
 // The second flange.
 function OnConnect {
   // When setting dependencies on multiple objects, we first
   // Store information about objects,
   // And then use it to install, depending
  
   // So, the first stage - the selection of the parameters
   // Here rPart is 0 (the serial number of the query begins
   // 0.
   // If this is the first request, and the selected object = laying GOST 15180,
   // Save the parameters of the object (pads) under the number 0
   if (rPart == 0 & & obj.strTheName == " GOST 15180-86 ") {
      setWorkId (0, obj.objectID);
      Handled = OBJ_HANDLED;
   };
  
   // For the second request - check further whether this
   // Object flange GOST 12821, and, if so, to save the parameters of this
   // Flange at number 1.
   if (rPart == 1 & & obj.strTheName == " GOST 12821-80 ") {
      setWorkId (1, obj.objectID);
      Handled = OBJ_HANDLED;
   };
  
  
   // Then consider the stored data objects:
   // If something was preserved in the first stage, that is, the data is not equal to 0
   if (getWorkId (0) = 0)
   {
      // Restore the data object variable obj 0
      getObjData (getWorkId (0), obj);
      // Closest to the insertion point plane
      strNearestPlane = GetNearestPlane (pntOrigin);
      // If the plane had been found,
      if (strNearestPlane! = UnknownValue) {
         // We set the geometric constraints of the insert.
         SetGeomConstraint (INSERT, CONTRDIRECT, obj, WP1, strNearestPlane, 0, TRUE);
         // Do not choose a direction vector
         NoVectorSelect = 1;
      };
   };
  
   // If in the latter case the data has been stored, then:
   if (getWorkId (1) = 0)
   {
      // Restore them back to the variable obj
      getObjData (getWorkId (1), obj);
    
      // Set a set of parametric dependencies
      // In nominal pressure, nominal size,
      // Form with a cut flange Series and a number of performances.
      SetParamConstraint (Py, obj, EXPR, " obj.Py ", TRUE);
      SetParamConstraint (Dy, obj, EXPR, " obj.Dy ", TRUE);
      SetParamConstraint (bSection, obj, EXPR, " obj.bSection ", TRUE);
      SetParamConstraint (R, obj, EXPR, " obj.R ", TRUE);
      SetParamConstraint (isp_row, obj, EXPR, " obj.isp_row ", TRUE);
      NoVectorSelect = 1;
   };
  
   // This block is realized when joining the flange to the pipe
   // The first request for a check type and subtype
   if (rPart == 0 & & obj.strTheType == " Tube " & & obj.strTheSubType == " Round ") {
      // Is the nearest plane
      strNearestPlane = GetNearestPlane (pntOrigin);
      if (strNearestPlane! = UnknownValue) {
         // Set geometric
         SetGeomConstraint (INSERT, CONTRDIRECT, obj, WP2, strNearestPlane, 0, TRUE);
         SetGeomConstraint (DIRECITON, CODIRECT, obj, WPnormal, obj.WPnormal, 0, TRUE);
         NoVectorSelect = 1;
      };
      // And parametric dependence
      SetParamConstraint (Dn, obj, EXPR, " obj.B ", TRUE);
      Handled = OBJ_HANDLED;
   };
 };
 

I-profiles GOST 19425

CAD software DEVELOPER'S GUIDE DATABASE 64

CAD drawing DEVELOPER'S GUIDE DATABASE 65

I-profile script:

 SVersion = 2;
 ObjectDescription = @ GOST_19425_74;
 
 function ActHeader {
   NPart = 1;
   Public (
      // Open options- defining the geometry: length, height
      // Width of the shelves.
      L,LENGTH,
      h,I_SHAPE_HEIGHT,
      b,FLANGE_WIDTH,
      // Reference: weight per meter and the total weight
      massa,MASS,
      mas1,RUNNING_METER_MASS,
      // Standard designation and a series of I-beam
      Designation, @ STANDART_DESIGNATION,
      seria, @ SERIES,
    
      // Working planes
      WP1,CROSS_PLANE,
      WP2, @ BOTTOM_PLANE,
      WP3, @ SIDE_BOTTOM_RIGHT_PLANE,
      WP4, @ SIDE_TOP_RIGHT_PLANE,
      WP5, @ TOP_PLANE,
      WP6, @ SIDE_TOP_LEFT_PLANE,
      WP7, @ SIDE_BOTTOM_LEFT_PLANE,
      WP8, @ CROSS_PLANE
 
   );
 
  
   Protected (seted, massa, bHid, seria);
  
   Changeable (L, b, h, WP1, WP2, WP3, WP4, WP5, WP6, WP7, WP8, Designation);
  
   OnDlgBeforeSelectParam = 1;
   ShowWhenSelPnt = 1;
   ContourOnLine = 0;
   NotStdBody = 1;
 };
 
 function OnInitialization {
   LoadInCache (seria, Designation, h, b);
   if (seted == UnknownValue) {
      seted = 1;
      rZOrder = 100;
      bHid = 0;
      L = 50;
      strDesignName = "Implementation 1";
      SelectInCache ("kFirst", "seria", "~", "C", "h", "~", 100, "b", "~", 10, "Designation", "~", "1") ;
   };
 };
 
 function SetGripPoint {
   // At four I-beam handle
   NGrip = 4;
   // Handles are situated at the extreme points of the model I-beam
   // The insertion point
   pntGrip0 = pntOrigin;
   // On the opposite end
   pntGrip1 = pntOrigin + L * vecDirection;
  
   // At the midpoint of the top shelf
   pntGrip2 = pntOrigin + h * vecPlane;
  
   // At the extreme point of the bottom shelf
   vecNormal = getLocalNormal (vecDirection, vecPlane);
   pntGrip3 = pntOrigin + vecNormal * b / 2;
 };
 
 function OnMoveGripPoint {
   // The first carrying handle entire I-beam
   if (NMovingGrip == 0) {
      pntOrigin = pntGrip0;
   };
  
   // The second handle stretches the length of the I-beam and determines
   // Direction vector insertion I-beam
   if (NMovingGrip == 1) {
      L = max (vecLen (pntGrip0 - pntGrip1), 1);
      vecDirection = pntGrip1 - pntGrip0;
      LoadInCache (seria, h, b);
      SelectInCache ("kFirst", "seria", "~", "20", "h", "~", h, "b", "~", b);
   };
  
   // Handle height of an I-beam
   // At its height stretched selected new I-beam,
   // Roughly equal relative distance from the cursor point
   // Insert parts.
   if (NMovingGrip == 2) {
      // Auxiliary variable height of the new I-beam.
      rNew_h = vecLen (pntGrip0 - pntGrip2);
 
      LoadInCache (seria, h, b);
      SelectInCache ("kFirst", "seria", "~", "20", "h", "~", rNew_h, "b", "~", b);
   };
 
   // Handle I-beam flange width
   // If it is stretched selected new I-beam flange width,
   // Approximately equal to twice the relative distance
   if (NMovingGrip == 3) {
      // A new auxiliary variable distances.
      rNew_b = 2 * vecLen (pntGrip0 - pntGrip3);
 
      LoadInCache (b, h);
      SelectInCache ("kFirst", "b", "~", rNew_b, "h", "~", h);
   };
  
 };
 
 function OnMakeParameters {
   strTheName = "19425-74";
   strTheType = "Profile";
   strTheSubType = "I-Shape";
  
   massa = mas1 * L / 1000;
  
   // Find the right third vector in the workpiece coordinate system,
   // As the vector product
   vecNormal = getLocalNormal (vecDirection, vecPlane);
  
   // We place the plane in order counterclockwise
   // The plane of the first end
   WP1 = Plane (pntOrigin + vecDirection * (0), vecDirection);
   // The plane of the second end
   WP8 = Plane (pntOrigin + vecDirection * L, -vecDirection);
   // Plane from the middle of the bottom shelf.
   WP2 = Plane (pntOrigin-vecPlane * (0), -vecPlane);
  
   // Right side
   WP3 = Plane (pntOrigin + vecNormal * (b / 2), vecNormal);
   WP4 = Plane (pntOrigin + vecNormal * (b / 2) + vecPlane * h, vecNormal);
  
   // The plane from the middle of the upper shelf
   WP5 = Plane (pntOrigin + vecPlane * (h), vecPlane);
  
   // Left Side
   WP6 = Plane (pntOrigin-vecNormal * (b / 2) + vecPlane * h, -vecNormal);
   WP7 = Plane (pntOrigin-vecNormal * (b / 2), -vecNormal);
 };
 
 function OnDialog {
   // For beauty
   strRefDataHeader = "------";
   LoadInCache (seria, Designation, h, b);
   // Type of dialogue
   UniDialog (
      // Define the parameters of a series of height and width of the shelves
      DBFLD, seria, h, b,
      // Reference parameters - designation and weight per meter
      DBINF, Designation, mas1,
      // Arbitrary length parameter I-beam
      VFLD, L, @ I_SHAPE_LENGTH__MM,
       
      // Making reference block settings page
      // Arbitrary properties
      strRefDataHeader, @ REFERENCE_DATA_,
      A, @ A__CM2,
      Ix,IX__CM,
      ix,IX__CM,
      Wx, @ WX__CM3,
      Sx, @ SX__CM3,
      Iy, @ IY__CM4,
      Wy, @ WY__CM3,
      iy,IY__CM,
    
      // Jackdaw display hidden lines
      BFLD, bHid,HIDDEN_LINES,
      // Display types AnyWBK generation means
      // Mirror species, if they are not overridden performances
      TVIDS, lViewType, "AnyWBK",
    
      VIEW, "Vids"
   );
 };
 
 function OnDialogChanged {
   ShowBool ??(0,HIDDEN_LINES);
   // Check the "invisible line" is only required for those species
   // For which they have.
   if (lViewType == VLEFT || lViewType == VRIGHT)
      {ShowBool ??(1,HIDDEN_LINES)};
 };
 
 
 function OnChangeParameters {
   // To change the settings:
   // Arbitrary simply assigned new values
   L = new.L;
  
   // For table or selected by a combination of the defining parameters
   if (new.b! = b || new.h! = h) {
      LoadInCache (h, b);
      SelectInCache ("kFirst", "h", "~", new.h, "b", "~", new.b);
   // Or by defining a standard notation field
   } Else if (Designation! = New.Designation) {
      LoadInCache (Designation);
      SelectInCache ("kFirst", "Designation", "~", new.Designation);
   };
 
    
   Handled = OBJ_HANDLED;
   fix = 0;
  
   // The response to the change of position of the planes.
   // Is to recalculate the new position of the insertion point
   // And directions
  
   // Under the conditions IsFixedParam units can be grouped into
   // Options direction of the plane.
  
   // Surface normal collinear vecDirection
   if (IsFixedParam (WP1)) {
      fix = fix + 1;
      vecXOld = vecDirection;
      vecDirection = Vector (new.WP1);
      pntOrigin = Point (new.WP1) - vecDirection * (0);
      restoreBasis (vecXOld, vecPlane, vecDirection);
   };
   if (IsFixedParam (WP8)) {
      fix = fix + 1;
      vecXOld = vecDirection;
      vecDirection = -Vector (new.WP8);
      pntOrigin = Point (new.WP8) - vecDirection * (L);
      restoreBasis (vecXOld, vecPlane, vecDirection);
   };
  
   // Surface normal collinear vecPlane
   if (IsFixedParam (WP2)) {
      fix = fix + 1;
      vecYOld = vecPlane;
      vecNormal = getLocalNormal (vecDirection, vecYOld);
      vecPlane = -Vector (new.WP2);
      pntOrigin = Point (new.WP2) + vecPlane * (0);
      restoreBasis (vecYOld, vecNormal, vecPlane);
      vecDirection = getLocalNormal (vecPlane, vecNormal);
   };
   if (IsFixedParam (WP5)) {
      fix = fix + 1;
      vecYOld = vecPlane;
      vecNormal = getLocalNormal (vecDirection, vecYOld);
      vecPlane = Vector (new.WP5);
      pntOrigin = Point (new.WP5) - vecPlane * (h);
      restoreBasis (vecYOld, vecNormal, vecPlane);
      vecDirection = getLocalNormal (vecPlane, vecNormal);
   };
  
  
   // Surface normal collinear vecNormal
   if (IsFixedParam (WP3)) {
      fix = fix + 1;
      vecZOld = getLocalNormal (vecDirection, vecPlane);
      vecZNew = Vector (new.WP3);
      vecYNew = getLocalNormal (vecDirection, vecZNew);
    
      restoreBasis (vecZOld, vecPlane, vecZNew);
    
      pntOrigin = Point (new.WP3) - vecZNew * (b / 2);
      vecDirection = getLocalNormal (vecZOld, vecYNew);
   };
  
   if (IsFixedParam (WP4)) {
      fix = fix + 1;
      vecZOld = getLocalNormal (vecDirection, vecPlane);
      vecZNew = Vector (new.WP4);
      vecYNew = getLocalNormal (vecDirection, vecZNew);
    
      restoreBasis (vecZOld, vecPlane, vecZNew);
    
      pntOrigin = Point (new.WP4) - vecZNew * (b / 2) + vecYNew * h;
      vecDirection = getLocalNormal (vecZOld, vecYNew);
   };
  
   if (IsFixedParam (WP6)) {
      fix = fix + 1;
      vecZOld = getLocalNormal (vecDirection, vecPlane);
      vecZNew = -Vector (new.WP6);
      vecYNew = getLocalNormal (vecDirection, vecZNew);
    
      restoreBasis (vecZOld, vecPlane, vecZNew);
    
      pntOrigin = Point (new.WP6) + vecZNew * (b / 2) + vecYNew * h;
      vecDirection = getLocalNormal (vecZOld, vecYNew);
   };
 
 
   if (IsFixedParam (WP7)) {
      fix = fix + 1;
      vecZOld = getLocalNormal (vecDirection, vecPlane);
      vecZNew = -Vector (new.WP7);
      vecYNew = getLocalNormal (vecDirection, vecZNew);
    
      restoreBasis (vecZOld, vecPlane, vecZNew);
    
      pntOrigin = Point (new.WP7) + vecZNew * (b / 2);
      vecDirection = getLocalNormal (vecZOld, vecYNew);
   };
  
   if (fix > 1) {
      Handled = OBJ_ERROR;
   };
 };
 
 function BeforeConnect {
   ResetLastConstraint ();
 };
 
 function OnSelectParam {
   // The dynamic selection of parameters.
   if (lViewType == VTOP || lViewType == VBOTTOM)
      // Do not choose the parameters for the types of side
      {BreakAll = 1;}
   else {
      // For other species to choose the length of an I-beam in the relative
      // Cursor abscissa
      L = max (abs (rXcoord), 1);
      };
 };
 
 // Formation of the line specifications, as the sum of substring
 strPartName =I_PROFILE_N_ + Designation + "x" + L + @ _MASS_ + massa + @ _GOST_19425_74;

Panel HB

Script of the detail:

 SVersion = 2;
 ObjectDescription = @ MCS_STRING6;
 
 function ActHeader {
   NPart = 1;
   Public (
      // Options- exterior length and width of the plate
      L,LENGTH,
      W,WIDTH,
      // Design load and weight plates
      P, @ MCS_STRING9,
      massa,MASS
   );
   Protected (seted, obozn, H);
   Changeable ();
   OnDlgBeforeSelectParam = 1;
   ShowWhenSelPnt = 1;
   ContourOnLine = 1;
 };
 
 function OnInitialization {
   LoadInCache (obozn, L, W, H, massa, P);
   if (seted == UnknownValue) {
      seted = 1;
      rZOrder = 100;
      // Set the initial values ??of parameters and execution
      SelectInCache (" kFirst ", " L ", " ~ ", 2700, " W ", " ~ ", 1190);
      strDesignName = " Implementation 1 ";
   };
 };
 
 function SetGripPoint {
   NGrip = 2;
   Two handles // - at the insertion point and with the opposite end
   // Panel
   pntGrip0 = pntOrigin;
   pntGrip1 = pntOrigin + L * vecDirection;
 };
 
 function OnMoveGripPoint {
   // When editing handles the following behavior:
   // Move the entire object when you drag over
   // First handle. And stretch the length and change the vector
   // Direction when stretching a second handle
   if (NMovingGrip == 1) {
      // Intermediate variables to define the geometry
      rW = W;
      rP = P;
      // Relative length
      rL = vecLen (pntGrip0 - pntGrip1) / rScl;
      // The new direction of the vector inserts
      vecDirection = pntGrip1 - pntGrip0;
    
      LoadInCache (P, W, L);
      // Select the new settings plate.
      SelectInCache (" kFirst ", " P ", " ~ ", rP, " W ", " = ", rW, " L ", " ~ ", rL);
   } Else {
      // If you edit the handle to move the 0 point
      // Insert an object
      pntOrigin = pntGrip0;
   };
 };
 
 function OnMakeParameters {
   // Classifications plates
   strTheName = " Panel NV ";
   strTheType = " Plita ";
   strTheSubType = " Plita ";
 };
 
 function OnDialog {// insert type of dialogue
   LoadInCache (obozn, L, W, H, massa, P);
   UniDialog (
      // The table control fields
      DBFLD, L, W, P,
      // The table reference field
      DBINF, obozn, H, massa,
      // Types - front, top, left
      TVIDS, lViewType, " F ", " T ", " L ",
      VIEW, " Vids ");
 };
 
 function OnDialogChanged {
   ShowDesign (0, " Preview ");
 };
 
 // Parameter changes
 function OnChangeParameters {
   // Just when controlling parameter changes
   // Select from a table those which correspond to the new
   // Values
   if (new.L! = L || new.W! = W)
   {
      LoadInCache (L, W);
      SelectInCache (" kFirst ", " L ", " ~ ", new.L, " W ", " ~ ", new.W);
   }
  
   Handled = OBJ_HANDLED;
 };
 
 function OnSelectParam {
   // Function of the dynamic selection of parameters
   rW = W;
      // For type VTOP do not select dynamically
   if (lViewType == VTOP) {
      BreakAll = 1;
   } Else {
      // For other species
      // Selected variable rL - how
      // Abscissa the relative position of the cursor.
      rL = abs (vecCoord: x);
      // Selected values ??from the table with the same width,
      // But with a new value for the wavelength plate.
      SelectInCashe (" kFirst ", " W ", " = ", rW, " L ", " ~ ", rL);
   };
 };
 
 function BeforeConnect {
   ResetLastConstraint ();
 }
 
 function OnConnect
 {
 // Automatic installation of dependencies
 // Set only parametric dependence.
 // Between the plates along the length and width.
   if (rPart == 0)
   {
      if (obj.strTheType == " Plita ")
      {
         SetParamConstraint (L, obj, EXPR, " obj.L ");
         SetParamConstraint (W, obj, EXPR, " obj.W ");
         NoVectorSelect = 1;
         seted = 1;
      };
   };
 }
 // The name plate is formed on the basis of the table box
 // Obozn
 strPartName = obozn;

Specification object

In this example, we will consider setting up an object to correctly add it to the specification.

There is a script for inserting a rectangle:

                                                           SVersion = 2;
                                                           ObjectDescription = "Example";
 
                                                            function ActHeader {
                                                           NPart=0;
                                                           Public(  );
                                                           Protected( seted, a, b );
                                                           Changeable( );
                                                           OnDlgBeforeSelectParam = 0;
                                                           ShowWhenSelPnt = 1;
                                                            ContourOnLine = 0;
                                                           };
 
                                                           function OnInitialization {
                                                           if(seted == UnknownValue) {
                                                           seted=1;
                                                           rZOrder=100;
                                                           a = 100;
                                                           b = 100;
                                                           };
                                                           };
 
                                                           function SetGripPoint {
                                                           NGrip = 1;
                                                           pntGrip0 = pntOrigin;
                                                           };
 
                                                           function OnMakeParameters {
                                                           strTheName = "Rectangle";
                                                           strTheType = "Rectangle";
                                                           strTheSubType = "Rectangle";
                                                           };
 
                                                           function OnDialog {
                                                           UniDialog( VFLD, a,"a", b,"b", TVIDS,lViewType,"All",VIEW,"Vids");
                                                           };
 
                                                           function OnDialogChanged {
                                                           ShowDesign(0, "Implementation1");
                                                           };
 
                                                           function OnChangeParameters {
                                                           Handled = OBJ_HANDLED;
                                                           };
 
                                                           function BeforeConnect {
                                                           ResetLastConstraint();
                                                           }
                                                          
                                                           SpecPartition="Details"; strPartName = "Rectangle "+a+"x"+b;                                            

For the correct addition of an object to the specification, added: a section of the specification and the name of the object in the specification.

The specification section is specified using the "SpecPartition" parameter. If the specified section is missing in the specification, the object will be added to the specification without the section. It is recommended to set the value using the resource table.

The object name in the specification is specified using the "strPartName" parameter. The value can be composite and generated using the "Part list entry wizard".

When you add the "#" symbol to the value of the name of the object, in the position editor it will be possible to insert text between two lattices with subsequent saving. When exporting a part list, the "#" symbol will not be displayed.

strPartName = "Motor 1MP2" + "-" + a + "-" + n + "-" + shema + "#"+ " " + "GOST 31591-2012";

CAD drafting DEVELOPER'S GUIDE DATABASE 66