CreateUserDataMap

Categories

property

Description

Creates a UserDataMap cluster property for holding user data.

Scripting Syntax

oReturn = CreateUserDataMap( [InputObj], [PropertyName], [Template] );

Return Value

Returns a collection of the newly created properties. If no clusters are specified in the InputObjs argument the returned collection will be empty.

Parameters

Parameter Type Description
InputObj String A cluster or a list of clusters to create user data on

Default Value: Current selection

PropertyName String Name of the user data property. To clearly identify the property and to avoid conflict with other plugins, it is recommended that the name reflects the plugin or author of the plugin.

Default Value: "UserData"

Template CustomProperty Name of the a custom property that will serve as the template for the contents of the user data map. This argument is not necessary if the user data map will be used for storing binary data.

Examples

1. VBScript Example

'This vbscript example demonstrates how you can create user data maps on seperate 
        'clusters with a single call to CreateUserDataMap
        dim oRoot, oCircle, oCluster1, oCluster2, oCluster3, l_ClusterList, oUserDataMapList, oUserDataMap
        set oRoot = Application.ActiveProject.ActiveScene.Root
        set oCircle = oRoot.AddGeometry("Circle","NurbsCurve")
        set oCluster1 = oCircle.ActivePrimitive.Geometry.AddCluster( siIsoPointCluster )                
        set oCluster2 = oCircle.ActivePrimitive.Geometry.AddCluster( siVertexCluster,"PntCluster",Array(1,4,7,10,13,16) )               
        set oCluster3 = oCircle.ActivePrimitive.Geometry.AddCluster( siKnotCluster )
        'Build a list of clusters, similar to what happens is you select multiple clusters
        '(the duplicates will be filtered out)
        set l_ClusterList = CreateObject("XSI.Collection")
        l_ClusterList.Add oCluster1
        l_ClusterList.Add oCluster2
        l_ClusterList.Add oCluster3
        l_ClusterList.Add oCluster1     
        set oUserDataMapList = CreateUserDataMap( l_ClusterList, "MultiCreatedUserData" )       
        'We can get at the individual object in the collection
        'by iterating like this:        
        for each oUserDataMap in oUserDataMapList
                logmessage oUserDataMap.FullName
        next
        'Output of this script is something like:
        'INFO : "circle1.crvlist.cls.Isopoint.MultiCreatedUserData"
        'INFO : "circle1.crvlist.cls.PntCluster.MultiCreatedUserData"
        'INFO : "circle1.crvlist.cls.knot.clslist.Knot.MultiCreatedUserData"

2. VBScript Example

'This vbscript example demonstrates creating a templated User Data Map using CreateUserDataMap
        option explicit
        dim oRoot, oObj, oCluster, oPSet, oUserDataMap
        set oRoot = Application.ActiveProject.ActiveScene.Root
        set oObj = oRoot.AddGeometry("Grid","MeshSurface")
        set oCluster = oObj.ActivePrimitive.Geometry.AddCluster( siPolygonCluster, "UserDataCls" )      
        'Create a custom parameter that will serve as the template.  In this case we 
        'choose to create it underneath the object, but we could create it elsewhere if we like
        set oPSet = oObj.AddProperty( "Custom_parameter_list",,"MyDataFormat" )
        oPSet.AddParameter "MyFlag", siBool,,,,,, true
        oPSet.AddParameter "Z", siUInt4,,,,,, 100, 0, 1000
        set oUserDataMap = CreateUserDataMap( oCluster, "UserData", oPSet ).Item( 0 )
        logmessage "Name of template for " & oUserDataMap.FullName & " is " & oUserDataMap.Template.FullName
        'Output of this script is the following:
        'INFO : "Name of template for grid.polymsh.cls.UserDataCls.UserData is grid.MyDataFormat"

See Also

UserDataMap CreateWeightMap Geometry.AddCluster