Use Rhino functionality in C++ application

Hello everybody!

I have come across this software because I have been given the task to look for software/libraries capable of reading IGES files containing NURBS information and work with them (i.e. display, ray intersection, trimming, retrieving NURBS information).
The purpose of this is that an existing C++ application which currently works with triangle meshes has to be renewed in order to work with NURBS (–> decreased memory needs, smoother results at edges,…).

My questions therefore are:

  • Is it possible to embed the Rhino functionality (especially concerning NURBS) into a C++ application?
  • Is openNURBS an alternative? (I’ve read the important features like intersections are only possible with Rhino)

Regards,
Raphael

No, you can’t embed Rhino functionality into another application and, if you want to read IGES, OpenNURBS is also not an alternative because it only reads and writes 3dm (the OpenNURBS format).

What you may want to consider is to create the functionality you desire as a plug-in for Rhino. Rhino is very extensible with plug-ins, in C++, .NET languagues and Python, as well as by scripting. The user can load the IGES file using default Rhino functionality and you can supply commands to work on the NURBS data in the Rhino document. It’s also possible to support your own data formats, using import/export plug-ins.

Another alternative is to create a C++ application that is built on top of OpenCASCADE, an open source CAD kernel. See http://www.opencascade.org for more details.

Yet another alternative is to license a commercial CAD kernel, like ACIS or ParaSolid. These are very powerful, but expensive, and you still need to build a C++ app around it.

Seeing as you want to use NURBS with trimming, my personal opinion is that you are best of with a Rhino plug-in. I have worked with OpenCASCADE for a bit, and have a lot of experience in Rhino and the SDK is much more user-friendly and documentation of Rhino is much better.

Thanks a lot for the quick reply!

I’ll try to get some information about both suggested possibilties and discuss with my colleagues what way to go.

Another question about openNURBS: If we get our input data not in IGES format but in 3dm format already (by using Rhino to import the IGES file and export it as a 3dm), would openNURBS be a possibility or is the functionality too limited?

Edit:
The problem why we cannot use Rhino directly is because the mentioned program runs integrated in a system where user interaction is not possible.
Therefore, Rhino itself can only be used for offline simulations.

If you save it as 3dm, then OpenNURBS is definitely a possibility to query the polysurface as a B-Rep (boundary representation).

The question is then what you want to do with the geometry information after you have read it from the file.

I recommend you to download the OpenNURBS SDK from http://www.opennurbs.org/ and look at the header and CPP files: there are functions that are listed in the header file, which are not implemented in the CPP file (these are only available in Rhino). For example, CreateMesh function on an ON_Brep object: it is listed in the header, but not implemented and you will get a link error when trying to use it.

To shortly explain the usage of the mentioned program:

The read geometry data is automatically scanned for defects on the surface, which is done by intersecting the the geometry data with rays. Finally after evaluating the gathered information automatic error handling takes place.
So the geometry from the IGES data (containing NURBS) has to be intersected with rays.

Alright, I already downloaded the OpenNURBS SDK and will take a look if the functionality suffices for our problem

The problem why we cannot use Rhino directly is because the mentioned
program runs integrated in a system where user interaction is not
possible.
Therefore, Rhino itself can only be used for offline simulations.

There is nothing that prevents you from writing a plug-in that listens for a request on e.g. a built-in webserver, performs an analysis and reports back the results.

The only thing is that you need a running Rhino, which then responds to these requests. The request can be something like: “there is an IGES file at this location, please load it and perform such-and-such analysis”. Then the running Rhino instance can load that IGES and perform the analysis and report back the results.