VS:AddResourceToList

From Vectorworks Developer
Jump to: navigation, search

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


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.
FUNCTION AddResourceToList(
listID  :LONGINT;
resource  :HANDLE) : LONGINT;
def vs.AddResourceToList(listID, resource):
    return LONGINT

Parameters

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

Example

VectorScript

{ 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);

Python

def Example():
	#{ Create a new hatch and add it to the resource list. }
	kHatch = 66
	kDefHatchFolder = 105
	hatchName = 'Hatch-1'

	listID, numItems = vs.BuildResourceList(kHatch, kDefHatchFolder, '')
	vs.BeginVectorFillN(hatchName, True, False, 0)
	vs.AddVectorFillLayer(0, 0, 1, 1, .25, -.25, .7, 3, 255)
	vs.EndVectorFill()
	newHatch = vs.GetObject(hatchName)
	index = vs.AddResourceToList(listID, newHatch)
Example()

Version

Availability: from VectorWorks12.0
Personal tools
NamespacesFFFF

Variants
Actions
Advanced Search
See Also
Navigation
Toolbox