Append File I/O 
MiniCAD

VectorScript Declaration:

PROCEDURE   Append
( fileName:DYNARRAY[] of CHAR ) ;

Python:

def  vs.Append(fileName):
   return None

Description:

Procedure Append opens the specified file for writing and appends the data to the end of the file. Existing data in the file is NOT overwritten.

If the filename includes a fully qualified path, the path has to use the appropriate notation for the local operating system:
Macintosh HD:Applications:Vectorworks:Plug-Ins:Data:Notes.txt C:\Program Files\Vectorworks\Plug-Ins\Data\Notes.txt If the filename includes a path relative to the location of the Vectorworks executable, the subfolder delimiters have to be backslashes:
Plug-Ins\Data\Notes.txt If the filename does not include a path, the file is assumed to exist in the same folder as the Vectorworks executable.

説明

指定したパスを持つファイルを追加モードで開きます。ファイル内の既存データは上書きされません。

Parameters:

fileName Name of file to open for writing. ファイルのパス

Example:

PROCEDURE Example;
VAR
   fileName :STRING; 
   major, minor, maintenance, platform :INTEGER;
BEGIN
   GetVersion(major, minor, maintenance, platform);
   IF platform = 1 THEN BEGIN
      fileName := 'Macintosh HD:Example.txt';
   END ELSE BEGIN
      fileName := 'C:\Example.txt';
   END;
   Append(fileName);
   WriteLn('example text');
   Close(fileName);
END;
RUN(Example);



  Close File I/O 
MiniCAD

VectorScript Declaration:

PROCEDURE   Close
( fileName:DYNARRAY[] of CHAR ) ;

Python:

def  vs.Close(fileName):
   return None

Description:

Procedure Close closes the specified text file.

If the filename includes a fully qualified path, the path has to use the appropriate notation for the local operating system:
Macintosh HD:Applications:Vectorworks:Plug-Ins:Data:Notes.txt C:\Program Files\Vectorworks\Plug-Ins\Data\Notes.txt If the filename includes a path relative to the location of the Vectorworks executable, the subfolder delimiters have to be backslashes:
Plug-Ins\Data\Notes.txt If the filename does not include a path, the file is assumed to exist in the same folder as the Vectorworks executable.

説明

指定したパスを持つファイルを閉じます。

Parameters:

fileName Name of file to close. ファイルのパス

Example:

BEGIN
     Open('MyData');
     WHILE NOT EOF('MyData') DO
          ReadLn(a,b,c,d);
     Close('MyData');
END;




  ConvertHSF2PosixPath File I/O 
Vectorworks 2010

VectorScript Declaration:

FUNCTION   ConvertHSF2PosixPath
(   HSFPath :DYNARRAY[] of CHAR;
  VAR  outPosixPath :DYNARRAY[] of CHAR
) :BOOLEAN ;

Python:

def  vs.ConvertHSF2PosixPath(HSFPath):
   return (BOOLEAN, outPosixPath)

Description:

Machintosh only!

Converts HSF (using ':' as delimiter) file path to Posix (using '/' as delimiter) file path.

説明

Macintoshのみ有効

ファイルパスの 「:」 を 「/」 に変更します。

Parameters:

HSFPath The HSF path that is to be converted. 変更するファイルパス
outPosixPath Output parameter. Returns the converted path. If the function does not succeed the returned value is the passed 'HSFPath' value. 変更されたファイルパス

Result:

Returns true if the conversion succeeds. False if it fails.
The resulted Posix path will be the same as the passed HSF path if the function fails.

返り値

変更が成功したらTRUEを返します。変更がなかった場合もFALSEを返します。

See Also:

ConvertPosix2HSFPath  



  ConvertPosix2HSFPath File I/O 
Vectorworks 2010

VectorScript Declaration:

FUNCTION   ConvertPosix2HSFPath
(   PosixPath :DYNARRAY[] of CHAR;
  VAR  outHSFPath :DYNARRAY[] of CHAR
) :BOOLEAN ;

Python:

def  vs.ConvertPosix2HSFPath(PosixPath):
   return (BOOLEAN, outHSFPath)

Description:

Machintosh only!

Converts Posix (using '/' as delimiter) file path to HSF (using ':' as delimiter) file path.

説明

Macintoshのみ有効

ファイルパスの 「/」 を 「:」 に変更します。

Parameters:

PosixPath The Posix path that is to be converted. 変更するファイルパス
outHSFPath Output parameter. Returns the converted path. If the function does not succeed the returned value is the passed 'PosixPath' value. 変更されたファイルパス

Result:

Returns true if the conversion succeeds. False if it fails.
The resulted Posix path will be the same as the passed Posix path if the function fails.

返り値

変更が成功したらTRUEを返します。変更がなかった場合もFALSEを返します。

See Also:

ConvertHSF2PosixPath  



  CreateFolder File I/O 
Vectorworks 2014

VectorScript Declaration:

FUNCTION   CreateFolder
( path:DYNARRAY[] of CHAR ) :BOOLEAN ;

Python:

def  vs.CreateFolder(path):
   return BOOLEAN

Description:

Creates a folder on the hard drive.

説明

ハードディスク上にフォルダーを作ります。



  EOF File I/O 
MiniCAD

VectorScript Declaration:

FUNCTION   EOF
( fileName:DYNARRAY[] of CHAR ) :BOOLEAN ;

Python:

def  vs.EOF(fileName):
   return BOOLEAN

Description:

Function EOF returns TRUE if the file pointer of an open text file has reached the end of the file (EOF marker). Function EOF is used with Procedures Read and ReadLn to ensure proper file reading and closure. Parameter fileName specifies a text file which is open for reading or writing.

If the filename includes a fully qualified path, the path has to use the appropriate notation for the local operating system:
Macintosh HD:Applications:Vectorworks:Plug-Ins:Data:Notes.txt C:\Program Files\Vectorworks\Plug-Ins\Data\Notes.txt If the filename includes a path relative to the location of the Vectorworks executable, the subfolder delimiters have to be backslashes:
Plug-Ins\Data\Notes.txt If the filename does not include a path, the file is assumed to exist in the same folder as the Vectorworks executable.

説明

開いているファイルの読み込み位置が、終端であればTRUEを返します。

Parameters:

fileName Name of file. ファイルのパス

Example:

BEGIN
     Open('MyData');
     WHILE NOT EOF('MyData') DO
          ReadLn(a,b,c,d);
     Close('MyData');
END;



  EOLN File I/O 
MiniCAD

VectorScript Declaration:

FUNCTION   EOLN
( fileName:DYNARRAY[] of CHAR ) :BOOLEAN ;

Python:

def  vs.EOLN(fileName):
   return BOOLEAN

Description:

Function EOLN returns TRUE if the file pointer of an open text file has reached a carriage return within the file. Parameter fileName specifies a text file which is open for reading or writing.

説明

開いているファイルの読み込み位置が、行の終端であればTRUEを返します。

Parameters:

fileName Name of file. ファイルのパス

Example:

BEGIN
     Open('MyData');
     WHILE NOT EOLN('MyData') DO
           Read(a,b,c,d);
      Close('MyData');
END;



  ExportIGES File I/O 
Vectorworks 2014

VectorScript Declaration:

FUNCTION   ExportIGES
(   fileName :DYNARRAY[] of CHAR;
    exportSolidAsSurface :BOOLEAN
) :BOOLEAN ;

Python:

def  vs.ExportIGES(fileName, exportSolidAsSurface):
   return BOOLEAN

Description:

Export the document in 3D IGES file.

説明

ファイルをIGESファイルに取り出します。

Parameters:

fileName Output file path. 取り出すファイルのパス
exportSolidAsSurface Export solit objects as surface. ソリッドをサーフェースとして取り出します

Result:

Return TRUE if succeeded.

返り値

成功した場合TRUEを返します。

See Also:

ImportIGES  



  ExportSAT File I/O 
Vectorworks 2013

VectorScript Declaration:

FUNCTION   ExportSAT
(   filePath :DYNARRAY[] of CHAR;
    solidAsSurface :BOOLEAN
) :BOOLEAN ;

Python:

def  vs.ExportSAT(filePath, solidAsSurface):
   return BOOLEAN

Description:

Export the selection into a SAT file.

説明

選択図形をSATファイルに取り出します。

Parameters:

filePath Output file path. 取り出すファイルのパス

Result:

Return TRUE if successful.

返り値

成功した場合はTRUEを返します。



  ExportSTEP File I/O 
Vectorworks 2018

VectorScript Declaration:

FUNCTION   ExportSTEP
(   filePath :DYNARRAY[] of CHAR;
    exportSolidsAsSurfaces :BOOLEAN
) :BOOLEAN ;

Python:

def  vs.ExportSTEP(filePath, exportSolidsAsSurfaces):
   return BOOLEAN

Result:

Return TRUE if successful

返り値

成功した場合はTRUEを返します。



  ExportSTL File I/O 
Vectorworks 2016

VectorScript Declaration:

FUNCTION   ExportSTL
(   filePath :DYNARRAY[] of CHAR;
    exportBinary :BOOLEAN;
    percentTess :REAL;
    exportObjectsOptions :INTEGER
) :BOOLEAN ;

Python:

def  vs.ExportSTL(filePath, exportBinary, percentTess, exportObjectsOptions):
   return BOOLEAN

Description:

Export the objects into a STL file.

説明

図形をSTLファイルに取り出します。

Parameters:

filePath Output file path. 取り出すファイルのパス
exportBinary binary or ASCII output バイナリ形式/ASCII形式
percentTess tessellation resolution -- from 0 to 100 0 -- low, 100 --high 取り出しの品質(0 - 100)
exportObjectsOptions 0 -- export visilble objects selected 1 -- export visible objects in activeLayer 2 -- export visible objects in all Layer 取り出しオプション
0:アクティブレイヤ上で選択した図形
1:アクティブレイヤ上で表示中の図形
2:すべてのレイヤ上で表示中の図形

Result:

Return TRUE if successful.

返り値

成功した場合はTRUEを返します。



  FindFile File I/O 
Vectorworks 2015

VectorScript Declaration:

FUNCTION   FindFile
(   whichPath :INTEGER;
    relFilePath :DYNARRAY[] of CHAR;
  VAR  outPath :DYNARRAY[] of CHAR
) :BOOLEAN ;

Python:

def  vs.FindFile(whichPath, relFilePath):
   return (BOOLEAN, outPath)

Description:

Find a file by searching the folder selector (whichPath) plus the relative file path. Searches the user folder, workgroup folders, and the app folder.

説明

フォルダ番号と相対ファイルパスでファイルを検索します。



  FindFileInPluginFolder File I/O 
VectorWorks12.0

VectorScript Declaration:

FUNCTION   FindFileInPluginFolder
(   filename :DYNARRAY[] of CHAR;
  VAR  path :DYNARRAY[] of CHAR
) :BOOLEAN ;

Python:

def  vs.FindFileInPluginFolder(filename):
   return (BOOLEAN, path)

Description:

Searches for filename in all plug-in folders. Returns TRUE if the file is found, FALSE otherwise. If found, the result is returned in the path parameter.

説明

すべてのプラグインフォルダから指定した名前のファイルを検索します。ファイルがあればTRUE、なければFALSEを返します。ファイルがあった場合、pathパラメータに結果を返します。

Example:

PROCEDURE Example;
VAR
	filename, path :STRING;
BEGIN
	filename := 'Callout.vso';
	IF FindFileInPluginFolder(filename, path) 
		THEN AlrtDialog(path)
		ELSE AlrtDialog('Could not find file.');
END;
RUN(Example);



  GetFile File I/O 
MiniCAD

VectorScript Declaration:

PROCEDURE   GetFile
VAR fileName:DYNARRAY[] of CHAR ) ;

Python:

def  vs.GetFile():
   return fileName

Description:

Procedure GetFile displays a standard file dialog which requests the user to select a text document.

It is advisable to call DidCancel after using this procedure and check that the user did not cancel the file selection process.

説明

ファイルを開くダイアログを表示し、ユーザーが選択したファイルのパスを返します。

Parameters:

fileName Returns name of selected file. ファイルのパス

Example:

GetFile(fileName);
IF NOT DidCancel THEN BEGIN
     Read(a,b,c);
     Close(fileName);
END;
{Select a file for reading via a file open dialog}



  GetFileInfo File I/O 
VectorWorks12.0

VectorScript Declaration:

PROCEDURE   GetFileInfo
(   filename :DYNARRAY[] of CHAR;
  VAR  fullReadPath :DYNARRAY[] of CHAR;
  VAR  fullWritePath :DYNARRAY[] of CHAR;
  VAR  readFileExists :BOOLEAN;
  VAR  writeFileExists :BOOLEAN;
  VAR  locked :BOOLEAN;
  VAR  hasReadPermission :BOOLEAN;
  VAR  hasWritePermission :BOOLEAN;
  VAR  hasFolderPermission :BOOLEAN
) ;

Python:

def  vs.GetFileInfo(filename):
   return (fullReadPath, fullWritePath, readFileExists, writeFileExists, locked, hasReadPermission, hasWritePermission, hasFolderPermission)

Description:

This function gets the attributes of a file.

説明

ファイルの属性を返します。

Example:

PROCEDURE Example;
VAR
   fileName :STRING;
   fullReadPath, fullWritePath :STRING;
   readFileExists, writeFileExists, locked, hasReadPermission, hasWritePermission, hasFolderPermission :BOOLEAN;
BEGIN
   fileName := Concat(GetFolderPath(1), 'ADINIT.DAT');
   GetFileInfo(fileName, fullReadPath, fullWritePath, readFileExists, writeFileExists, locked, hasReadPermission, hasWritePermission, hasFolderPermission);
   ReWrite('Output.txt');
   WriteLn('fileName:            ', fileName);
   WriteLn('fullReadPath:        ', fullReadPath);
   WriteLn('fullWritePath:       ', fullWritePath);
   WriteLn('readFileExists:      ', readFileExists);
   WriteLn('writeFileExists:     ', writeFileExists);
   WriteLn('locked:              ', locked);
   WriteLn('hasReadPermission:   ', hasReadPermission);
   WriteLn('hasWritePermission:  ', hasWritePermission);
   WriteLn('hasFolderPermission: ', hasFolderPermission);
   Close('Output.txt');
END;
RUN(Example);



  GetFileN File I/O 
Vectorworks 2014

VectorScript Declaration:

FUNCTION   GetFileN
(   title :DYNARRAY[] of CHAR;
    defaultFolder :DYNARRAY[] of CHAR;
    mask :DYNARRAY[] of CHAR;
  VAR  fileName :DYNARRAY[] of CHAR
) :BOOLEAN ;

Python:

def  vs.GetFileN(title, defaultFolder, mask):
   return (BOOLEAN, fileName)

Description:

Returns the fully-qualified pathname of the selected file.

説明

ファイル選択ダイアログを表示し、選択したファイルのフルパスを返します。



  GetFilesInFolder File I/O 
Vectorworks 2014

VectorScript Declaration:

FUNCTION   GetFilesInFolder
(   folderName :DYNARRAY[] of CHAR;
    index :LONGINT
) :DYNARRAY[] of CHAR ;

Python:

def  vs.GetFilesInFolder(folderName, index):
   return DYNARRAY of CHAR

Description:

Returns the Nth filename in a folder.

説明

フォルダー中のN番目のファイル名を返します。



  GetFileSize File I/O 
Vectorworks 2017

VectorScript Declaration:

FUNCTION   GetFileSize
VAR FilePath:STRING ) :LONGINT ;

Python:

def  vs.GetFileSize(FilePath):
   return (LONGINT, FilePath)

Result:

Returns the size of a file in bytes.

返り値

ファイルサイズをバイト単位で返します。



  GetFolder File I/O 
Vectorworks 2014

VectorScript Declaration:

FUNCTION   GetFolder
(   promptStr :STRING;
  VAR  directoryPath :DYNARRAY[] of CHAR
) :INTEGER ;

Python:

def  vs.GetFolder(promptStr):
   return (INTEGER, directoryPath)

Description:

Gets the path to a user selected folder

説明

ユーザーの選択したフォルダーのパスを取得します。



  GetFolderPath File I/O 
VectorWorks8.0

VectorScript Declaration:

FUNCTION   GetFolderPath
( whichPath:INTEGER ) :DYNARRAY[] of CHAR ;

Python:

def  vs.GetFolderPath(whichPath):
   return DYNARRAY of CHAR

Description:

Function GetFolderPath returns the full path to the requested folder independent of localized folder names.

Table - Folder Path Selectors

Note that use of the negative values of these constants can be used to get the user-based folder path. The positive values are for application-based paths, which should not be used for writing.

Folder Name Constant
Application 1
Plug-Ins 2
Workspaces 4
Templates 7
Standards 8
Help 9
Dictionaries 10
User App Data 12
Libraries 13
Defaults 14
Settings 15
PDF Resources 18
Plug-In Data 20
Plug-In Includes 21
Plug-In interfaces 22
Favorites 23
Renderworks - Textures 100
Cabinet - Handles 101
Door - Hardware 102
Attributes - Gradients 103
Hardscape - Hatches 104
Attributes - Hatches 105
Attributes - Image Fills 106
Plants 107
Toilet Stall - Fixtures 108
RenderWorks - Backgrounds 109
Seating Layout - Symbols 110
Tile - Symbols 111
Human Figure - Textures 112
Walls 113
Stairs 114
Drawing Border - Title Blocks 115
Section - Markers 116
Repetitive Unit 117
Door - Custom Leaves 118
Lighting Instrument - Gobos 119
Reports~Schedules 120
Lighting Instrument - Symbols 121
Plants - Hatches 124
Repetitive Unit: Flooring/Decking 125
Repetitive Unit: Framing 126
Repetitive Unit: Masonry Units 127
Repetitive Unit: Miscellaneous 128
Repetitive Unit: Roofing 129
Repetitive Unit: Siding 130
Walls - Hatches 131
Walls - Textures 132
Window - Custom Shutters 133
Sketch Styles 134
Plant Database 135
VW Plants 136
Color Palettes 137
Framing Member - Custom Profile 138
Spaces - Occupant Organization Name Lists 140
Spaces - Space Name Lists and Libraries 141
Structural Shapes 142


説明

指定した種類のフォルダへのパスを文字列で返します。

Parameters:

whichPath Path constant. フォルダ番号

Example:

PROCEDURE Example;
BEGIN
	AlrtDialog(GetFolderPath(12));
END;
RUN(Example);



  GetFPathName File I/O 
Vectorworks 2014

VectorScript Declaration:

FUNCTION   GetFPathName
:DYNARRAY[] of CHAR ;

Python:

def  vs.GetFPathName():
   return DYNARRAY of CHAR

Description:

Returns the fully-qualified file path of the active document.

説明

アクティブな書類のフルパスを取得します。



  GetLastFileErr File I/O 
VectorWorks8.5

VectorScript Declaration:

FUNCTION   GetLastFileErr
:INTEGER ;

Python:

def  vs.GetLastFileErr():
   return INTEGER

Description:

Returns an error code indicating whether an error occured during a file operation.

This function should be called after file I/O calls such as Open() or Rewrite().

説明

ファイルの入出力作業でエラーが発生した場合に、エラーコードを返します。

Example:

UseDefaultFileErrorHandling(FALSE);
Open(Concat(pathName, fileName));
errorCode := GetLastFileErr;
IF errorCode <> 0 THEN
	CASE errorCode OF
		 2: AlrtDialog(Concat('The file "', fileName, '" cannot be processed because the hard drive is full.'));
		 4: AlrtDialog(Concat('End of file "',   fileName, '" reached prematurely.'));
		 5: AlrtDialog(Concat('The file "', fileName, '" is locked.'));
		 6: AlrtDialog(Concat('The file "', fileName, '" not found.'));
		10: AlrtDialog(Concat('The file "', fileName, '" currently in use by another program.'));
		13: AlrtDialog(Concat('The file path "', pathName, '" does not exist.'));
		OTHERWISE AlrtDialog(Concat('The file "',fileName,'" has encountered an undetermined error.'));
	END;



  ImportIGES File I/O 
Vectorworks 2014

VectorScript Declaration:

FUNCTION   ImportIGES
( fileName:DYNARRAY[] of CHAR ) :BOOLEAN ;

Python:

def  vs.ImportIGES(fileName):
   return BOOLEAN

Description:

Import a 3D IGES file.

説明

ImportIGES

Parameters:

fileName full path to the file for import 取り込むファイルのフルパス

Result:

Return TRUE if succeeded.

返り値

成功した場合TRUEを返します。

See Also:

ExportIGES  



  ImportParasolidXT File I/O 
Vectorworks 2020

VectorScript Declaration:

FUNCTION   ImportParasolidXT
( filePath:STRING ) :BOOLEAN ;

Python:

def  vs.ImportParasolidXT(filePath):
   return BOOLEAN

Description:

Imports the provided Parasolid XT file.

説明

指定したParasolid XTファイルを取り込みます。

Parameters:

filePath The full path to the file to be imported. ファイルのフルパス



  ImportSAT File I/O 
Vectorworks 2013

VectorScript Declaration:

FUNCTION   ImportSAT
(   filePath :DYNARRAY[] of CHAR;
    doSingleSym :BOOLEAN
) :HANDLE ;

Python:

def  vs.ImportSAT(filePath, doSingleSym):
   return HANDLE

Description:

Import a SAT file.

説明

SATファイルを取り込みます。

Parameters:

filePath full path to the file for import ファイルのフルパス
doSingleSym import the file as a symbol シンボルとして取り込むかどうか

Result:

Return handle to the imported symbol, or to the first imported object (first selected).

返り値

取り込んだシンボルのハンドルまたは1番目の(選択)図形のハンドルを返します。



  ImportSketchup1 File I/O 
Vectorworks 2014

VectorScript Declaration:

FUNCTION   ImportSketchup1
(   filePath :STRING;
    doSingleSym :BOOLEAN
) :BOOLEAN ;

Python:

def  vs.ImportSketchup1(filePath, doSingleSym):
   return BOOLEAN

Description:

Import a sketch up file.

説明

SketchUp ( *.skp) ファイルを取り込みます。



  Open File I/O 
MiniCAD

VectorScript Declaration:

PROCEDURE   Open
( fileName:DYNARRAY[] of CHAR ) ;

Python:

def  vs.Open(fileName):
   return None

Description:

Procedure Open opens a ASCII text file for reading.

Remember to use Close when you are finished reading or writing to a file.

If the filename includes a fully qualified path, the path has to use the appropriate notation for the local operating system:
Macintosh HD:Applications:Vectorworks:Plug-Ins:Data:Notes.txt C:\Program Files\Vectorworks\Plug-Ins\Data\Notes.txt If the filename includes a path relative to the location of the Vectorworks executable, the subfolder delimiters have to be backslashes:
Plug-Ins\Data\Notes.txt If the filename does not include a path, the file is assumed to exist in the same folder as the Vectorworks executable.

説明

指定したファイルのパスを使って、ファイルを開きます。

Parameters:

fileName Name or path of file to open. ファイルのパス

Example:

PROCEDURE Example;
VAR
	fileName :STRING;
BEGIN
	UseDefaultFileErrorHandling(FALSE);
	fileName := 'Plug-Ins\Common\Data\Callout Prefs.txt';
	Open(fileName);
	AlrtDialog(Concat(GetLastFileErr));
	Close(fileName);
END;
RUN(Example);



  PutFile File I/O 
MiniCAD

VectorScript Declaration:

PROCEDURE   PutFile
(   commentStr :DYNARRAY[] of CHAR;
    defaultStr :DYNARRAY[] of CHAR;
  VAR  fileName :DYNARRAY[] of CHAR
) ;

Python:

def  vs.PutFile(commentStr, defaultStr):
   return fileName

Description:

Procedure PutFile displays a standard file dialog which requests the user to select or create a text file for output.

説明

ファイル保存ダイアログを表示し、ユーザーが指定したファイルのパスを返します。

Parameters:

commentStr User prompt string for dialog. ダイアログのプロンプト文字
defaultStr Default file name string. デフォルトのファイルの名前
fileName Returns name of the user selected file. ファイルのパス

Example:

PROCEDURE PutFileExample;
VAR
	fileName :STRING;
BEGIN
	PutFile('Select the file to create:', 'New File.txt', fileName);
	Message(fileName);
	IF NOT DidCancel THEN BEGIN
		WriteLn('some text');
		Close(fileName);
	END;
END;
RUN(PutFileExample);

See Also:

GetLastFileErr   Rewrite   GetFile   Open   Close  



  Read File I/O 
MiniCAD

VectorScript Declaration:

PROCEDURE   Read
( VAR  z :ANY
) ;

Python:

def  vs.Read():
   return z

Description:

Procedure Read will read data from a currently open text file. The variable length parameter list returns the read data in the specified parameters.Supported data types include INTEGER, REAL, LONGINT, CHAR or STRING.

Non STRING data values must be separated by a tab or space to be correctly read into variables. If the procedure encounters an EOF(end-of-file) marker, an error is generated. Read does not position the file position pointer to the beginning of a new line after the procedure is called.

Read will detect tabs as delimiters, allowing multiple string values to be assigned to variables.

説明

開いているファイルからデータを読み込みます。



  ReadBin File I/O 
Vectorworks 2018

VectorScript Declaration:

PROCEDURE   ReadBin
( VAR  z :ANY
) ;

Python:

def  vs.ReadBin():
   return z

Description:

Procedure ReadBin will read binary data from a currently open file. The variable length parameter list returns the read data in the specified parameters.

Supported data types include INTEGER (2-bytes), REAL (8-bytes), LONGINT (4-bytes), CHAR (1-byte) or STRING/DYNARRAY OF CHAR (see remarks).

The bytes will be written as little-endian.

Strings will require additional INTEGER parameter to specify encoding: 0 – mac; 1 – win; 2 – system; 3 – UTF8; 4 – UTF16.

説明

開いているバイナリファイルからデータを読み込みます。

対応するデータ型は INTEGER (2-bytes), REAL (8-bytes), LONGINT (4-bytes), CHAR (1-byte) or STRING/DYNARRAY OF CHAR (備考参照).

バイト列はリトルエンディアンで書き込まれます。

備考:文字列にはエンコーディングを指定する追加のINTEGER型パラメータが必要です。(エンコーディング:0 – mac; 1 – win; 2 – システム; 3 – UTF8; 4 – UTF16)



  ReadLn File I/O 
MiniCAD

VectorScript Declaration:

PROCEDURE   ReadLn
( VAR  z :ANY
) ;

Python:

def  vs.ReadLn():
   return z

Description:

Procedure ReadLn will read data from a currently open text file. The variable length parameter list returns the read data in the specified parameters.

Supported data types include INTEGER, REAL, LONGINT, CHAR or STRING. If the procedure encounters an EOF(end-of-file) marker, an error is generated. ReadLn positions the file position pointer to the beginning of a new line after the procedure is called.

ReadLn will detect tabs as delimiters, allowing multiple string values to be assigned to variables.

説明

開いているファイルから1行分のデータを読み込みます。

Example:

PROCEDURE Example;
VAR
   fileName, value1, value2, value3 :STRING; 
   major, minor, maintenance, platform :INTEGER;
BEGIN
   GetVersion(major, minor, maintenance, platform);
   IF platform = 1 THEN BEGIN
      fileName := '/Example.txt';
   END ELSE BEGIN
      fileName := 'C:\Example.txt';
   END;
   Open(fileName);
   ReadLn(value1, value2, value3);
   Close(fileName);
   AlrtDialog(lineOfText);
END;
RUN(Example);



  Rewrite File I/O 
MiniCAD

VectorScript Declaration:

PROCEDURE   Rewrite
( fileName:DYNARRAY[] of CHAR ) ;

Python:

def  vs.Rewrite(fileName):
   return None

Description:

Procedure Rewrite creates a new ASCII text file or opens an existing one prior to writing data to the file. If the file exists, new data written to the file will overwrite any data currently within the file.

If the filename includes a fully qualified path, the path has to use the appropriate notation for the local operating system:
Macintosh HD:Applications:Vectorworks:Plug-Ins:Data:Notes.txt C:\Program Files\Vectorworks\Plug-Ins\Data\Notes.txt If the filename includes a path relative to the location of the Vectorworks executable, the subfolder delimiters have to be backslashes:
Plug-Ins\Data\Notes.txt If the filename does not include a path, the file is assumed to exist in the same folder as the Vectorworks executable.

説明

指定したファイルのパスに新しいファイルを作成します。

Parameters:

fileName Name of file. ファイルのパス

Example:

PROCEDURE Example;
VAR
   fileName :STRING; 
   major, minor, maintenance, platform :INTEGER;
BEGIN
   GetVersion(major, minor, maintenance, platform);
   IF platform = 1 THEN BEGIN
      fileName := '/Example.txt';
   END ELSE BEGIN
      fileName := 'C:\Example.txt';
   END;
   ReWrite(fileName);
   WriteLn('example text');
   Close(fileName);
END;
RUN(Example);



  SaveActiveDocument File I/O 
Vectorworks 2014

VectorScript Declaration:

FUNCTION   SaveActiveDocument
( filePath:DYNARRAY[] of CHAR ) :LONGINT ;

Python:

def  vs.SaveActiveDocument(filePath):
   return LONGINT

Description:

Saves a file with out presenting dialogs

説明

ダイアログを表示せずにファイルを保存します。



  Space File I/O 
MiniCAD

VectorScript Declaration:

PROCEDURE   Space
( n:INTEGER ) ;

Python:

def  vs.Space(n):
   return None

Description:

Procedure Space writes a space to the current output file.

説明

指定した数のスペースを、現在書き込み中のファイルに出力します。

Parameters:

n Number of spaces. スペースの数

Example:

Space(5);
{write 5 spaces to the output file}



  StdRead File I/O 
VectorWorks8.0

VectorScript Declaration:

PROCEDURE   StdRead
( VAR  z :ANY
) ;

Python:

def  vs.StdRead():
   return z

Description:

Procedure StdRead will read data from a currently open text file. The variable length parameter list returns the read data in the specified parameters.

Supported data types include INTEGER, REAL, LONGINT, CHAR or STRING. Non STRING data values must be separated by a tab or space to be correctly read into variables. If the procedure encounters an EOF(end-of-file) marker, an error is generated. StdRead does not position the file position pointer to the beginning of a new line after the procedure is called.

StdRead reads data according to the Pascal language standard. This differs from the Read procedure found in VectorScript primarily when reading STRING data. StdRead will read all characters, including tabs and spaces, as a single string value. Read will detect tabs as delimiters, allowing multiple string values to be assigned to variables.

説明

開いているファイルからデータを読み込みます。

Example:

GetFile(fName);
IF NOT DidCancel THEN BEGIN
Open(fName);
StdRead(partID,partName);
END;



  StdReadLn File I/O 
VectorWorks8.0

VectorScript Declaration:

PROCEDURE   StdReadLn
( VAR  z :ANY
) ;

Python:

def  vs.StdReadLn():
   return z

Description:

Procedure StdReadLn will read data from a currently open text file. The variable length parameter list returns the read data in the specified parameters.

Supported data types include INTEGER, REAL, LONGINT, CHAR or STRING. Non STRING data values must be separated by a tab or space to be correctly read into variables. If the procedure encounters an EOF(end-of-file) marker, an error is generated. StdReadLn positions the file position pointer to the beginning of a new line after the procedure is called.

StdReadLn reads data according to the Pascal language standard. This differs from the ReadLn procedure found in VectorScript primarily when reading STRING data. StdReadLn will read all characters, including tabs and spaces, as a single string value. ReadLn will detect tabs as delimiters, allowing multiple string values to be assigned to variables.

説明

開いているファイルから1行分のデータを読み込みます。

Example:

GetFile(fName);
IF NOT DidCancel THEN BEGIN
Open(fName);
StdReadLn(partID,partName);
END;



  Tab File I/O 
MiniCAD

VectorScript Declaration:

PROCEDURE   Tab
( n:INTEGER ) ;

Python:

def  vs.Tab(n):
   return None

Description:

Procedure Tab writes a tab character to the current output file.

説明

指定した数のタブを、現在書き込み中のファイルに出力します。

Parameters:

n Number of tab characters to be written to file. タブの数

Example:

Tab(2);
{writes two tabs to the output file}



  UseDefaultFileErrorHandling File I/O 
VectorWorks8.5

VectorScript Declaration:

PROCEDURE   UseDefaultFileErrorHandling
( enable:BOOLEAN ) ;

Python:

def  vs.UseDefaultFileErrorHandling(enable):
   return None

Description:

Enables or disables file I/O alert dialogs.

Use this function with GetLastFileErr() to implement custom error handling for file operations.

説明

入出力エラーダイアログの表示/非表示を設定します。 TRUE=表示/FALSE=非表示

Parameters:

enable Status of file error dialog usage. 入出力エラーダイアログ

See Also:

GetLastFileErr  



  Write File I/O 
MiniCAD

VectorScript Declaration:

PROCEDURE   Write
(   z :ANY
) ;

Python:

def  vs.Write(z):
   return None

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.

説明

開いているファイルにデータを書き込みます。

Example:

Write(Value1);



  WriteBin File I/O 
Vectorworks 2018

VectorScript Declaration:

PROCEDURE   WriteBin
(   z :ANY
) ;

Python:

def  vs.WriteBin(z):
   return None

Description:

Procedure WriteBin outputs the specified data to a binary file. The variable length parameter list specifies the data to be written to the file.

Supported data types include INTEGER (2-bytes), REAL (8-bytes), LONGINT (4-bytes), CHAR (1-byte) or STRING/DYNARRAY OF CHAR (see remarks).

The bytes will be written as little-endian.

Strings will require two additional INTEGER parameters: symbol count and encoding: 0 – mac; 1 – win; 2 – system; 3 – UTF8; 4 – UTF16.

説明

指定したデータをバイナリファイルに出力します。

対応するデータ型は INTEGER (2-bytes), REAL (8-bytes), LONGINT (4-bytes), CHAR (1-byte) or STRING/DYNARRAY OF CHAR (備考参照).

バイト列はリトルエンディアンで書き込まれます。

備考:文字列にはエンコーディングを指定する追加のINTEGER型パラメータが必要です。(エンコーディング:0 – mac; 1 – win; 2 – システム; 3 – UTF8; 4 – UTF16)

Example:

WriteBin(Value1);



  WriteLn File I/O 
MiniCAD

VectorScript Declaration:

PROCEDURE   WriteLn
(   z :ANY
) ;

Python:

def  vs.WriteLn(z):
   return None

Description:

Procedure WriteLn 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. A carriage return is appended to the end of the line of data, so that the file pointer is at the beginning of a new line in the file, and any data written to the file after the procedure call will be on the new line.

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

説明

開いているファイルにデータを書き込み、改行します。

Example:

PROCEDURE Example;
CONST
	Vendor = 'ACME';
	Price = 123.45;
	Tax = 1.07;
BEGIN
	ReWrite('Output.txt');
	WriteLn('Mfr/Cost: ', Vendor, '/', Price + Tax);
	Close('Output.txt');
END;
RUN(Example);

See Also:

WriteLnMac  



  WriteLnMac File I/O 
VectorWorks9.0

VectorScript Declaration:

PROCEDURE   WriteLnMac
(   z :ANY
) ;

Python:

def  vs.WriteLnMac(z):
   return None

Description:

Writes a line of data to a text file using Macintosh character encoding for extended ASCII characters (128-255). This allows extended character data to be properly read and displayed by Vectorworks on Windows systems (Vectorworks by default uses Macintosh encoding for extended character values).

The line of data written to file is terminated with a return character combination appropriate for the platform on which the file is being written.

説明

開いているファイルにデータを書き込み、改行します。ファイルはどのプラットフォームでもVectorScriptとして読み戻すことができます。

Example:

PROCEDURE Example;
CONST
	Vendor = 'ACME';
	Price = 123.45;
	Tax = 1.07;
BEGIN
	Open('Output.txt');
	WriteLnMac('Mfr/Cost: ', Vendor, '/', Price + Tax);
	Close('Output.txt');
END;
RUN(Example);

See Also:

WriteLn  



  WriteMac File I/O 
VectorWorks9.0

VectorScript Declaration:

PROCEDURE   WriteMac
(   z :ANY
) ;

Python:

def  vs.WriteMac(z):
   return None

Description:

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. WriteMac 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.

説明

開いているファイルにデータを書き込みます。ファイルはどのプラットフォームでもVectorScriptとして読み戻すことができます。

Example:

WriteMac(Value1);