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) ) );
}
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) ) );
}