|
Formulas
By using formulas, you can make one parameter of a shape dependent on other parameters, or on the actions of the user. Here are some examples of formulas:
- Variables.X1+(Variables.X2-Variables.X1)*0.293
- _min(0;Geometry1.X2-Variables.X2)
- =_IF(Variables.X1=1;_Setf("Variables.X1";0);_Setf("Variables.X1";1))
If you want to reference a cell in a formula, indicate the cell name (displayed in red near the cell), for instance Width, TextAngle, etc.
<cell_name>
The sections to which you can add cells (such sections as Geometry, Controls, Connect, Variables, Font Format, Paragraph Format, Actions) are referred to in a different way:
<section_name>.<cell_name>
The cell name is made up of the column name and the line number,
For example: "Controls.YDyn1"; "Variables.Y2"; "Connect.X1".
For the Geometry section, the section name also includes the section number - because a figure may have more than one geometry.
For example: "Geometry1.Y1", "Geometry2.C2".
So, for the first two cells the names look like this: "Geometry1.Visible" and "Geometry1.Filled".
Formulas often include functions. The full list of functions and their specifics can be found in the Function Reference section in the Reference..
You may need to address cells describing other shapes.
Every shape has its identification number: you can see it in the title bar of the table window, or on the Information tab of the Shape Properties dialog (the ID field).
This ID is used when you address the parameters of the shape:
<Shape_ID>.<section_name>.<cell_name>
For example: "ObjID13.Geometry2.X1", "ObjID2.Width".
If the shape belongs to a group, the Parent prefix is used to access the group parameters:
Parent.<section_name>.<cell_name>
For example: "Parent.Height".
If you need to refer to a shape inside a group, the following structure is used:
Child<number>.<section_name>.<cell_name>
Например: "Child2.Angle".
The number parameter corresponds to the order of the shape within the group. You can find this number in the Information tab of the Shape Properties dialog (the SubID field).
The application creates some formulas automatically. Such formulas are called default formulas. For instance, when you create a line, the program will describe one of its parts as follows:

Here, "Width*0.75000" and "Height*0.666667" are default formulas.
Due to these formulas the vertices maintain their relative positions with respect to the alignment box of the shape when the shape is resized. These formulas change automatically when you reposition the shape's vertices or the shape itself.
If a formula has the "=" sign near it, it means that the formula can not be changed in any way other than by editing its cell.
If the formula hasn't the "=" sign before it, it may be altered automatically when you modify the shape and apply actions which change this parameter.
If the parameter indicates dimensions (width, height, etc.), you need to specify the unit of measure for the value. You can use the corresponding suffix after the value - for instance, 15 mm, 25 in, etc. For instance, the Width parameter of the Transform section can look like this:
=15 mm
If you don't specify the unit of measure, the value will be in ConceptDraw internal units (1 internal unit = 0.1 mm).
For angles the internal units of measure are radians. If you want to set angles in degrees, add "deg" to the value:
= 30 deg
Operators in Formulas
Starting from ConceptDraw VI you can use operators in formulas, apart from the logical functions AND, _IF, _NOT, _OR and XOR.
The following operators are supported: logical operators AND, EQV, IMP, NOT, OR, XOR; comparison operators <, >, <=, >=, =, <>; exponentiation ^ or**; negation/subtraction -; adding +; multiplication and division *, /; integer division \; modulo arithmetic MOD; string concatenation &.
»
|