Values of 2D Fragment's External Variables

Предыдущая страницаВ началоСледующая страница

Defining fragment external variables

If external variables exist in a drawing, you will be asked to define the values when inserting this drawing as a fragment into assemblies. When attaching to the connector, necessary values can be specified automatically.

Let's review defining fragment external variables in the example of a ball bearing drawing that we will be inserting into a shaft drawing. An external variable "d" is created in the ball bearing drawing that drives its inner diameter.

After choosing the name of the fragment-bearing, in the command's properties window the tab Variables will appear which allows specifying the values for the fragment external variables. The standard list of variables or user-defined dialog with the control elements can be used for specifying the values.

If the fragment drawing has text fields with an external variable inserted into them (for example, title block), then the values of such variables can be changed directly on the assembly drawing.

Let's consider first defining the fragment external variables using the list of variables. In this way, variables may be assigned data of three types:  

1) Constant (a number in the case of a real variable, or a string in the case of a text variable);

2) An assembly variable;

3) None (the variable entry left blank).

Type 1: Assigning constant value

Let's set a particular value of the ball bearing diameter, for example, "30".

11FragmentstoDrawing2

In this case, as the shaft diameter varies, the inner diameter of the ball bearing will not change. To modify the value of the ball bearing external variable, you will have to edit the fragment.

11FragmentstoDrawing1S        11FragmentstoDrawing2S

Fragment external variables can be pre-defined with default values when offered for defining. The default values are copied from the respective variables in the original fragment drawing file, if the flag Substitute Variable values is set in the command System Options on the tab Fragments.

Type 2: Assigning assembly variable

Instead of a fixed value of the ball bearing external variable, let's type in the name Diameter of an existing assembly variable. If a user puts in the name of a non-existing variable, the system will prompt a user to create a new variable. Suppose, at the insertion time, the variable Diameter equals "20".

11FragmentstoDrawing3

Let's modify the variable Diameter to "40". In this case, the ball bearing image will adjust automatically.

11FragmentstoDrawing3S        11FragmentstoDrawing4S        

If a fragment external variable was named after an assembly variable, and such assembly variable actually exists in the current assembly drawing, the latter value will be automatically assigned to the fragment variable (see the chapter Parameters of Variable).

Type 3: Undefined value

11FragmentstoDrawing4

You can skip defining the external variable altogether, leaving the entry blank.

In this case the value read from the fragment file will be put into. To change now the ball bearing diameter, it is necessary to download its file as a separate drawing, specify the desired diameter value in that file, and after saving the file return to the assembly drawing. This scheme is used in practice rarely, when it is required to modify the assembly drawing by changing the values of the variables in the fragment file.

For filling in unspecified values of the variables automatically, in the System options a special parameter Substitute variable values is turned on by default. In this case, upon inserting the fragment, all variables automatically get constant value read from the fragment.» is turned on by default. In this case, upon inserting the fragment, all variables automatically get constant value read from the fragment.

11FragmentstoDrawing5

Working with user-defined dialog

User-defined dialog with control elements represents itself a more visual tool for working with external variables of the fragment. The set of different control elements allows specifying the values for the variables with the help of various toggles, buttons and also by entering the values from the keyboard or working with the list of values. There are two regimes in which the dialog fields for the value entry can operate. Either the value of the variables or the expressions themselves can be displayed in the fields of the dialog. In the latter case, the values of the expressions are shown to the right of the entry field. The second regime works in case the parameter Show expressions has been set on in the properties of the entry field. Details of creating user-defined dialogs are described in the chapter Control Elements.

In any case, a user can write both values and expressions into the entry fields. After finishing the data entry (when the focus of input is shifted to another field), the fragment external variable which is related to the given entry field will be set equal to the expression.

To define a relation between a fragment external variable and an assembly variable, you can use the context menu commands.

You can call the context menu command Insert Variable or, instead, simply press <F8>. The standard Insert Variable dialog box will be displayed in the screen. Upon selecting an assembly variable, its value will be assigned to the fragment external variable. A checkmark before the respective command of the context menu will be indicating that the current fragment variable has a relation with an assembly variable. Direct editing of the dialog entries will be modifying the respective assembly variable values. To cancel such a relation, call the same context menu command again.

11FragmentstoDrawing6

To cancel such a relation, call the same context menu command again. When the connection with the variable is established, it is possible to continue working with the drop-down lists of the values. While doing it, the assembly variable connected to the given fragment variable will be assigned the new value from the drop down list.

Using configuration

For specifying the values of the fragment’s external variables, it is also possible to use configurations created in the document of the fragment.

11FragmentstoDrawing10

When configurations exist in the fragment’s document, the parameter Configuration is available in the fragment’s parameters dialog. Its drop-down list contains the names of the configurations created in the fragment’s document. When selecting a configuration, all fragment’s external variables are automatically assigned the values stored in the selected configuration.

In addition to the names of fragment’s configurations, the list of the parameter Configuration contains additional items:

Without configurations – this option is used to prevent the use of configuration;

Variable… – allows specifying the name of the used configuration with help of the variable. After selecting this item in the list, the window for specifying the variable’s name will pop up on the screen. The variable’s name can be specified either manually (in curly brackets) or with the help of the context menu command Insert Variable… F8.

11FragmentstoDrawing11