generative modeling for Rhino
This has been asked before, though a long time ago.
Network Surfaces in GH
I noticed that RhinoCommon (apparently) has 2 methods for it:
NurbsSurface.CreateNetworkSurface Method (IEnumerable(Curve), Int32, Double, Double, Double, Int32)
NurbsSurface.CreateNetworkSurface Method (IEnumerable(Curve), Int32, Int32, IEnumerable(Curve), Int32, Int32, Double, Double, Double, Int32)
But when I try to call the method, I get an error saying CreateNetworkSurface is not a member of NurbsSurface.
Did the author for the RhinoCommon documentation get carried away?
I mean, were these methods included in the online doc even though the method isn't actually exposed in the SDK yet?
Or is this just a GH limitation?
I'll explain my understanding of this, I'm sure someone will correct me if I'm misinterpreting.
RhinoCommon is a new dotNET SDK primarily for Rhino v5. It's really a wrapper for the c++ sdk, and there's new functions for methods such as network surface or unrolling exposed in v5 that are not available in the v4 sdk.
David ships (and loads) with Grasshopper a v4 specific rhino common library which cannot offer the v5 new features. If you are compiling your own gh assemblies, you can reference the v5 rhino common assembly to access these methods, and it will work provided you are running rhino v5 (you should get a runtime error if you try in v4). I can't remember testing scripting components (I think I did), but I assume it is the same situation.
Hope this makes sense,
But I am also trying to use createNetworkSurface but I am not sure I understand the above comment(its been a while since I have done any programming in grasshopper). Does this mean that I can't add
Dim testSurface As New Rhino.Geometry.NurbsSurface.CreateNetworkSurface(edgeCurves, 0, .1, .1, .1)
to my VB.net component where edgeCurves is a list of curves. Instead I have access to these new methods if I create my own plugin via visual studio.
Any help would be greatly appreciated.
It will work in a scripting component, but only in Rhino 5.0.
Thanks. I am using Rhino5 . I was stupidly, however, using 4 lines instead of 4 curves to create my network surface. Once I replaced the lines with curves I no longer got the CreateNetworkSurface command is not defined.
The problem I now have is that it is not producing a surface. I have reduced what I am doing to the bare bones to figure this out. 4 curves in rhino and 2 simple grasshopper components(one corresponds to the parameters that are listed in the online rhinocommon sdk help and the other to the parameters that are suggested in the tooltip when you are typing out the method).
If you have a moment to look that would be great.
1. make sure you specify the type hint in the scripting component to be "Curve"
2. I am not super familiar with vb.net syntax, but the following code seems to work:
Dim errOut As Integer = 0
A = NurbsSurface.CreateNetworkSurface(UCurves, 0, 0, VCurves, 0, 0, .1, .1, .1, errOut)
The C# equivalent would be:
int errOut = 0;
A = NurbsSurface.CreateNetworkSurface(UCurves, 0, 0, VCurves, 0, 0, 0.1, 0.1, 0.1, out errOut);
Hope that's helpful!
Thanks super helpful. I guess I thought you would have to create a empty nurbsSurface and then use its method createNetworkSurface but I guess the method acts more like a constructor(I think I am thinking more old rhino sdk).
I still don't understand why you need to set the error code. It seems like that should be the return(as it is supposed to tell you why the method failed) but I see that the return is either null or a nurbs surface.
Anyway thanks for everything. greatly appreciate it.
You don't need to set the error code beforehand since this is an [out] parameter. C# has no problem with this, but the VB.NET compiler will complain about the value not being set as a warning.
Ah, that makes sense. I never really knew the difference.