v3.0
Returns or sets the templated user data for this User Data Map as a CustomProperty
(or NULL if there is no template). A User Data Map can be associated with a custom property that
serves as a template for the data inside the User Data Map.
This allows the storage of strongly typed data on each component. The template defines the format
of the data, but the values of the data are stored seperately for each component.
For example a User Data Map on a polygon cluster may have a Template with a integer parameter X
and a floating point parameter Y. This means that each polygon can store its own value of X and Y.
The transfer of data between the associated custom property and individual components can be performed
using UserDataItem.Value and CustomProperty.BinaryData.
// get accessor CustomProperty rtn = UserDataMap.Template; // set accessor UserDataMap.Template = CustomProperty; |
dim oRoot, oObj, oCluster, oPropSet1, oPropSet2, oUserDataMap 'Create all the objects set oRoot = Application.ActiveProject.ActiveScene.Root set oObj = oRoot.AddGeometry("Grid","MeshSurface") set oCluster = oObj.ActivePrimitive.Geometry.AddCluster( siPolygonCluster,"PolyCluster" ) set oPropSet1 = oCluster.AddProperty( "Custom_parameter_list",, "PSet1" ) set oUserDataMap = oCluster.AddProperty( "UserDataMap", false, "DataOnPoints" ) 'Add some parameters to the PSet dim oParam set oParam = oPropSet1.AddParameter( "Str", siString ) oParam.Value = "Test" oPropSet1.AddParameter "X", siDouble, , , _ "X short", "X Long", , _ 9.87, 0.01, 11.14 oPropSet1.AddParameter "UByte", siUByte, siClassifMetaData , siPersistable, _ , , , _ 64, 0, 128 set oUserDataMap.Template = oPropSet1 'Change a parameter value via the User Data Map set oParam = oUserDataMap.Template.Parameters( "X" ) oParam.Value = 3.23 'So far none of the polygons actually have any user data stored on them. 'We can save the current values of the template custom property onto polygon 5 'using the following: oUserDataMap.Item( 5 ).Value = oUserDataMap.Template.BinaryData 'Change our minds and remove the association. (This doesn't 'erase the user data we stored on polygon 5) set oUserDataMap.Template = Nothing |