ユーザデータを保持するUserDataMapクラスタプロパティを作成します。
oReturn = CreateUserDataMap( [InputObj], [PropertyName], [Template] ); |
新規に作成されたプロパティのコレクションを戻します。 InputObjs 引数にクラスタを指定しない場合、戻されるコレクションは空です。
| パラメータ | タイプ | 説明 |
|---|---|---|
| InputObj | 文字列 |
ユーザ データの作成先クラスタまたはクラスタのリスト デフォルト値: 現在選択されている値 |
| PropertyName | 文字列 |
ユーザ データ プロパティの名前。 プロパティを明確に特定し、他のプラグインとの競合を回避するために、プラグインまたはその作成者がわかるような名前を付けることをお勧めします。 デフォルト値: "UserData" |
| Template | CustomProperty | ユーザ データ マップの内容でテンプレートとして機能するカスタム プロパティの名前。 バイナリ データの保存にユーザ データ マップを使用する場合、この引数は不要です。 |
'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" |
'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" |