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

Control Statements

THE OUTPUT STATEMENT

PRINT

PRINT expression [, expression, ...]

Writes all of its arguments in a dialog box. Arguments can be strings or numeric expressions of any number in any sequence, separated by commas.

Examples:

PRINT "loop-variable:", I PRINT J, K-3*L

PRINT "Beginning of interpretation" PRINT a * SIN (alpha) + b * COS (alpha)

PRINT "Parameter values: ", "a = ", a, ", b = ", b PRINT name + STR ("%m", i) + "." + ext

FILE OPERATIONS

The following keywords allow you to open external files for reading/writing and to manipulate them by putting/getting values from/to GDL scripts. This process necessarily involves using special Add-On extensions. Text files can be handled by the “TEXT GDL I/O” Add-On. Add-Ons for other file types can be developed by third parties.

See also “GDL Text I/O Add-On” in the “Miscellaneous”.

OPEN

OPEN (filter, filename, parameter_string) filter: string, the name of an existing extension

filename: string, the name of the file

parameter_string: string, it contains the specific separation characters of the operational extension and the mode of opening. Its contents are interpreted by the extension.

Opens a file as directed. Its return value is a positive integer that will identify the specific file. This value, the channel number, will be the file’s reference number in succeeding instances. To include the referenced file in the archive project, use the “FILE_DEPENDENCE "name1" [, "name2", ...]” command with the file name.

INPUT

INPUT (channel, recordID, fieldID, variable1 [, variable2,...])

recordID, fieldID: the string or numeric type starting position of the reading, its contents are interpreted by the extension

220

ArchiCAD 11 GDL Reference Guide

Control Statements

The number of given parameters defines the number of values from the starting position read from the file identified by the channel value. The parameter list must contain at least one value. This function puts the read values into the parameters as ordered. These values can be of numeric or string type, independent of the parameter type defined for storage.

The return value is the number of the successfully read values. When encountering an end of file character, -1 is returned.

VARTYPE

VARTYPE (expression)

Returns 1 if the type of the expression is numerical, 2 if it is a string.

Useful when reading values in variables with the INPUT command, which can change the type of the variables according to the current values. The type of these variables is not checked during the compilation process.

OUTPUT

OUTPUT channel, recordID, fieldID, expression1 [, expression2, ...]

recordID, fieldID: the string or numeric type starting position of the writing; its contents are interpreted by the extension.

Writes as many values into the file identified by the channel value from the given position as there are defined expressions. There has to be at least one expression. The type of values is the same as those of the expressions.

CLOSE

CLOSE channel

Closes the file identified by the channel value.

ArchiCAD 11 GDL Reference Guide

221

Control Statements

222

ArchiCAD 11 GDL Reference Guide