xNURBS Grasshopper

Some xNURBS customers ask Grasshoper because they need to automatically generate a lot of surfaces based on xNURBS on the fly and to speed up their designing process based on xNURBS. Only three simple APIs from xNURBS plug-in are needed to implement xNURBS GH, which can be used to develop a ton of surfacing tools (It is possible to combine the three APIs into one API.). If we export the C APIs, could xNURBS customers use these C APIs?

7 Likes

Hi @XNurbs,

There are a few experts who will know what to do with a C API. But generally speaking, you should go the extra mile and provide a .NET API or even a Grasshopper plug-in.

– Dale

2 Likes

For xNURBS Grasshopper, we need put “CRhinoObjRef” in (curves or points). Is there a Grasshopper example for inputting “CRhinoObjRef”?

When providing a GH component to users, is there some basic description for how to use the GH function?

ObjRef. But it might not be a good practice because it would require something inside Rhino and you need to bake (a.k.a export from GH to Rhino) geometry first.

It’s better if xNURBS for GH can work on geometry object like ON_Brep rather than Rhino object.

@gankeyu

Thanks.

Is there a Grasshopper example for inputting curves and points? Also is there a Grasshopper example for inputting CRhinoHistoryRecord? (If so, then we only need to export one function.)

1 Like

Rhino’s History is not supported in Grasshopper. The ideal input (just what I believe, because I haven’t tried XNurbs) will be: (1) BReps to work on, which is ON_Brep in C++, or Brep in RhinoCommon; (2) Edges to blend, which are ON_BrepEdge/BrepEdge (3) Numeric inputs (double), guide points (ON_3dPoint/Point3d), etc, to control the outcome.

I don’t believe your customers are looking for controlling XNurbs from Grasshopper. They are expecting getting result in a pure Grasshopper environment, from Grasshopper geometry (aka openNURBS geometry), to Grasshopper geometry, without UI/object interaction with Rhino.

There’s an example by McNeel introducing how to program GH components. It’s easy, as long as with an understanding of how Grasshopper is infrastructured and how it works.

1 Like

@gankeyu

Is there a Grasshopper example for inputting a variable number of ON_Curve pointers? Many thanks.

Hi @XNurbs,

Keep in mind that Grasshopper is written in .NET. Thus, it cannot use a raw ON_Curve*. However, RhinoCommon’s Rhino.Geometry.Curve class is .NET wrapper for ON_Curve.

Here is code to a simple Grasshopper curve that extrudes a planar curve.

And more on wrapping native libraries:

– Dale

1 Like

We need input a variable number of curves, e.g., 2 curves, 3 curves or 100 curves etc. Also each curve has a set of options, e.g., G0/G1/G2 etc. How could we implement such a Grasshopper component?

(xNURBS can also handle a variable number of points and curves.)

Is that curve required to be an edge of BRep or it can be any curve?

Hi -

Typically, you would have one input in your component that takes a list of geometry, and another input that takes a list of continuity conditions.

As an example, you could take a look at the Fillet Edge component where edges are defined by indices.

Depending on the complexity of the options, a user can either simply use a Panel or you could provide a component that allows the users to construct a set of options in the correct way.
-wim

It can be any curve, Also xNURBS needs to handle a variable number of points and curves.

Many thanks for the info.

Is there a Grasshopper example for inputting a list of geometry and a list of options?

It will be very helpful if you could provide a Grasshopper example that shows:
how we could implement such a Grasshopper component?
how a user could use such a Grasshopper component?

We have been asking McNeel the question for a while, but did not get the answer we are looking for. It seems that your answer should work.

Not sure if this is what you mean, but I wrapped up a pseudo component, how I imagine it could look like:

XNurbs_gh_speudocompnent.gh (16.3 KB)

1 Like

Thanks.

Not sure if I can understand it. How do you know how many curves it inputs, e.g., e.g., 3 curves, or 100 curves? In C/C++, there will be a parameter for the number of curves.

counting the list at execution time, for example… I mean, in c# you have dynamic data structures, with no predefined number on elements.

Thanks.

We need figure out how a user could use such a Grasshopper component. Where did you learn how to use a Grasshopper component?

1 Like

It’s a long time ago but if people ask for where to start I think this is the best place:

This is a good start: