Thanks David...no need to make GH vulnerable as there's plenty out
there who might shoot themselves in the foot trying to play with it
(myself included).  IMHO, the only issue here is numeric and boolean
values.  I've found that the rest of the data types can be tested if
they are Nothing.  If you could somehow override the default for
numeric values being 0 to a Null or Nothing reference then that would
be enough...but that's just me.

-Damien

On Jan 16, 5:10 am, David Rutten <[email protected]> wrote:
> Hi Joach, Damien,
>
> The script that run inside the VB and C# components are not aware of
> the grasshopper running instance. As such, they don't have access to
> the current ghx file, or the scripting component that owns them. I
> might be able to add a reference to the container component (I'd have
> to test that), but I feel that really exposes the soft underbelly of
> Grasshopper.
>
> I also don't think that knowing whether or not an input is connected
> is the best way to solve this. I'll try and come up with a way for you
> to define defaults for Script inputs.
>
> --
> David Rutten
> [email protected]
> Robert McNeel & Associates
>
> On Jan 16, 5:41 am, damien_alomar <[email protected]> wrote:
>
> > AFAIK thats the only way at the moment.  Maybe in the future David
> > could add a method for querying whether a node has a connection (or
> > multiple connections), but that's for the future.
>
> > -Damien
>
> > On Jan 15, 6:31 am, joach <[email protected]> wrote:
>
> > > Thank you Daniel for your complex answer. But mine problem is about to
> > > double, and spacial with value 0. If input value to VBcomponet exist
> > > (for example: VBcomponent is connect with slider), i would to call 1st
> > > function and correct intup shoud be a value "0". But when doest exist
> > > connection i need call another function. Exist some other way, how i
> > > get answer, if connection exist?
>
> > > Best, Joach
>
> > > On Jan 14, 10:07 pm, damien_alomar <[email protected]> wrote:
>
> > > > It depends largely on what kind of value you're actually accepting.
> > > > The reason for this is that VB.Net will assign values to variables
> > > > when the are created depending on what kind of data type they are.
> > > > For anything thats a complex object (so any sort of geometry
> > > > information basically), a variable of that data type which does not
> > > > contain any value will be have a special value of Nothing.  Here's an
> > > > example how to use that to our advantage...in the example we'll set
> > > > the "default" value for a plane
>
> > > > If IsNothing (ghPlane) Then
> > > >      ghplane = New OnPlane()    'creates a new xyPlane
> > > > End If
>
> > > > For numbers its a little different because VB.Net will automatically
> > > > assign that variable a zero.  So, you could test and see if the number
> > > > is zero and assign a base value to it, but the only downside to that
> > > > is that if someone actually wants to supply a value of zero it will be
> > > > replaced by what ever the default value is.  Off the top of my head, I
> > > > don't remember what is the default value with boolean values, although
> > > > I think its false.  Again, you could get in trouble changing that one
> > > > around. Hope that helps.
>
> > > > Best,
> > > > Damien
>
> > > > On Jan 13, 4:15 pm, joach <[email protected]> wrote:
>
> > > > > How I can declare a default value of input data to VB.net component?
> > > > > Something like when i used a cull component in GH, defaulf value of
> > > > > frequency ("N") is set to no. 2.
>
> > > > > Any idea?
> > > > > Thx Joach- Hide quoted text -
>
> > - Show quoted text -

Reply via email to