Convertation Functions

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

angle(45, 10, 15)   -   Forms the decimal value of an angle from degrees, minutes, seconds, or from degrees and minutes. Those. the function has three or two arguments.

atof("0.25")   -   Convert string "0.25" to real number 0.25.

ftoa(0.25)   -   Convert real number 0.25 to string "0.25".

functiontransf1

This function can contain the format of the returned record, for example:

functiontransf70

ftot(0.25)   -   Convert real number 0.25 to string "0.25" using comma instead of period.

functiontransf2

ftot_u(0.25, "mm")   -   Convert a real number 0.25 to the string "0.25" using a comma instead of a period in the specified units.

functiontransf33

atot( )   -   Convert the angular value of a function parameter to a text string.

Function call syntax:

atot (angle, accuracy, standard, number), where

angle - the real value of the original angle

accuracy - the precision with which to convert the value

standard - angle form; can take the following values:

1 - decimal form, e.g. 1.123

2 - in the form of degrees, minutes and seconds, for example 1 2'30 "

number - the number of significant digits after the decimal point in decimal notation

Example:

$text1 = atot(1.1234,0.001,2,6)

$text2 = atot(1.1234,0.001,1,6)

After calculation, $text1 is 1 7'23 "and $text2 is 1.123000

 
ltot( )   -   Convert the linear value of a function parameter to a text string.

Function call syntax:

ltot (length, accuracy, standard, number),

where

length - is a real value of the original length

accuracy - the precision with which to convert the value

standard - form of representation of length; can take the following values:

1 - decimal form, e.g. 1.123

2 - in the form of inches

3 - as inches and fractions

4 - as feet, inches and fractions

5 - decimal form (separated by commas), for example 1.123

number - the number of significant digits after the decimal point in decimal notation

 

satot( )   -   Converts a real number of an angular value into a string of text.

The conversion parameters are defined by the settings of the Set Document Parameters command on the Dimensions tab.

The function satot( ) specifically uses the definitions from the Angular Dimensions group. Suppose, the following parameters are defined in the Set Document Parameters command.

25FunctionSpecial1        

In this case, calling satot(120.34567) leads to the following result: 12%%d30'        

The character combination %%d stands for the degree symbol (°).

In order to realize this character combination as the degree symbol, the variable must be used as a parameter of some detailing element, such as a text (string text only), dimension, leader note, etc.

Let's clarify the above on the following example. Suppose, the following value is assigned to the variable $str by the function call:

$str = satot(120.34567) = 120%%30'

We will then create a dimension with the "Before" string containing the variable in braces instead of the default. The following result will then be displayed:

Satot         clip2165

The variables that are assigned return values of such functions can also be entered (in braces) in string text. Such text will then be correctly displayed as well.

Modifying the Units parameter in the command Set Document Parameters as shown leads to the following result:

satot(120.34567) returns  120.5%%d

25FunctionSpecial2

The Accuracy parameter allows controlling the accuracy of the returned result:

satot(120.34567) returns  120%%d21

25FunctionSpecial3

The Minimum Digits parameter is used only for decimal representation:

satot(120.34567) returns  120.500%%d

25FunctionSpecial4

 

The function sltot( ) differs from the previous one only in that the value to be converted is considered a linear value. Therefore, the conversion formats change accordingly. There are four standard formats for this function:

1 – decimal format. Example: 1.123;

2 – in inches;

3 – in inches and fractions;

4 – in feet, inches and fractions.

The following settings showing in the pictures result in: sltot(120.34567) returns  120.35        

25FunctionSpecial5        

tounit( , ) - convert units of measure.

The function has two arguments: a variable, whose value (with a set or not set unit) will be converted, and a target unit. The target unit can be defined either as a text string (eg "mm"), or as another variable, whose unit will be used.

If units of the first argument are compatible with the target unit (i.e. they have the same type), then the conversion to the target unit is performed. For example "kg" -> "t".

If units are not compatible, then the the target unit is assigned without conversion. Unit incompatibility error is not generated.

25Special1