Working with Vector2D objects

In order to work with ProPhotoGradients you will need to script.
To keep it simple we have prepared a small demonstration:
It bases on the following script. 
You can try out how it works with the attached project.

#region usings
using Scripting; // The deprecated scripting API necessary to access ActionPad and Effects.
using Ecue.Contracts;
using Ecue.Contracts.Workflow;
using Ecue.Contracts.UserAccess;
using Ecue.Contracts.Scheduler;
using Ecue.Contracts.Rdm;
using Ecue.Contracts.Logging;
using Ecue.Contracts.Dmx;
using Ecue.Contracts.Exceptions;
using Ecue.Contracts.Devices;
using Ecue.Contracts.Content;
using Ecue.Contracts.Content.Effects;
using Ecue.Sympholight.Scripting.Api;

using Ecue.Scripting.Compatibility;

using System;
#endregion

/// <summary>
/// This class is public static, so it's methods can be accessed from the workflow designer.
/// Convert from and into a Vector2D object.
/// The workflow cannot handle the Vector2D object, so we work with simple Object(s).
/// We have to check, if the passed object is of appropriate type.
/// </summary>
public static class Vector
{
   /// <summary>
   /// Convert a Vector2D object into the X and Y component.
   ///
   /// </summary>
   /// <param name="value">The Vector2D object as an object.</param>
   /// <param name="xValue">The X property of the vector.</param>
   /// <param name="yValue">The Y property of the vector.</param>
   public static void ToValue(Object value, out double xValue, out double yValue)
   {
       
       if(value is Vector2D) //check if it is a Vector2D or derived type.
       {          
           xValue = ((Vector2D)value).X; //cast object to vector, before getting the properties.
            yValue = ((Vector2D)value).Y;
       }
       else
       {
           xValue = 0; //default: set X and Y to 0.
           yValue = 0;
           Logger.Info("Wrong object type: " + value.GetType().ToString());
       }
   }
 
   /// <summary>
   /// Convert the X and Y part to a Vector2D object.
   /// </summary>
   /// <param name="value">The resulting object.</param>
   /// <param name="xValue">The X property of the vector.</param>
   /// <param name="yValue">The Y property of the vector.</param>
   public static void ToVector2D(out Object value, double xValue, double yValue)
   {
       value = new Vector2D(xValue,yValue);
   }
}
Attached Files
Vector_Demo_V5.0.lprj
404kb