'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"
|