VS:Write: Difference between revisions

From Vectorworks Developer
Jump to navigation Jump to search
No edit summary
No edit summary
Line 38: Line 38:
==== VectorScript ====
==== VectorScript ====
<code lang="pas">
<code lang="pas">
Write(Value1);
Write(Value1);</code>


{writing binary data}
Writing binary data:
 
Write of ARRAY OF INTEGER with write two bytes per INTEGER. So, 10 bytes will be written for 'arr'.
 
This code will produce file with the following bytes(hex): 01 02 FF FE 00 00 00 00 00 00
 
<code lang="pas">
   arr : ARRAY [1..5] OF INTEGER;
   arr : ARRAY [1..5] OF INTEGER;
Line 51: Line 57:
   arr[2] := MixBytes( 255, 254 );
   arr[2] := MixBytes( 255, 254 );
   Write(arr);
   Write(arr);
{Write of ARRAY OF INTEGER with write two bytes per INTEGER. So, 10 bytes will be written for 'arr'}
{this code will produce file with the following bytes(hex): 01 02 FF FE 00 00 00 00 00 00}
</code>
</code>
==== Python ====
==== Python ====

Revision as of 18:15, 25 August 2017

.VectorScript|VectorScript ..VS:Function Reference|Function Reference ..VS:Function_Reference_Appendix|Appendix

Description

Procedure Write outputs the specified data to an ASCII text file. The variable length parameter list specifies the data to be written to the file.

Parameters may be any valid data type, and data types may be mixed in a single call to the procedure. Write leaves the file pointer positioned at the end of the last data value written to the file; any data subsequently written to the file will be appended to the end of this value.

See the VectorScript Language Guide for details on formatting values using WriteLn.

PROCEDURE Write(
z :ANY);
def vs.Write(z):
    return None

Parameters

z ANY

Example

VectorScript

Write(Value1);

Writing binary data:

Write of ARRAY OF INTEGER with write two bytes per INTEGER. So, 10 bytes will be written for 'arr'.

This code will produce file with the following bytes(hex): 01 02 FF FE 00 00 00 00 00 00

  arr : ARRAY [1..5] OF INTEGER;
	
  FUNCTION MixBytes(b1, b2: INTEGER) : INTEGER;
  BEGIN
    MixBytes := b1 + b2 * 256;
  END;
BEGIN
  arr[1] := MixBytes( 1, 2 );
  arr[2] := MixBytes( 255, 254 );
  Write(arr);

Python


Version

Availability: from All Versions