Sorry, got interrupted... ;q
Thanks, Francis, that works (2013 SP1 )!
What still gives me troubles is setting the MaterialID attribute (exists
on every polymesh by default), which is what I actually need.
I cannot write to it. Reading works, though. Could you guys please have
a look?
This works:
<JScript>
NewScene("", "false");
var oObj = CreatePrim("grid", "MeshSurface", "", "");
SetValue("grid.polymsh.geom.subdivu", 2, null);
SetValue("grid.polymsh.geom.subdivv", 2, null);
var oICEAttr = oObj.ActivePrimitive.AddICEAttribute("MyAttr",
siICENodeDataLong, siICENodeStructureSingle, siICENodeContextComponent2D );
oICEAttr.DataArray = [0,1,2,3];
var oProp = oObj.AddProperty("AttributeDisplay");
SetValue(oObj.Name + ".AttributeDisplay.attrname", "MyAttr", null);
</JScript>
Whereas this throws a warning:
<JScript>
NewScene("", "false");
var oObj = CreatePrim("grid", "MeshSurface", "", "");
SetValue("grid.polymsh.geom.subdivu", 2, null);
SetValue("grid.polymsh.geom.subdivv", 2, null);
var oICEAttr = oObj.ActivePrimitive.GetICEAttributeFromName("MaterialID");
oICEAttr.DataArray = [0,1,2,3]; // WARNING : 3403 - The data is not set
on this ICEAttribute: MaterialID
var oProp = oObj.AddProperty("AttributeDisplay");
SetValue(oObj.Name + ".AttributeDisplay.attrname", "MyLong", null);
</JScript>
The attribute "MyAttr" has exactly the same "format" as MaterialID, so
what's the difference?
Using a GridData object does not help.
<JScript>
NewScene("", "false");
var oObj = CreatePrim("grid", "MeshSurface", "", "");
SetValue("grid.polymsh.geom.subdivu", 2, null);
SetValue("grid.polymsh.geom.subdivv", 2, null);
var oICEAttr = oObj.ActivePrimitive.GetICEAttributeFromName("MaterialID");
var oGridData = XSIFactory.CreateGridData();
oGridData.RowCount = 1;
oGridData.ColumnCount = 4;
oGridData.SetRowValues(0, [0,1,2,3]);
oICEAttr.DataArray = oGridData.Data;
var oProp = oObj.AddProperty("AttributeDisplay");
SetValue(oObj.Name + ".AttributeDisplay.attrname", "MyLong", null);
</JScript>
Am I missing something, or is this a bug?
Thanks!
Eugen
Am 23.10.2012 21:54, schrieb Francis Brissette:
>From what I observed, if your array is the right size, you will have this
error shown.
The size of the array will depend on the siICENodeContextType associated with
the ICEAttribute and the object containing this ICE Attribute.
--------------------------------------------------
NewScene("", "false")
CreatePrim("grid", "MeshSurface", "", "")
SetValue("grid.polymsh.geom.subdivu", 2, null);
SetValue("grid.polymsh.geom.subdivv", 2, null);
// Type = Vector3, Context = One element per polygon.
attr = Selection(0).ActivePrimitive.AddICEAttribute("MyVec3",
siICENodeDataVector3, siICENodeStructureSingle, siICENodeContextComponent2D )
attr.DataArray = [
XSIMath.CreateVector3( 1.0, 0.0, 0.0 ),
XSIMath.CreateVector3( 0.0, 1.0, 0.0 ),
XSIMath.CreateVector3( 0.0, 0.0, 1.0 ),
XSIMath.CreateVector3( 0.0, 0.0, 0.0 ) ]
--------------------------------------------------
Francis