having a problem with an add in using AddHook(EdmCmdType.EdmCmd_CardInput)
when triggered from a combobox on folder datacard it calls the OnCmd function, on _vars.SetVar("Project Description", "", "xxxxxxxxxxxxxxxxx"); it loops and re-runs the OnCmd function and quite obviously bombs out (debug).
created another add in doing the same thing but that add in works.
void EdmLib.IEdmAddIn5.OnCmd(ref EdmCmd poCmd, ref System.Array ppoData)
{
IEdmVault5 edmVault = poCmd.mpoVault as IEdmVault5;
IEdmEnumeratorVariable5 _vars = (IEdmEnumeratorVariable5)poCmd.mpoExtra;
object DescVal = null;
string DescValStr = string.Empty;
try
{
if (poCmd.meCmdType == EdmCmdType.EdmCmd_CardInput)
{
switch (poCmd.mbsComment)
{
case "Project Number":
_vars.GetVar("Project Number", "", out DescVal);
DescValStr = DescVal.ToString().Trim();
if (!string.IsNullOrWhiteSpace(DescValStr))
{
_vars.SetVar("Project Description", "", "xxxxxxxxxxxxxxxxx");
}
break;
default:
break;
}
}
}
catch (COMException exp)
{
string errorName, errorDesc;
edmVault.GetErrorString(exp.ErrorCode, out errorName, out errorDesc);
edmVault.MsgBox(0, errorDesc, EdmMBoxType.EdmMbt_OKOnly, errorName);
}
}
SolidworksApi macros