Example for GetResults in C#

  • Thread starter Walter Quirtmair
  • Start date
W

Walter Quirtmair

Hello,
I try to use Shape.GetResults() as seen in the example below but I'm always
getting a Exception of "type mismatch" of one of the parameters.

Has somebody used GetResults() with C# ?
What's wrong with my code?

Thank you,
Walter


Code snippet:

if (iSRC.Length > 0 && iSRC.Length % 3 == 0)

{

int nr = iSRC.Length / 3;

System.Array src = Array.CreateInstance( typeof(int), iSRC.Length );

int ix = 0;

for (int i = 0; i < iSRC.Length; i+=3)

{

src.SetValue( Convert.ToInt32(iSRC), ix++ );

src.SetValue( Convert.ToInt32(iSRC[i+1]), ix++ );

src.SetValue( Convert.ToInt32(iSRC[i+2]), ix++ );

}

System.Array units = Array.CreateInstance( typeof(int), 1 );

units.SetValue( (int)VisLib.VisUnitCodes.visMillimeters, 0 );

System.Array rarray;

iShape.GetResults( ref src, (short)VisLib.VisGetSetArgs.visGetFloats, ref
units, out rarray );

for (int i = 0; i < rarray.Length; i++)

results.Add( Convert.ToDouble( rarray.GetValue(i) ) );

}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top