Thanks that’s it!
Hello Everyone, and as always thanks to Giulio for your work.
I have a very silly question (not so silly for me sorry)… if I call a grasshopper component in C# and for instance, I get one of the different results that the component provides (through your point 1) example), I have some difficulties in using the “result”.
I mean if I want to recall the ConvexHull component and I want to grab the result[2] ( it is a list of integers)…
dynamic GHConvexHull ( Point3d Pts, Plane Plane)
{
at some point in the code...
var index=results[2];
}
return (index)
in the Main Code at some point:
var idPt=ConvexHull (Pts, Pl);
Now if I want to know the idPt length in the main code and apply the “.Count” definition (idPt.Count), I get this error below:
- ‘Grasshopper.DataTree’ does not contain a definition for ‘Count’ (line: 0)
So the “result” appears as Grasshopper.DataTree type, although I see this “result” as a list in the output variable.
This behaviour is extendible to all the object types that come by the Rhino NodeInCode function to recall the GH components inside a C# code (the C# GH component).
In Python, everything works like a charm (by importing ghpythonlib).
***I hope that some experts can share with me tips or solutions. ***
Thank you very much in advance!
It’s true, in fact DataTree(T) Class does not contain a definition of Count. You can get autocompletion by casting to the right type. I think this is going to be DataTree, if memory serves.
Thanks,
Giulio
–
Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com
Hello Everyone.
I use NodeinCode name DivideCurve but i have a problems. I want to used result[0] as List but it didn’t work. So how i can fix it, please tell me. Thanks
Hi @ngthanhlong82,
Instead of this:
foreach (var obj in result[0])
Try this:
foreach (var obj in result)
– Dale
Hi @ngthanhlong82,
Sorry - I am unable to read your screen capture.
I know NodeInCode is “cool”, but why not just call Curve.DivideByCount or Curve.DivideByLength, which is what GH does…
test_divide_curve.gh (8.0 KB)
– Dale
Hi @dale . Thanks for answers me. I know 2 component as you told . But i want use this code to make something for me. I can use Method of Rhino" DivideByCount", but I curious about the NodeInCode. How to used it, so i try. Thanks.
I’d start by searching Discourse for NodeInCode.
Also, here are a couple of simple samples you can review. These scripts call the QuickHull component found in RhinoPolyhedra.
test_quickhull1.py (874 Bytes)
test_quickhull2.py (1.2 KB)
– Dale
Hi @dale . I had a problem when i used NodeInCode. When i used it in C# SCript, the result return type ( ex : surface). But when i used it in Visual studio ( component Grasshopper ), the result return : IronPython.Runtime.List. I don’t understand. How to convert to Rhino. Please help me. Thanks
Hi @ngthanhlong82,
A screen capture doesn’t really help anyone help you. If you still need assistance, then please post a .GH file.
– Dale
A number of third party plugins such as OpenNest,GeomGym,ShapeDiver are not found in NondeInCode, while these do meet the requirements as far as I can see.
I also wrote a number of grasshopper components myself. Two components are visible and the other components cannot be used in NondeIncode. All components are in the same gh assembly. I therefore wondered why not all components are visible in NodeInCode, even though they have the correct name?
Hi everyone, and thanks @piac for this!
Apologies for ripping this thread open, but I haven’t found an update to this issue.
Is the quote below still true? I’m trying to use NodeInCode to run a component from a third-party plugin (namely Kiwi3D), and I need to programmatically change its “special settings” as Giulio calls it - I’m calling it “custom component options” as per Rhino - Custom Component Options). Currently I’m using ComponentFunctionInfo.Evaluate to feed inputs and collect outputs, but I’m puzzled on how to change those special settings.
Thanks in advance, Eduardo
I just wonder if anyone encounters this:
When I am using a NodeInCode function, sometimes it will suddenly return a NULL result. In this grasshopper canvas, I will not be able to use any NodeInCode function. It will always return Null until I restart my Rhino. Then it works again.
Hi @piac, everyone,
I’d like to utilize the “Contour” component using NodeInCode but I can’t access it because there are multiple components that share the same name. Is there a way around this?
nodeInCodeIssue.gh (11.1 KB)







