Grasshopper

algorithmic modeling for Rhino

For example,if i want to use  "populate 2d" in the c# code,how to invoke?

thank you very much!

Views: 619

Replies to This Discussion

Hi Andrea,

what do you mean exactly? Do you want to create a new Populate2D component on the canvas? Do you want to use the functionality inside Populate2D? 

It's possible to instantiate a GH_Component if you know the ID and then it's possible to add data to its input parameters, call the SolveInstance() method and harvest data written to outputs. Note however that some components require that they are part of a document.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Ciao David!

for example:

private void RunScript(rectangle rec, int num, int ranseed,ref object A)//i write it by hand,may be something wrong
{
    Arraylist <Point3d> mypoints=pop2d(rec,num,ranseed);  //get the points generated by pop2d    

    A=mypoints                                                                                          

}

i know the code is wrong, but i believe you can understand me, can you tell me how to do it in the right way?

Thank you very much!

Well, sometimes a component is almost empty as the function is available as a .NET framework function or a Rhino/Grasshopper SDK function. That's not the case with Populate2D, most of the logic is inside the SolveInstance function, so you're going to have to call that function. 

Wait, stop the presses. I just realised SolveInstance is a protected method, so you can't call it. It's a bit late today, but tomorrow I'll see if I can come up with some form of SDK function that makes it easier to call Component logic from the outside.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Thank you,David!

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service