VS:FObject: Difference between revisions

From Vectorworks Developer
Jump to navigation Jump to search
No edit summary
 
m (1 revision)
 
(No difference)

Latest revision as of 14:30, 12 August 2013

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

Description

Function FObject returns a handle to the first object in the first layer of the active document. If the document is empty, the function returns NIL.

FUNCTION FObject : HANDLE;
def vs.FObject():
    return HANDLE

Return Value

The returned handle is the first object of the first layer's list. You can traverse this list with VS:NextObj and VS:PrevObj. If you need to traverse all objects on all layers see the sample.

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

See Also

Relative calls:

Relative calls:
  • [[VS:NextObj]] | [[VS:PrevObj]]
  • [[VS:FObject]] | [[VS:LObject]]
  • [[VS:FSActLayer]] | [[VS:LSActLayer]]
  • [[VS:FSObject]] | [[VS:LActLayer]]
  • [[VS:NextDObj]] | [[VS:PrevDObj]]
  • [[VS:NextSObj]] | [[VS:PrevSObj]]