The code in the following Calculation example allows you to custom calculate the value in the 'strPropName' property of a motor item type.
using System;
using System.Windows.Forms;
using Ingr.SP2D;
using SpelCustomInf;
namespace CustomCalculation
{
public class MotorCalculation : ISPELCalculate
{
public bool DoCalculate(ISPItems objISPItems, string strPropName, ref object varNewValue,
IWin32Window ownerWindow)
{
if (objISPItems.Count > 0)
{
if (varNewValue == null || varNewValue.ToString() == string.Empty)
{
return false;
}
//Do calculations
using (var f = new FrmMotorNotes())
{
f.txtNotes.Text =
$@"{objISPItems[1].ItemType.Name} {objISPItems[1].Attributes["ItemTag"].Value} {Convert.ToString(varNewValue)}";
f.ShowDialog(ownerWindow);
f.Close();
}
objISPItems[1].Attributes["Note"].Value =
$"{objISPItems[1].ItemType.Name} {objISPItems[1].Attributes["ItemTag"].Value} {varNewValue}";
return true;
}
return false;
}
}
}