VS:NextLayer

From Vectorworks Developer
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

.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