/*
This example demonstrates how to remove an ActionDeltaItem
*/
NewScene (null, false);
// Create a reference model from a cube
var oRoot = Application.ActiveProject.ActiveScene.Root;
var oCube = oRoot.AddGeometry("Cube","MeshSurface");
var emdlFileRefModel = XSIUtils.BuildPath(Application.InstallationPath(siProjectPath), "Models", "MyModel.emdl");
CreateModelAndConvertToRef(oCube , emdlFileRefModel);
// Translate the 3D Objects
Translate(oCube, 3.0, 3.0, 0.0, siRelative, siView, siObj, siXYZ, null, null, null, null, null, null, null, null, null, 0, null);
// Get the Delta object
var oDelta = Dictionary.GetObject("Model.Delta");
// Add an action of type siModificationDeltaConstraint
var oActionDelta = oDelta.ActionDeltas(0);
// Get the the two firsts ActionDeltaItem
var oActionDelta = oDelta.ActionDeltas(0)
var oActionDeltaItem1 = oActionDelta.Items(0);
var oActionDeltaItem2 = oActionDelta.Items(1);
// Print the name of oActionDeltaItem2
Application.LogMessage("Second item name before removing oActionDeltaItem1: " + oActionDeltaItem2.Name);
// Remove oActionDeltaItem1
oActionDelta.RemoveItem(oActionDeltaItem1.Name);
// Print the name of oActionDeltaItem2
Application.LogMessage("Second item name after removing oActionDeltaItem1: " + oActionDeltaItem2.Name);
// Remove all others ActionDeltaItems
for (var i=0; i<oActionDelta.Items.Count; i++) {
oActionDelta.RemoveItem(oActionDelta.Items(0).Name);
// Decrease 'i' because there one item removed
i--;
}
// Output of above script:
//INFO : Second item name before removing oActionDeltaItem1: cube.kine.local.posy
//INFO : Second item name after removing oActionDeltaItem1: cube.kine.local.posz |