Thank you for the help

I know c# well. That is not my problem, i am trying to wrap my head
around how the nodes work.

I have some very simple code like this.

using System;
using System.IO;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Reflection;
using System.Collections;
using System.Collections.Generic;
using Microsoft.VisualBasic;

using RMA.OpenNURBS;
using RMA.Rhino;
using Grasshopper.Kernel.Types;

class Grasshopper_Custom_Script
{
#region members
  private MRhinoApp app;
  private MRhinoDoc doc;

  public System.Object A;
#endregion

  void RunScript(System.Object x, System.Object y)
  {
    /// <your code>

    int[] ax = new int[5];

    for(int i = 0;i < 5;i++){

      ax[i] = i;

    }
    A = ax;

    /// </your code>
  }

#region "Additional methods and Type declarations"

#endregion
}


This code works however, when I try and use the x input like this.


  void RunScript(int x, System.Object y)
  {
    /// <your code>

    int[] ax = new int[x];

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

      ax[i] = i;

    }
    A = ax;

    /// </your code>

i get an error that says script exception: specified cast is not
valid.

I seem to be getting errors no matter what i do with the x. The only
think that works is if i send ti directly to the ouput.

I know this is very simple and basic but if I understand this I don't
think I will have any further trouble.

Thank you all for your time and help.


On Feb 26, 9:46 am, Rajaa <[email protected]> wrote:
> This link was posted in the Rhino developer newsgroup.
> It is a great translator for converting C# to 
> VB:http://www.developerfusion.com:80/tools/convert/csharp-to-vb/
>
> On Feb 26, 2:59 am, David Rutten <[email protected]> wrote:
>
> > Hi Fd,
>
> > it works the same as the VB one, except it's a different language. Our
> > Wiki contains many examples of C++, C# and VB code (usually all three
> > for 
> > comparison):http://en.wiki.mcneel.com/default.aspx/McNeel/DeveloperHome.html
>
> > It seems that most people are using VB rather than C#, so if you're
> > looking for a large community, VB would be the better choice. But
> > there are also many online translator tools that convert accurately
> > between VB and C#.
>
> > --
> > David Rutten
> > [email protected]
> > Robert McNeel & Associates
>
> > On Feb 26, 6:36 am, Fd <[email protected]> wrote:
>
> > > Is anyone working with c#?
>
> > >  I would greatly appreciate the help.
>
> > > On Feb 22, 2:06 am, Fd <[email protected]> wrote:
>
> > > > I was wondering if anyone can point me towards some example files of
> > > > people using the C# scripting node. I want to learn some more about
> > > > how it works and some examples would be helpful. Thanks.- Hide quoted 
> > > > text -
>
> > - Show quoted text -

Reply via email to