X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 13 Nov 2019 12:55 PM by  Neil Patel
IDL widget with C#
 0 Replies
Sort:
You are not authorized to post a reply.
Author Messages

Neil Patel



New Member


Posts:
New Member


--
13 Nov 2019 12:55 PM
    I am running Windows 10 with IDL 7.1.

    I am using an IDL widget in a windows forms C# project. I have an IDL script "pedAnalyze" which takes 3 arrays as input as follow "PRO pedAnalyze, xyeizz, Kon, PedSlope, PWF".

    This is the Initialization in C# code:
    {
    IDLDrawWidget2.IdlPath = Lines[0];
    IDLDrawWidget2.DrawWidgetName = "DWidget_Name";
    n = IDLDrawWidget2.InitIDL(this.Handle.ToInt32());
    if (n == 0)
    {
    // MsgBox "IDL failed to initialize"
    //txtDebug.Text = "IDL failed to initialize";
    MessageBox.Show("IDL failed to initialize");
    System.Environment.Exit(0);
    }
    IDLDrawWidget2.CreateDrawWidget();
    IDLDrawWidget2.SetOutputWnd(IDL_Output.Handle.ToInt32());
    WorkingDirectory = "CD, '" + path + "'";
    IDLDrawWidget2.ExecuteStr(WorkingDirectory);

    // Set IDL Color table to B && W
    IDLDrawWidget2.ExecuteStr("loadct, 0");

    // Compile IDL code
    IDLCommand = ".COMPILE " + path + @"\IDLProcedures\idl_basic_userLib.pro";
    n = IDLDrawWidget2.ExecuteStr(IDLCommand);
    if (n < 0)
    Interaction.MsgBox("idl_basic_userLib.pro not found or Compile Error");

    IDLCommand = ".COMPILE " + path + @"\IDLProcedures\pedAnalyze4S.pro";
    n = IDLDrawWidget2.ExecuteStr(IDLCommand);
    if (n < 0)
    Interaction.MsgBox("pedAnalyze4S.pro not found or Compile Error");

    IDLDrawWidget2.SetNamedArray("xyzeData", xyzeData, true);
    IDLDrawWidget2.SetNamedArray("Kon", Kon, true);
    IDLDrawWidget2.SetNamedArray("PWF", PWF, true);
    IDLDrawWidget2.SetNamedArray("PedSlope", PedSlope, true);

    IDLCommand = "pedAnalyze, xyzeData, Kon, PedSlope, PWF";
    IDLDrawWidget2.ExecuteStr(IDLCommand);
    }

    I am printing "Kon" array in the starting of script to make sure if the array is passed correctly, which it is. The IDL script makes changes to the "Kon" values, I also check that by printing at the end of the script and by verifying plots. Why don't I see those changes reflecting back in C# array "Kon" . I am using SetNamedArray which is suppose to be sharing the array. I have this script correctly working on VB6.
    You are not authorized to post a reply.