VS:NextLayer

From Vectorworks Developer
Revision as of 21:56, 27 April 2008 by Root (talk | contribs) (1 revision)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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

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.

FUNCTION NextLayer(
h :HANDLE) : HANDLE;
def vs.NextLayer(h):
    return HANDLE

Parameters

h HANDLE Handle to layer.

Example

If you need to traverse all objects in the document, you'll have to traverse all layers and then list the objects in each one:

VectorScript

PROCEDURE ListDocument;
VAR
	hLayer, h : HANDLE;
BEGIN
	hLayer := GetParent( FObject );
	WHILE hLayer <> NIL DO BEGIN
		h := FInLayer( hLayer );
		WHILE h <> NIL DO BEGIN
			AlrtDialog( Concat( 'h=', h, ' type=', GetTypeN(h) ) );

			h := NextObj( h );
		END;

		hLayer := NextLayer( hLayer );
	END;
END;
Run(ListDocument);

Python

def ListDocument():
	hLayer = vs.GetParent( vs.FObject() )
	while hLayer != None:
		h = vs.FInLayer( hLayer )
		while h != None:
			vs.AlrtDialog( vs.Concat( 'h=', h, ' type=', vs.GetTypeN(h) ) )
			h = vs.NextObj( h )
		hLayer = vs.NextLayer( hLayer )

ListDocument()

Version

Availability: from All Versions