VS:SetObjectTags: Difference between revisions

From Vectorworks Developer
Jump to navigation Jump to search
No edit summary
No edit summary
 
(One intermediate revision by the same user not shown)
Line 40: Line 40:


-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
<sample></sample>
 
<sample>
==== VectorScript ====
<code lang="pas">
Procedure Test;
 
Var H1: Handle;
A1: Array[1..2] of string;
B1: Boolean;
Begin
H1:=FLayer;
A1[1]:='Tag One';
A1[2]:='Tag Two';
B1:=SetObjectTags(H1,A1);
ENd;
 
Run(Test);</code>
==== Python ====
<code lang="py">
import vs
 
def SetTags():
# List of tags i want to add
l = ('Tag One','Tag Two')
# Handle to the thing i want to add the label to
h = vs.FLayer()
# Function for setting the label
vs.SetObjectTags(h, l)
 
SetTags()
</code>
 
 
Sample VS by Pat Stanford
Sample PY by TWK, koenr, and Pat Stanford 4-12-24
</sample>


-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------

Latest revision as of 00:58, 13 April 2024

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

Description

Lets the user set a list of Tags on an object such as a Class,Layer or Resource.

FUNCTION SetObjectTags(
objectHandle :HANDLE;
arrTags :ARRAY) : BOOLEAN;
def vs.SetObjectTags(objectHandle, arrTags):
    return BOOLEAN

Parameters

objectHandle HANDLE The object to set Tags on.
arrTags ARRAY The arra of Tag Strings.

For Python, the Array required must be a tuple.

Example

VectorScript

Procedure Test;

Var		H1:		Handle;
		A1:		Array[1..2] of string;
		B1:		Boolean;
		
		
Begin
	H1:=FLayer;
	A1[1]:='Tag One';
	A1[2]:='Tag Two';
	B1:=SetObjectTags(H1,A1);
ENd;

Run(Test);

Python

import vs

def SetTags():
	# List of tags i want to add
	l = ('Tag One','Tag Two')
	
	# Handle to the thing i want to add the label to
	h = vs.FLayer()
	
	# Function for setting the label
	vs.SetObjectTags(h, l)

SetTags()


Sample VS by Pat Stanford Sample PY by TWK, koenr, and Pat Stanford 4-12-24

Version

Availability: from Vectorworks 2019