AddResourceToList Document List Handling 
VectorWorks12.0

VectorScript Declaration:

FUNCTION   AddResourceToList
(   listID :LONGINT;
    resource :HANDLE
) :LONGINT ;

Python:

def  vs.AddResourceToList(listID, resource):
   return LONGINT

Description:

Adds the indicated resource to the specified resource list, if it is of the same type as the items already in the list. Returns the index of the resource in the list or 0.

Parameters:

listID an ID for a resource list created by the BuildResourceList command.
resource a resource to add to the resource list.

Example:

{ Create a new hatch and add it to the resource list. }
hatchName := 'Hatch-1';
BeginVectorFillN(hatchName, true, false, 0);
AddVectorFillLayer(0, 0, 1, 1, .25, -.25, .7, 3, 255);
EndVectorFill;
newHatch := GetObject(hatchName);
index := AddResourceToList(listID, newHatch);



  BuildResourceList Document List Handling 
VectorWorks12.0

VectorScript Declaration:

FUNCTION   BuildResourceList
(   type :INTEGER;
    folderIndex :INTEGER;
    subFolderName :STRING;
  VAR  numItems :LONGINT
) :LONGINT ;

Python:

def  vs.BuildResourceList(type, folderIndex, subFolderName):
   return (LONGINT, numItems)

Description:

Creates an implicit list of resources of a specified type, and returns an ID for the list. Values in the list can be retrieved using GetNameFromResourceList.

If the Display Default Content preference (#130) is on and folderIndex is not 0, it will also include all the resources of the specified type in all the files in the selected folder.

If folderIndex is positive, the list will include all the resources of that type from the current document, as well as from the specified folder. If folderIndex is 0, only the resources in the current document will be in the list. If folderIndex is negative, only the resources in the specified folder will be in the list.

A complete listing of supported object types may be found in the Appendix.

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:

type the type of resource to put in the list
folderIndex the index of a VW folder.
subFolderName the name of a subfolder inside the folder specified by folderIndex. This can also be a partial path. Use an empty string to request the resources from all files in the folderIndex folder.
numItems the number of items in the list built

Example:

const
kHatch = 66;
kDefHatchFolder = 105;
var
listID, numItems: LONGINT;
begin
{ Create a resource list of hatches from the current document and } 
{ the default hatch folder. }
listID := BuildResourceList(kHatch, kDefHatchFolder, '', numItems);

See Also:

AddResourceToList   DeleteResourceFromList   GetNameFromResourceList   GetResourceFromList   ImportResourceToCurrentFile  



  BuildResourceList2 Document List Handling 
Vectorworks 2014

VectorScript Declaration:

FUNCTION   BuildResourceList2
(   type :INTEGER;
    folderIndex :INTEGER;
    subFolderName :STRING;
  VAR  numItems :LONGINT;
    useDefaultContent :BOOLEAN
) :LONGINT ;

Python:

def  vs.BuildResourceList2(type, folderIndex, subFolderName, useDefaultContent):
   return (LONGINT, numItems)

Description:

Creates an implicit list of resources of a specified type, and returns an ID for the list. Values in the list can be retrieved using GetNameFromResourceList.

If the Display Default Content preference (#130) is on and folderIndex is not 0, it will also include all the resources of the specified type in all the files in the selected folder.

If folderIndex is positive, the list will include all the resources of that type from the current document, as well as from the specified folder. If folderIndex is 0, only the resources in the current document will be in the list. If folderIndex is negative, only the resources in the specified folder will be in the list.

A complete listing of supported object types may be found in the Appendix.

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:

type the type of resource to put in the list
folderIndex the index of a VW folder.
subFolderName the name of a subfolder inside the folder specified by folderIndex. This can also be a partial path. Use an empty string to request the resources from all files in the folderIndex folder.
numItems the number of items in the list built
useDefaultContent determine if the list should contain default content

See Also:

BuildResourceList   BuildResourceListN   BuildResourceListN2   AddResourceToList   DeleteResourceFromList   GetNameFromResourceList   GetResourceFromList   ImportResourceToCurrentFile  



  BuildResourceListN Document List Handling 
Vectorworks 2013

VectorScript Declaration:

FUNCTION   BuildResourceListN
(   type :INTEGER;
    fullPath :DYNARRAY[] of CHAR;
  VAR  numItems :LONGINT
) :LONGINT ;

Python:

def  vs.BuildResourceListN(type, fullPath):
   return (LONGINT, numItems)

Description:

Build a resource list from the specified file.

Parameters:

type the type of resource to put in the list
fullPath The path to the file that provides the resources.
numItems the number of items in the list built

See Also:

BuildResourceList  



  BuildResourceListN2 Document List Handling 
Vectorworks 2014

VectorScript Declaration:

FUNCTION   BuildResourceListN2
(   type :INTEGER;
    fullPath :DYNARRAY[] of CHAR;
  VAR  numItems :LONGINT;
    useDefaultContent :BOOLEAN
) :LONGINT ;

Python:

def  vs.BuildResourceListN2(type, fullPath, useDefaultContent):
   return (LONGINT, numItems)

Description:

Build a resource list from the specified file.

Parameters:

type the type of resource to put in the list
fullPath The path to the file that provides the resources.
numItems the number of items in the list built
useDefaultContent determine if the list should contain default content

See Also:

BuildResourceListN   BuildResourceList   BuildResourceList2  



  DeleteResourceFromList Document List Handling 
VectorWorks12.0

VectorScript Declaration:

PROCEDURE   DeleteResourceFromList
(   listID :LONGINT;
    index :LONGINT
) ;

Python:

def  vs.DeleteResourceFromList(listID, index):
   return None

Description:

Deletes the indicated object in the specified resource list.

Parameters:

listID an ID for a resource list created by the BuildResourceList function.
index an index into the list.

Example:

hatchName := GetNameFromResourceList(listID, index);
if (pos('P', hatchName) = 1) then
	DeleteResourceFromList(listID, index)



  FActLayer Document List Handling 
MiniCAD

VectorScript Declaration:

FUNCTION   FActLayer
:HANDLE ;

Python:

def  vs.FActLayer():
   return HANDLE

Description:

Function FActLayer returns a handle to the first object on the active layer. If the object does not exist, the function returns NIL.




  FIn3D Document List Handling 
MiniCAD

VectorScript Declaration:

FUNCTION   FIn3D
( objectHd:HANDLE ) :HANDLE ;

Python:

def  vs.FIn3D(objectHd):
   return HANDLE

Description:

Function FIn3D returns a handle to the first component object in the referenced 3D object definition.

Parameters:

objectHd Handle to object.



  FInFolder Document List Handling 
MiniCAD

VectorScript Declaration:

FUNCTION   FInFolder
( sfHd:HANDLE ) :HANDLE ;

Python:

def  vs.FInFolder(sfHd):
   return HANDLE

Description:

Function FInFolder returns a handle to the first object in the referenced symbol folder. The object can be either a symbol definition or a nested symbol folder.
If the folder is empty, the function returns NIL.

Parameters:

sfHd Handle to symbol definition or symbol folder.



  FInGroup Document List Handling 
MiniCAD

VectorScript Declaration:

FUNCTION   FInGroup
( ObjectHd:HANDLE ) :HANDLE ;

Python:

def  vs.FInGroup(ObjectHd):
   return HANDLE

Description:

Function FInGroup returns a handle to the first component object of the referenced group.

Parameters:

ObjectHd Handle to group object.

Example:

PROCEDURE Example;
VAR
	h :HANDLE;
BEGIN
	h := FInGroup(FSActLayer);
	WHILE h <> NIL DO BEGIN
		SetClass(h, 'None');
		h := NextObj(h);
	END;
END;
RUN(Example);



  FInLayer Document List Handling 
MiniCAD

VectorScript Declaration:

FUNCTION   FInLayer
( h:HANDLE ) :HANDLE ;

Python:

def  vs.FInLayer(h):
   return HANDLE

Description:

Function FInLayer returns a handle to the first object within the referenced layer. If the layer is empty, the function returns NIL.

Parameters:

h Handle to layer.



  FInSymDef Document List Handling 
MiniCAD

VectorScript Declaration:

FUNCTION   FInSymDef
( sdHd:HANDLE ) :HANDLE ;

Python:

def  vs.FInSymDef(sdHd):
   return HANDLE

Description:

Function FInSymDef returns a handle to the first component object within the referenced symbol definition.

Parameters:

sdHd Handle to symbol definition.



  FObject Document List Handling 
MiniCAD

VectorScript Declaration:

FUNCTION   FObject
:HANDLE ;

Python:

def  vs.FObject():
   return HANDLE

Description:

Function FObject returns a handle to the first object in the active document. If the document is empty, the function returns NIL.




  FSActLayer Document List Handling 
MiniCAD

VectorScript Declaration:

FUNCTION   FSActLayer
:HANDLE ;

Python:

def  vs.FSActLayer():
   return HANDLE

Description:

Function FSActLayer returns a handle to the first selected object on the active layer. If no objects are selected, the function returns NIL.




  FSObject Document List Handling 
MiniCAD

VectorScript Declaration:

FUNCTION   FSObject
( h:HANDLE ) :HANDLE ;

Python:

def  vs.FSObject(h):
   return HANDLE

Description:

Function FSObject returns the handle to the first selected object in the referenced layer. If no objects are selected, the function returns NIL.

Parameters:

h Handle to layer.



  FSymDef Document List Handling 
MiniCAD

VectorScript Declaration:

FUNCTION   FSymDef
:HANDLE ;

Python:

def  vs.FSymDef():
   return HANDLE

Description:

Function FSymDef returns a handle to the first symbol definition in the current document's symbol library. If the symbol library is empty, the function returns NIL.




  GetActualNameFromResourceList Document List Handling 
VectorWorks12.0

VectorScript Declaration:

FUNCTION   GetActualNameFromResourceList
(   listID :LONGINT;
    index :LONGINT
) :STRING ;

Python:

def  vs.GetActualNameFromResourceList(listID, index):
   return STRING

Description:

Returns the actual name of the indicated item in the specified resource list. This call will delete the filename that is appended for resources with same name from different files.

Parameters:

listID an ID for a resouce list created by the BuildResourceList function.
index an index into the list.

Example:

displayName := GetActualNameFromResourceList(listID, index);

See Also:

GetNameFromResourceList  



  GetNameFromResourceList Document List Handling 
VectorWorks12.0

VectorScript Declaration:

FUNCTION   GetNameFromResourceList
(   listID :LONGINT;
    index :LONGINT
) :STRING ;

Python:

def  vs.GetNameFromResourceList(listID, index):
   return STRING

Description:

Returns the name to display of the indicated item in the specified resource list. If the list has items with the same name from different files, the display name will have the filename added to it in parentheses.

Parameters:

listID an ID for a resouce list created by the BuildResourceList function.
index an index into the list.

Example:

hatchName := GetNameFromResourceList(listID, index);
if (pos('P', hatchName) = 1) then
	DeleteResourceFromList(listID, index)

See Also:

GetActualNameFromResourceList  



  GetResourceFromList Document List Handling 
VectorWorks12.0

VectorScript Declaration:

FUNCTION   GetResourceFromList
(   listID :LONGINT;
    index :LONGINT
) :HANDLE ;

Python:

def  vs.GetResourceFromList(listID, index):
   return HANDLE

Description:

Returns the indicated resource from the indicated resource list, if the resource is in the current document. Otherwise it returns nil.

Parameters:

listID an ID for a resource list created by the BuildResourceList command.
index an index into the list.

Example:

hatch := GetResourceFromList(listID, index);
if (hatch = NIL) then
	hatch := ImportResourceToCurrentFile(listID, index);



  ImportResourceToCurrentFile Document List Handling 
VectorWorks12.0

VectorScript Declaration:

FUNCTION   ImportResourceToCurrentFile
(   listID :LONGINT;
    index :LONGINT
) :HANDLE ;

Python:

def  vs.ImportResourceToCurrentFile(listID, index):
   return HANDLE

Description:

Imports the indicated resource from the specified list to the current file, if it is not already in the current file, and returns the handle to the resource.

Parameters:

listID an ID for a resource list created by the BuildResourceList command.
index an index into the list.

Example:

hatch := GetResourceFromList(listID, index);
if (hatch = NIL) then
	hatch := ImportResourceToCurrentFile(listID, index);



  ImportResToCurFileN Document List Handling 
Vectorworks 2014

VectorScript Declaration:

FUNCTION   ImportResToCurFileN
(   listID :LONGINT;
    index :LONGINT;
    callback :PROCEDURE
) :HANDLE ;

Python:

def  vs.ImportResToCurFileN(listID, index, callback):
   return HANDLE

Description:

Imports the indicated resource from the specified list to the current file, if it is not already in the current file, and returns the handle to the resource. It will use a callback function to determine how to handle duplicate resouce.



  LActLayer Document List Handling 
MiniCAD

VectorScript Declaration:

FUNCTION   LActLayer
:HANDLE ;

Python:

def  vs.LActLayer():
   return HANDLE

Description:

Function LActLayer returns a handle to the last object in the active layer.



  LNewObj Document List Handling 
MiniCAD

VectorScript Declaration:

FUNCTION   LNewObj
:HANDLE ;

Python:

def  vs.LNewObj():
   return HANDLE

Description:

Returns a handle to the last object created by a VectorScript function call during the current script execution.


Result:

Returns a HANDLE to the most recently created object, otherwise returns NIL.



  LObject Document List Handling 
MiniCAD

VectorScript Declaration:

FUNCTION   LObject
:HANDLE ;

Python:

def  vs.LObject():
   return HANDLE

Description:

Function LObject returns a handle to the last object in the active document.



  LSActLayer Document List Handling 
MiniCAD

VectorScript Declaration:

FUNCTION   LSActLayer
:HANDLE ;

Python:

def  vs.LSActLayer():
   return HANDLE

Description:

Function LSActLayer returns a handle to the last selected object on the active layer. If no objects are selected, the function returns NIL.




  NextDObj Document List Handling 
MiniCAD

VectorScript Declaration:

FUNCTION   NextDObj
( h:HANDLE ) :HANDLE ;

Python:

def  vs.NextDObj(h):
   return HANDLE

Description:

Function NextDObj returns the next deselected object after the referenced object in a list. If the end of the list is reached, the function returns NIL.

Parameters:

h Handle to object.

Example:

handleToObject:=FObject;
WHILE handleToObject <> NIL DO BEGIN
  SetSelect(handleToObject);
  handleToObject:=NextDObj(handleToObject);
END;
{ selects all deselected objects }



  NextLayer Document List Handling 
MiniCAD

VectorScript Declaration:

FUNCTION   NextLayer
( h:HANDLE ) :HANDLE ;

Python:

def  vs.NextLayer(h):
   return HANDLE

Description:

Function NextLayer returns a handle to the next layer in the document after the referenced. If the end of the list has been reached, the function returns NIL.

Parameters:

h Handle to layer.

Example:

handleToLayer:=FLayer;
WHILE handleToLayer <> NIL DO BEGIN
  SysBeep;
  handleToLayer:=NextLayer(handleToLayer);
END; 
{ will process through all the layers in the list }



  NextObj Document List Handling 
MiniCAD

VectorScript Declaration:

FUNCTION   NextObj
( h:HANDLE ) :HANDLE ;

Python:

def  vs.NextObj(h):
   return HANDLE

Description:

Function NextObj returns the next object in any list . If the end of the list is reached, the function returns NIL. This procedure can be used with other handle routines such as FirstIn3D,FInGroup, FirstInSymDef, or FLayer.

Parameters:

h Handle to object, group, or symbol definition.

Example:

handleToObject:=FObject;
WHILE handleToObject <> NIL DO BEGIN
  i:=i+1;
  handleToObject:=NextObj(handleToObject);
END;



  NextSObj Document List Handling 
MiniCAD

VectorScript Declaration:

FUNCTION   NextSObj
( h:HANDLE ) :HANDLE ;

Python:

def  vs.NextSObj(h):
   return HANDLE

Description:

Function NextSObj returns the next selected object in a list. If the end of the list is reached, the function returns NIL.

Parameters:

h Handle to object.



  NextSymDef Document List Handling 
MiniCAD

VectorScript Declaration:

FUNCTION   NextSymDef
( symHd:HANDLE ) :HANDLE ;

Python:

def  vs.NextSymDef(symHd):
   return HANDLE

Description:

Function NextSymDef returns a handle to the next definition in the symbol library after the referenced symbol. If the end of the list has been reached, the function returns NIL.

Parameters:

symHd Handle to symbol definition in library.



  PrevDObj Document List Handling 
MiniCAD

VectorScript Declaration:

FUNCTION   PrevDObj
( h:HANDLE ) :HANDLE ;

Python:

def  vs.PrevDObj(h):
   return HANDLE

Description:

Function PrevDObj returns the previous deselected object in a list of objects . If the end of the object list is reached, the function returns NIL.

Parameters:

h Handle to object.



  PrevLayer Document List Handling 
MiniCAD

VectorScript Declaration:

FUNCTION   PrevLayer
( h:HANDLE ) :HANDLE ;

Python:

def  vs.PrevLayer(h):
   return HANDLE

Description:

Function PrevLayer returns a handle to the layer in the document preceding the referenced layer.

Parameters:

h Handle to layer.



  PrevObj Document List Handling 
MiniCAD

VectorScript Declaration:

FUNCTION   PrevObj
( h:HANDLE ) :HANDLE ;

Python:

def  vs.PrevObj(h):
   return HANDLE

Description:

Function PrevObj returns the object in any list which precedes the specified object. If the end of the list is reached, the function returns NIL.

Parameters:

h Handle to object, group, or symbol definition.



  PrevSObj Document List Handling 
MiniCAD

VectorScript Declaration:

FUNCTION   PrevSObj
( h:HANDLE ) :HANDLE ;

Python:

def  vs.PrevSObj(h):
   return HANDLE

Description:

Function PrevSObj returns the previous selected object in the list preceding the referenced object.

Parameters:

h Handle to object.



  PrevSymDef Document List Handling 
MiniCAD

VectorScript Declaration:

FUNCTION   PrevSymDef
( symHd:HANDLE ) :HANDLE ;

Python:

def  vs.PrevSymDef(symHd):
   return HANDLE

Description:

Function PrevSymDef returns a handle to the symbol definition in the symbol library preceding the referenced definition.

Parameters:

symHd Handle to symbol definition.



  ResourceListSize Document List Handling 
VectorWorks12.0

VectorScript Declaration:

FUNCTION   ResourceListSize
( listID:LONGINT ) :LONGINT ;

Python:

def  vs.ResourceListSize(listID):
   return LONGINT

Description:

Returns the number of items in the specified resource list.

Parameters:

listID an ID for a resouce list created by the BuildResourceList function.

Example:

{ Update numItems as the number of items in the resource list has }
{ changed. }
numItems := ResourceListSize(listID);



  SetParent Document List Handling 
VectorWorks10.0

VectorScript Declaration:

FUNCTION   SetParent
(   obj :HANDLE;
    container :HANDLE
) :BOOLEAN ;

Python:

def  vs.SetParent(obj, container):
   return BOOLEAN

Description:

Removes the object from its current container and places it within the given container. For example, SetParent can be used to put the referenced object into a group, or into a symbol definition, or to change the layer of the referenced object.

Parameters:

obj Handle to the object to move.
container Handle to the object that will become the parent of the obj variable.

Example:

PROCEDURE SetParentExample;
VAR
	h1, h2 :HANDLE;
	boo :BOOLEAN;
BEGIN
	h1 := FSActLayer;
	h2 := NextObj(h1);
	boo := SetParent(h2, h1);
END;
RUN(SetParentExample);

See Also:

CreateDuplicateObject