Grasshopper

algorithmic modeling for Rhino

Hello...

Is there any way I can access the name a user puts onto a component (via the context menu), and use that at runtime?  This would be a compiled component.

Lets say that the input is a string "hello"  and the user changes the name of the component to "hello."  Can I test if the input string and the name are the same in order to condition the output?

Thanks!
Luis

Views: 6011

Replies to This Discussion

In a similar vein, Sources is also already a collection of IGH_Param, so no casting required there either:

  Dim ighList As List (Of IGH_Param) = param_0.Sources
  Dim inParam_0 As IGH_Param = ighList(0)


--

David Rutten

david@mcneel.com

Poprad, Slovakia

thanks David - totally overlooked the unnecessary code.

First off, thanks for those who contribute, there is much to learn in these posts.

I have worked in GH  but am branching into VB scripting now to expand my definitions.  The function described here is exactly what I want to accomplish but I am not certain how this would done in the VB script component.  Is this something done via a custom component?  Basically, if someone could provide me some guidance as to which direction to start, I will be happy to try from there.

Thanks

Erik

Alright, I have been trying this now for a few days.  I was not successful in creating this either as a custom script component or building a custom component in VB.  Can anyone possibly provide a example VB example?  I have visual studio and can compile my own component but I am at a loss.  I wish I understood more about creating these but having an example to build from would move me ahead.

Thanks again.

What exactly are you trying to accomplish? Do you want to use the nickname of the VB script component inside the RunScript method? Do you want to recompute the script component when the name changes? Or...?

--

David Rutten

david@mcneel.com

Poprad, Slovakia

I was hoping to to pull the nickname from an attached element then feed this to an output from the VB script component.  The hope is to combine this with other functions later but for now this would be a good start.


An example would be if you had a list of 10 sliders with custom nicknames, named for specific functions.  You could then feed the sliders into the VB component which could take the nicknames and the values and compile them to feed to an excel data spreadsheet.  This is more the final goal but at a good start would be to at least pull the nicknames of the sliders for example.


I am attaching an image with a small pseudo-example of what it might look like.

thanks

Attachments:

See attached. File contains some notes and the code is commented.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Attachments:

David,

Thank you, this is very helpful.  As this progresses I will try to post an example of the tool under a new posting.

Sorry for my knowledge being so weak, but how do i change your

Dim param As IGH_Param = component.Params.Input(0)
Dim names As New List(Of String)
For Each source As IGH_Param In param.Sources
names.Add(source.NickName)
Next

to recieve  just a list in the same tree structure as the input?

I don't understand. What list? What tree structure? Which input?

--

David Rutten

david@mcneel.com

Poprad, Slovakia

I just want to recieve the Nickname of the source without any Join String or repeating List.

There might be more than one source. If there's more than one then which should it be? If there are no sources then what should happen?

--

David Rutten

david@mcneel.com

Poprad, Slovakia

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service