/*
This example demonstrates how to add an ActionDeltaItem of type
siModificationDeltaExpression to a ActionDelta.
*/
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);
// Create a cone
var oCone = oRoot.AddGeometry("Cone", "MeshSurface");
// Translate the cube that also generate a delta
Translate(oCone , 3.0, 3.0, 0, siRelative, siView, siObj, siXYZ, null, null, null, null, null, null, null, null, null, 0, null);
// Add the Delta object
var oDelta = AddDelta(oCube.Model);
// Add an action of type siModificationDeltaExpression
var oDeltaAction = oDelta.AddAction(siModificationDeltaExpression)
// Add the expression item
var oActionDeltaItem = oDeltaAction.AddExpressionItem(oCube + ".kine.global.posx", "5*sin(" + oCone + ".kine.local.posx * 15)");
// Apply modification
oDelta.Apply(); |