Difference between revisions of "VS:BuildResourceList"

From Vectorworks Developer
Jump to: navigation, search
m (wikify)
 
m (1 revision)

Revision as of 09:25, 12 August 2013

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

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 VectorScript Appendix.

Note
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
Table - Folder Path Selectors
Folder Name Constant
Current document 0
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
FUNCTION BuildResourceList(
TYPE  :INTEGER;
folderIndex  :INTEGER;
subFolderName  :STRING;
VAR numItems  :LONGINT) : LONGINT;
def vs.BuildResourceList(type, folderIndex, subFolderName):
    return (LONGINT, numItems)

Parameters

type INTEGER the type of resource to put in the list
folderIndex INTEGER the index of a VW folder.
subFolderName STRING 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 LONGINT the number of items in the list built

Remarks

This doesn't seem to support Symbol Folders (object type 92).

It also will not work on any symbol which is inside a folder -- it only works on symbols at the top level.

Orso (2009/12/29) To obtain a list of sketch styles excluding records pass object type -47. This is to my knowledge the only usage of a negative object type.

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);
    { ... }
{ try this on a file with some symbol folders }
PROCEDURE testResCountSymFolders;
VAR
    folderList : LONGINT;
    numFolders : INTEGER;
BEGIN
    { list symbol folders in curr doc }
    folderList := BuildResourceList(92, 0, '', numFolders);
    alrtDialog(concat(numFolders));
END;
RUN(testResCountSymFolders);

Another example from Pat Stanford <pat@coviana.com> November 2006

PROCEDURE Test; 
CONST
    ObjectType = 97; { Texture Definition } 
    FolderIndex = 100; { BuildResourceList Def for Texture Folder See Func. Ref } 
    SubFolderName = ''; { Nul subfolder get all folders and subfolders } 

VAR
    MyName : STRING; 
    MyList : LONGINT; 
    NumItems : LONGINT; 

BEGIN
    MyList := BuildResourceList(ObjectType, FolderIndex, '', NumItems); 
    MyName := GetNameFromResourceList(MyList, 1); { change this number to get the names of other textures } 
    Message( Date(2, 2), ': The Name is ', MyName, ' *** Total items in list: ', NumItems); 
END; 
RUN(Test);

Version

Availability: from VectorWorks 12.0

See Also

VS Functions:

VS:AddResourceToList | VS:DeleteResourceFromList | VS:GetNameFromResourceList | VS:GetResourceFromList | VS:ImportResourceToCurrentFile

VS Functions:

[[VS:AddResourceToList]] | [[VS:DeleteResourceFromList]] | [[VS:GetNameFromResourceList]] | [[VS:GetResourceFromList]]

| [[VS:ImportResourceToCurrentFile]]
Personal tools
NamespacesFFFF

Variants
Actions
Advanced Search
See Also
Navigation
Toolbox