Remove objects from AOI manager

(Originally posted by Rik on 12/22/2006)

Is it possible to remove all AOIs called Object * from an AOI list.

eg
Object 1
Object 2
Polygon1

The option IpAoiManager(AOIDELETE, "Object "&*) is not recognized.

I would like to clear AOI starting with object without knowing how many objects there are to start with (so no loop).

 

Comments

  • (Originally posted by Chris Tully on 12/26/2006)

    Rik,

    Unfortunately, IpAoiManager is not written to handle wild card characters, so you will have to use a loop:

    Sub Clear_AOI_List()
    	Dim numAOIs As Integer
    	Dim sOut As String*255
    	Dim i As Integer
    
    	' Find out how many AOIs there are
    	ret = IpAoiGet(AOIMGR_GET_NUM, 0, numAOIs)
    
    	' Iterate through the AOIs in reverse order
    	For i = numAOIs - 1 To 0 Step -1
    		ret = IpAoiGetStr(AOIMGR_GET_NAME, i, sOut)
    
    		'If the AOI's name starts with Object, then delete it
    		'  Notice that the if statement is written to be case insensitive
    		If UCase(Left(sOut, 6)) = "OBJECT" Then
    			ret = IpAoiManager(AOIDELETE, sOut)
    		End If
    	Next i
    End Sub
    
Sign In or Register to comment.