Call a Rhino Command from Script

I want to offset a SubD, which I can do in Rhino. Is it possible to do this…

image

Where there is script (don’t care if it is Python, VB, C#) in the script component that calls the Rhino Offset SubD command?

This one SubD.Offset Method?

Yes!

I’ll try… don’t really have a clue about scripting!

What you expect from num in your example.
In the method they expect subd and distance.
Is num how many offsets with same distance or is it distance

Num would be the distance to offset

I suppose the script should work with one subD and one Distance (num) or with a flattened or grafted list of subDs and Nums

and i suppose I should also have a boolean input parameter for CreateSolid?

It should be simple and I can do it tomorrow… But you could try it so that you can expose every rhino common command to a grasshopper component… Even if the method is not available as a command for example CurveToLineAndArc.

So it is possible?

And I could pass a grasshopper subD into it and it would output an offset subD?

I Couldnt resist
.SubDOffset.gh (7.0 KB)

private void RunScript(List<SubD> S, List<double> Dis, bool Sol, ref object SO)
  {

    List<SubD> OffsetSubD = new List<SubD>();
    for (int i = 0;i < S.Count;i++)
    {
      OffsetSubD.Add(S[i].Offset(Dis[i], Sol));
    }
    SO = OffsetSubD;
  }
1 Like

That’s great! Thanks!