UserDataMap.Clear operator

Introduced

v3.0

Description

Removes all user data information from the user data map. This does not change the size of the user data map as reported by UserDataMap.Count, because the size is always the same as the Cluster.

Scripting Syntax

UserDataMap.Clear();

Examples

VBScript Example

'This example demonstrates UserDataMap.Clear
dim oRoot, oGrid, oCluster, oUDProp, oUserData
set oRoot = Application.ActiveProject.ActiveScene.Root
set oGrid = oRoot.AddGeometry("Grid","MeshSurface")
set oCluster = oGrid.ActivePrimitive.Geometry.AddCluster( siPolygonCluster,"PolygonC"   )
set oUDProp = oCluster.AddProperty( "UserDataMap",,"UserDataExample" )  
oUDProp.ItemValue( 4 ) = "Some interesting data"
'Also retrieve a UserDataItem pointing to the item
set oUserDataItem = oUDProp.Item( 4 )
logmessage oUserDataItem.Value
logmessage oUDProp.IsEmpty( 4 )
oUDProp.Clear()
logmessage oUDProp.IsEmpty( 4 )
'Now that oUDProp has been cleared oUserDataItem is invalid.
'We should fetch a fresh pointer
set oUserDataItem = oUDProp.Item(4)
oUserDataItem.Value = "Resetting some interesting data"
'Output of this script is this:
'INFO : Some interesting data
'INFO : "False"
'INFO : "True"

See Also

UserDataItem