Rhino.NodeInCode namespace?

rhino
grasshopper
python

(Lukasz Domagala) #1

Not sure if this is a dream or I missed some announcement.:fearful:
Is this what I think it is?


Using the NodeInCode namespace
(Dale Fugier) #2

@piac, can you chime in here?


(Giulio Piacentino) #3

@velopl Yes, RhinoCommon give have access to all Grasshopper functionality.
This might still change a little in the next few weekly WIP updates, so as a namespace it is still in beta.


(Lukasz Domagala) #4

@piac I have to say this is probably the most exacting feature in R6 for me personally so far but I have to say I don’t know how to start with it. Would you be able to provide even the simplest example of use? Let’s say equivalent of ghcomp.components.Line ? How to create parameters in code as driving in Rhino.Geometry straight in gives me error. I’d be really grateful.


#5
private void RunScript(Point3d x, Point3d y, ref object A)
  {
    Rhino.NodeInCode.ComponentFunctionInfo cfi = Rhino.NodeInCode.Components.FindComponent("Line");
    string[] warnings = null;
    A = cfi.Evaluate(new object[]{x,y}, true, out warnings)[0];
    if(warnings != null && warnings.Length > 0){
      Array.ForEach(warnings ,w=>Print(w));
    }
  }

http://developer.rhino3d.com/api/RhinoCommon/html/T_Rhino_NodeInCode_ComponentFunctionInfo.htm

Thank you for adding this McNeel! :slight_smile:

EDIT* Ok, better look Using the NodeInCode namespace