Grasshopper

algorithmic modeling for Rhino

how do i add inputs and outputs to a grasshopper plugin during solving?

 I want to have a new inputs and outputs attached and defined by a external script,so i can write directly within the xxx.cs file the input and output node definition.

 

The problem is that I need 1 node existing and readable  during the registering to get the path of the  xxx.cs file [which is provided by the string of the first node] and find out which input and outputs nodes are to be created.

 

protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager)
        {
            pManager.Register_StringParam("example","example","example");

 

-----> Is it possible to read the string here????


        }

 

thanxs in advance

 

Michael

Views: 841

Replies to This Discussion

Hi Michael,

 

it would be a very bad idea to change inputs and outputs during a solution. It would be a regularly bad idea to automatically change inputs and outputs. Ideally what you want is for your component to update its input and output parameters via the Component menu (or maybe a double click on the component). This way you'll minimize the surprise factor for users.

 

The RegisterInputParams() and RegisterOutputParams() methods are only called once (from within the constructor of GH_Component). It is possible to change the parameters later, you just have to make sure you inform everyone who needs to know. There is also a problem with (de)serialization. If you save a ghx file with one of your components which has 4 output parameters, you need to make sure that those four parameters are created before the wires are reconnected during the end of the file-reading process.

 

"-----> Is it possible to read the string here????"

 

No. When this method is called the component hasn't been connected to anything else yet. It isn't even part of a GH_Document yet. Also, if you change the string later, you want your component to be able to update, so you'll need to do it elsewhere anyway.

 

Can you post a somewhat more complete example of what sort of thing you're looking for? Maybe a text file that defines your component layout and a screenshot of how it's supposed to look...

 

Also, have you considered outputting all data in the form of a Datatree instead of juggling parameters?

 

--

David Rutten

david@mcneel.com

Poprad, Slovakia

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service