Grasshopper

algorithmic modeling for Rhino

I was try to use Meshpatch in GH.

It is not in SDK for rhino 5.0 but rhino 6.

So other approach is using RhinoScript.

Then I run into the problem which is how to select multiple ID for the holes.

I wrote this.

private void RunScript(bool reset, Guid OutCrv, Guid Holes, ref object A)
{

if(reset)
{
// RhinoApp.RunScript(finalString, true);
RhinoApp.RunScript("_MeshPatch " + "_SelID " + OutCrv.ToString() + "_Enter" + "_SelID " + Holes.ToString() + "_Enter", true);
}

But the problem is "Holes" iincluding multiple ID.

Which means I should repeat ["_SelID " + Holes.ToString()] many times.

For example, if it is running in Rhino Macro, it is something like this.

 _MeshPatch
_SelID
126fc24e-6114-44d2-9756-99b8634ee3e0
_Enter
_SelID
0be95faf-dc82-455c-8b89-a97cac166e3e //OutCrv ID
_SelID
//Holes ID 2
_SelID
//Holes ID 3
_SelID
//Holes ID 4
_SelID
//Holes ID 5
_SelID
//Holes ID 6
_SelID
//Holes ID n
_Enter 
  
So how this work in c#?

Views: 43

Reply to This

Replies to This Discussion

Hello,

interesting problem, here is a solution:

if(reset)
{
string message = ""; //or Stringbuilder
message = string.Format("_MeshPatch _SelID {0} _Enter \n", curveID);
for (int i = 0; i < holesID.Count; i++)
 message += string.Format("_SelID {0} \n", holesID[i]);
message += "_Enter";
RhinoApp.RunScript(message, true);
}

RSS

Translate

Search Grasshopper

Photos

  • Add Photos
  • View All

© 2017   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service