algorithmic modeling for Rhino

Hi all,

I did write a complete(ata least I think so) code for a component which reads data from csv file and assign it to a custom type variable. In VS there is no error and i 've added the folder of gha file to grasshopper but it does not load.

i can not find why this happens , may be i 'm missing something obvious or there is another problem like compatibility of some library im using.

for reading csv i use CsvHelper library(net 4) from and I attach code and csv. may be somone can help.

Views: 1225


Replies to This Discussion

If you double-click and type DataB in Grasshopper, is the component listed?

If not, when you put a breakpoint in your component constructor, does it get hit?


David Rutten

Seattle, WA

Hi David,

1-I checked DataB. it is not there and also in help/About. the plugin in not there also.

2-I'v never debuged plugin.But I follow the instructions available in the blog.I added some brev akpoints in the constructor and elsewhere,hit debug, Rhino4 runs,after loading grasshopper, there is some exceptions:

DisconnectedContext was detected
DisconnectedContext which detected
Message: The following error during the transition to COM context 0x1d8e1e0 for this RuntimeCallableWrapper: The object invoked has disconnected from its clients. (Exception from HRESULT: 0x80010108 (RPC_E_DISCONNECTED)). This occurs usually because the COM 0x1d8e1e0 context in which this RuntimeCallableWrapper was created, was separated or is busy due to a different process. The interfaces are enabled (COM context 0x1d8e128) from the current COM context. This can lead to data corruption or loss. To avoid this problem, you must ensure that all COM-Kontexte/Apartments/Threads be maintained so long and are available for the context of transition until the application all RuntimeCallableWrappers that represent COM components contained in them has been fully processed.


(which I guess is caused by other installed plugins), but during loading at somepoint the constructor gets hit!yes

(by the way I use VS2010,Rhino5 but for debugging Rhino4)


So were you swallowing those exceptions or did Grasshopper catch them and display them during loading?

At any rate, if it's crashing when I try to load the GHA then all the components will be missing. The odd thing is that this sort of thing typically shouldn't be quiet, there should be a window with all the exception data.

I suppose the next step is to figure out what's causing these exceptions. Are you doing anything at all in your component constructors besides registering a few inert parameters?


David Rutten

Seattle, WA

Now, There is no exception during grasshopper loading right now But still it does'nt show up in GH tab.I am using Rhino5 for debugging and there is no more exception.however with the exception also all the plugins were loaded.

About the constructor,it is empty just I suppose it should be:

public ReadDatabase() :base("Read Database", "DataB", "Read the database file", "Project", "System Selection")    {  }

then registering one string as input and one custom type as output,solveInstance to assign data to output.I just add an Icon also. nothing more!



Hi Kaveh,

I'm picking up the conversation from discourse.

if you run this wizard, are you able to launch a new project by clicking the "Play" button? If you are able to do that, then we can work to extend the project that has debugging working.



Giulio Piacentino
for Robert McNeel & Associates

This wizard is perfect,exactly what lazy persons like myself need.I tried it with a simple code to edit a string and return chars.and debug. works perfect.
but when it comes to the above component I deal with,when i toggle breakpoint on constructor, it does not stop and wait for user to push 'play' button.wierdly it ignores breakpoint.I guess constructor may have problem.maybe .

another thing: can every vs project contain as many as I want component in one? and is there any supposition or restriction for the name of namespace of components or not(guess not,just to be sure)

Yes. No.

You can add as many components as you want and it doesn't matter where you put. It might even work if you put a GH_Component class inside another class, I'm not sure.

HOWEVER every component must be public and have a constructor which takes no arguments. If these two constraints aren't met your component will not be loaded.


David Rutten

Seattle, WA

Hi Again,

I continue to go further and a new error appears.

Now when I add component on the canvas ,it gives this error

to clarify the situation,I have a custom type called: baseProfileString with some properties

then:  public class ProfileGHGoo :Gh_Goo<BaseProfileString> and implements:

public ProfileGHGoo(): base() {  }       

public ProfileGHGoo(BaseProfileString profileSt): base  ()   { }

public override IGH_Goo Duplicate()  {...}

public override bool IsValid {get { return true; }  }

public override string ToString(){ return string.Format("{0}:Profile {1} type {2}", Value.SystemName,Value.ArticleNumber); }

 public override string TypeDescription  {get { return "..."; }    }

 public override string TypeName  {get { return " ..."; }

 } and then: ProfileGHParam: GH_PersistentParam/font>ProfileGHGoo> which implements:

public override Guid ComponentGuid{...}

public override GH_Exposure Exposure{...}

protected override GH_GetterResult Prompt_Plural(ref List/font>ProfileGHGoo> values){...}

protected override GH_GetterResult Prompt_Singular(ref ProfileGHGoo value){...}

 and component get a filepath as input and registers a BaseprofileString as output and  in SolveInstance: setDatalist(0,profileList) in which :profilelist is List<BaseProfileString> read which is  every cell of it read from a row of a csv file.

during debug error occurs when it reaches to constructor of ProfileGhGoo.

I guess i have to revise the constructor.Do you know where did i make mistake?




Finally it worked.

I just needed to instantiate a profileGHGOO type from BaseProfile... and use it instead in setdatalist().

Actually i was thinking that setdatalist() will wrap it(baseprofile... type) into ..GOO type. that's why I didnt think of that. but now,perfectly works!

Thanks all you guys.






  • Add Photos
  • View All


  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service