Template:TraverseObjects: Difference between revisions
Jump to navigation
Jump to search
(Created page with "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: <code lang="pas"> PROCEDURE ListDocument; VAR h...") |
No edit summary |
||
Line 1: | Line 1: | ||
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: | 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 ==== | |||
<code lang="pas"> | <code lang="pas"> | ||
PROCEDURE ListDocument; | PROCEDURE ListDocument; |
Latest revision as of 17:07, 22 July 2014
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()