VS:Count: Difference between revisions

From Vectorworks Developer
Jump to navigation Jump to search
mNo edit summary
 
No edit summary
 
(One intermediate revision by the same user not shown)
Line 51: Line 51:
==== Python ====
==== Python ====
<code lang="py">
<code lang="py">
 
CountValue = vs.Count("(FP=4)AND(T='Rect')")
# counts all rectangles with a fillpat index of 4
</code>
</code>
</sample>
</sample>

Latest revision as of 17:35, 4 August 2020

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

Description

Counts all of the objects which match the search criteria.

FUNCTION Count(
c :CRITERIA) : LONGINT;
def vs.Count(c):
    return LONGINT

Parameters

c CRITERIA Search criteria.

Remarks

Undocumented is that criteria also accept the object type flag as parameter. The example above can also be written:

CountValue := Count((FP=4)and(T=3)); { 3 is object type flag for 'Rectangle&amp' }

This is valid for all object types being assigned a name in the VectorScript Appendix.

Example

VectorScript

CountValue := Count((FP=4)and(T='Rect'));
{counts all rectangles with a fillpat index of 4}

Python

CountValue = vs.Count("(FP=4)AND(T='Rect')")
# counts all rectangles with a fillpat index of 4

Version

Availability: from All Versions