Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
05 ArchiCAD 11 GDL Reference Guide.pdf
Скачиваний:
59
Добавлен:
11.03.2015
Размер:
3.22 Mб
Скачать

Expressions and Functions

Example:

ss = "3 pieces 2x5 beam"

n = SPLIT (ss, "%n pieces %nx%n %s", num, ss1, size1, ss2, size2, name)

IF n

= 6 THEN

! 3 pieces 2 x 5 beam

ELSE

PRINT num, ss1, size1, ss2, size2, name

 

 

PRINT "ERROR"

ENDIF

STW

STW (string_expression)

Returns the (real) width of the string in meters displayed in the current style. The width in meters, at current scale, is STW (string_expression) / 1000 * A_.

Example:

DEFINE STYLE "own" "Monaco", 180000 / A_, 1, 0 SET STYLE "own"

string = "abcd"

width = STW (string) / 1000 * A_

n = REQUEST ("Height_of_style", "own", height) height = height / 1000 * A_

text2 0,0, string

rect2 0,0, width, -height

STRLEN

STRLEN (string_expression)

Returns the (integer) length of the string (the number of characters)

STRSTR

STRSTR (string_expression1, string_expression2)

Returns the (integer) position of the first appearence of the second string in the first string. If the first string doesn’t contain the second one, the function returns 0.

206

ArchiCAD 11 GDL Reference Guide

Expressions and Functions

STRSUB

STRSUB (string_expression, start_position, characters_number)

Returns a substring of the string parameter that begins at the position given by the start_position parameter and its length is characters_number characters.

Example:

ss = ""

n = REQUEST ("Linear_dimension", "",ss) unit = ""

IF STRSTR (ss, "m") > 0 THEN unit = "m" IF STRSTR (ss, "mm") > 0 THEN unit = "mm" IF STRSTR (ss, "cm") > 0 THEN unit = "cm"

TEXT2 0, 0, STR (ss, a) + " " + unit !1.00 m string = "Flowers.PICT"

len = STRLEN (string)

n = STRSTR (string, ".")

TEXT2 0, -1, STRSUB (string, 1, n - 1) !Flowers TEXT2 0, -2, STRSUB (string, len - 4, 5) !.PICT

ArchiCAD 11 GDL Reference Guide

207

Expressions and Functions

208

ArchiCAD 11 GDL Reference Guide