Summary: Much controversy and many support calls have arisen over the years concerning this command. This article will attempt to explain some of the workings of this useful but often misunderstood function and hopefully promote a more informed use.
To fully understand what this operation does, familiarize yourself with some of the basics of 3D constructive geometry as well as characteristics of both mesh and NURBS objects. A short description of the characteristics of Meshes and NURBS is below.
To understand what MeshToNurb does, one must also understand the fundamental differences between a Mesh model and a NURBS surface model. Although both can represent a 3D object as a computer model, they do it in completely different ways.
A mesh represents 3D surfaces as a series of discreet facets, much as pixels represent an image with a series of colored points. If the facets or pixels are small enough, the image appears “smooth”. Yet, if we zoom in enough, we can still see the “pixelization” or granularity and that the object is not locally smooth and continuous.
NURBS surfaces are mathematical representations of curves and surfaces. They are capable of representing complex free form surfaces that are inherently smooth, and they keep their smooth shape when editing. There is no pixelization or granularity as with a mesh. Thus they behave more like a real person’s face rather than a pixelized image of that same face.
It is important to note here that NURBS can be easily converted to Meshes at any time, in the same way that you can easily take a digital image of a person’s face with a camera. So, going from Meshes to NURBS is like trying to reconstruct a person’s face from a pixelized digital image - it is a much more difficult task, and there are no quick automatic methods.
To repeat, meshes are faceted representations of 2D and 3D surfaces. Individual mesh facets in Rhino can have either 3 sides (triangles) or 4 sides (quads). They are represented on your computer screen as a series of connected lines in wireframe mode; in shaded modes each facet is given a “surface” for visualization purposes. The points at the corners of the facets are called vertices. A series of facets join together to make a mesh object.
Important note: Although mesh facets are often believed to be always planar, this is an incorrect assumption. Only triangle meshes are guaranteed to have all planar facets. Quad facets may be planar, but they are not guaranteed to be so, as 4 non-coplanar points in space will describe a warped area.
There is a huge amount of information available on NURBS. It is a very complex subject and will not be discussed in detail in this article. NURBS are curves based on mathematics. NURBS surfaces are generated by a series of NURBS curves in two directions (called “U” and “V”) interpolated to create a surface. We will consider only the simplest case of NURBS surfaces here – the so called “bilinear” surfaces defined by degree 1 NURBS curves (i.e. lines) in both directions, as those are what are produced by MeshToNurb. When all the edges of the NURBS surface correspond with the original curves that generated the surface (the “natural” edges), the surface is called untrimmed. If the surface has been cut with a curve that is other than its natural edge, it is called trimmed.
The MeshToNurb command - what does it do, really?
As stated above, MeshToNurb does not automatically “reverse-engineer” mesh objects and make them into smooth surfaced NURBS objects. Sorry, no one-click miracles here. Once a 3D model is in mesh form, it's hard to recreate a smooth NURBS object from it. There is much info available on the subject of reverse engineering and its difficulties; here is one article on how to attempt this with Rhino tools. There are also several specialized reverse engineering software packages to partially automate this process. They range from moderately expensive to very expensive. There are even a couple of plug-ins available to add this capacity to Rhino (but they are not free).
MeshToNurb will convert a (faceted) mesh structure to a (faceted) NURBS structure. It does so by creating one NURBS surface for EVERY mesh face in the original object and joining the result into a polysurface (assuming the original mesh has more than one face).
Mesh Quads are converted to 4-sided untrimmed degree1 NURBS surfaces. Again, “untrimmed” means the “natural” edges of the surface are the same as the outer boundaries and nothing has been “trimmed” off. Thus, the defining edges of the NURBS surface in this case are the same as the lines representing the Mesh face's edges. This implies two things: If the original mesh quad face was defined by 4 coplanar points, all the edge lines are in the same plane, and the resulting NURBS surface will be planar. If the quad face’s 4 mesh vertices are not co-planar, the edge lines of the NURBS surface will not be co-planar and the surface will be warped. This type of surface can also be called a “ruled surface”.
Mesh Triangles. Triangles are by definition planar. MeshToNurb will convert mesh triangles into either trimmed planar NURBS surfaces, or untrimmed planar NURBS surfaces with a singularity (one edge collapsed to a point), depending on whether you have set the command line option TrimTriangularFaces to Yes or No. That option is only available if you do not preselect the meshes before starting the command. The trimmed NURBS surface will be a degree 1 x 1 surface as with the quads, just with one half trimmed off to form a triangle.
Based on the above, the resulting polysurface from MeshToNurb will have exactly the same edges as the original mesh model and be composed entirely of degree 1 x 1 (bilinear) NURBS surfaces. Triangle surfaces will be planar and trimmed, quad surfaces will be untrimmed and either planar or not.
Important note: MeshToNurb will not subdivide the quad areas into triangles to create planar surfaces.
Mesh objects can contain from a few to hundreds to thousands to millions of polygons. The mesh format is very compact for storing this faceted data. NURBS surfaces are much less compact in their definition. A NURBS representation of a mesh object produced by MeshToNurb may easily take up 100 times as much data as the mesh does. Executing MeshToNurb on complex meshes composed of many thousands of triangles may run your computer out of memory and will produce very large file sizes. If you have a recent machine with a good processor, enough memory, and a 64-bit operating system, this presents less of a problem.
If you now have a NURBS object produced by MeshToNurb composed of many thousands of tiny NURBS surfaces (just like the mesh was) what can you do with it? Not much – most normal operations will probably fail… so ask yourself why you need it.
An understanding of the type of geometry produced is essential. As stated above, quad mesh facets are not guaranteed to be planar, and the quad NURBS results from MeshToNurb may be warped. They may not be developable without stretching. If you are using UnrollSrf on the NURBS polysurface, the results may be distorted or incorrect. To ensure planarity and correct unrolling, either triangulate the mesh before running MeshToNurb or check the mesh to see if all faces are planar. (A script will be necessary to do this. There is no native Rhino tool currently available.)
MeshToNurb is useful for converting low-polygon count meshes that are mostly planar into NURBS surfaces for further work in Rhino. For example, you may import an architectural model from Sketchup or similar program that is mesh-based. The model is composed of largish planar mesh faces. MeshToNurb works well to convert the model to NURBS surfaces, and along with a few other tools such as MergeAllFaces, you can quickly get a good clean NURBS model in Rhino and continue modeling.
Since you cannot currently unroll mesh objects, you can use MeshToNurb and then unroll the resulting polysurface. Beware the above-mentioned caveats on usefulness, file size, and warped geometry.
Again, beware of file sizes, but occasionally this can get you out of a jam, although you will still have a faceted model.
WIP msh 13.04.2011