NURBS Curves and Surfaces/ Trimming NURBS Surfaces

Trimming NURBS Surfaces

Trim curves can be used for cutting NURBS meshes. For example, one can drill a hole in a NURBS mesh using a circular trim curve. There are several ways to create a trim curve. You can select various trim curve tools from the NURBS tool tab. Also, you can use the Unified tools, like shown in the following examples.
 

Creating trim curves

The three unified creation tools create trim curves with a freeform, circular or rectangular shape.

To create a freeform trim curve:

1. Create a NURBS mesh using the Sweep tool, or simply use the NURBS rectangle tool and set the U and V parameters to a value of 8.

2. Select the mesh and activate the Unified/Curve tool. As usual, you can now see the curve tool specific options in the control bar.  Set the 'Class' option to 'Trim Curve' and make sure the 'Closed' option is checked.


Set the 'Class' option to 'Trim Curve' to create a trim curve

3. Click the mouse over the mesh to define control points for the trim curve. When done, accept the tool.


A trim curve created for the selected mesh

Note: A trim curve is an object whose geometry is defined in the parameter space (also called the 'uv' space) of the parent mesh. Therefore, when creating trim curves, the position of the mouse pointer must be within the borders of the parent mesh.

The mesh now consists of three curves: the original construction curves plus one trim curve.


A trimmed mesh
 

Modifying trim curves

Trim curves can be modified just like ordinary NURBS curves. For example, to move the trim curve to the left top edge of the mesh, just select the trim curve and use the Move tool as usual.

Note: In order to transform a trim curve, you always have to click the mouse over the mesh. Otherwise, the transformation tool will not be able to compute the necessary transformation in the parameter space of the mesh.

You can also use the standard transformation handles to modify trim curves. As usual, you can switch transformation handles on and off using the 'w' compass menu. For example, you can modify trim curves through their bounding box. To be able to see the bounding box, select the trim curve and  right click in the view window, to get the pop-up menu. Select Handles/Bounding box. Then use the 'W' compass menu like shown here. If the planar mesh is flat, the bounding box has a rectangular shape.


Switch on the bounding box through 'w' compass menu


Move the trim curve by dragging the bounding box

Just like regular NURBS curves, also trim curves can be single point edited in the edit mode. As usual, hit the space bar to enter the edit mode and drag points to move them. You can also multi select any number of control points and apply standard transformation tools, such as move, scale and rotate, to the selected points.
 


A trim curve in the 'Edit' mode
 
When you select a trim curve, the control bar shows you a number of tools which can be used for manipulating the curve. We have already demonstrated most of these tools in the context of NURBS curves.


Trim curve specific tools
 
Trim curves can be duplicated in the same way as any geometric objects. For example, just hold down the 'copy modifier' (Ctrl) while moving the trim curve.


Ctrl + drag to duplicate the trim curve similar to any regular geometric object.

You can copy trim curves using standard Edit/Cut, Paste and Duplicate tools. For example, cut a trim curve from one mesh and paste it inside another mesh. Or, use simple drag&drop in the select window to move trim curves in the object hierarchy.
 
Because trim curves are defined in the parameter space of the mesh, all deformations you apply to the mesh will also deform the trim curve accordingly. For example, if you modify either of the two 'sweep' curves, the trim curve gets modified with the mesh accordingly.

Tutorial project: 'tutorprojects\modeling\nurbs\trim curves\trimmed mesh'
 

Boolean operations of trim curves

The general Boolean operations work also for trim curves. The difference is that since trim curves are defined in the two dimensional 'uv space', also the Boolean operations are applied in a two dimensional space.

All the three standard Boolean operations are supported: Union (OR), Intersection (AND) and Exclusive Or (XOR).

Boolean operation is an attribute of the actual NURBS mesh. You can select the desired Boolean operation method from the property window's 'Spec' tab.
 

The 'Boolean' attribute of the mesh

The following three images demonstrate the effect of different Boolean operations.


Difference (XOR)
 


Intersection (AND)


Union (OR)

Just like you can invert the Boolean operation of a regular 3D Boolean object, you can invert the Boolean operation between the trim curves of a mesh. Just check the 'Invert Boolean' option through the property gadget of the NURBS mesh.
 
The property window for the NURBS mesh: Boolean operation set to 'Union' and result 'Inverted'.

The 'Invert Boolean' inverts the 'inside/outside' property of trim curves so that what was inside before becomes outside.

In addition to inverting the top level Boolean operation of trim curves associated with a mesh, you can invert an individual trim curve.  To do this, select the trim curve and go to the property window's 'Gen' tab. Check the 'Volume Inverted' property (see the Boolean operations between true 3D objects).


Volume of a trim curve inverted. Trim curve trims 'outside' instead of 'inside'.
 

'Trim curve 1'  AND NOT 'trim curve 2'

These three attributes give you total control over Boolean operations between trim curves.
 

Converting trim curves to regular NURBS curves

Let's assume you have a trim curve and you need to convert it to a standard NURBS curve. The 'To 3D' tool does this. Just select a trim curve and click the 'To 3D' tool to map the trim curve to 3D space.

This tool creates a regular NURBS curve, which passes through the control points of the trim curve. As a result, the shape of the 3D curve changes! The reason is that the uv space of a mesh is usually curved whereas the 3D model space is neatly linear. The more control points the trim curve has, the more accurately the curves match.
 
 

Converting NURBS curves to trim curves

It is also possible to map the control points of a regular NURBS curve to the parameter space of a mesh.

To create a trim curve from a NURBS curve:

1. Create a NURBS mesh using, for example, the NURBS/Rectangle tool.

2. Create a closed NURBS curve over the mesh. In the select window, drag & drop the curve inside the mesh. You now have a NURBS mesh, which includes one NURBS curve.


Create a NURBS curve inside a mesh

3. Select the NURBS curve. The control bar now shows you a number of NURBS curve specific tools. Click the Trim tool.


Select the curve and click the Trim tool
 

Note: In this operation, the shape of the created trim curve does not usually match the shape of the original curve exactly. The more control points the curve has, the more accurately the trim curve follows the original NURBS curve.
 
 

Projecting curves to trim curves

It is also possible to convert a NURBS curve to a trim curve by using the current transformation of a view window.  In this method, the control points of a NURBS curve are not snapped to the nearest surface points. Instead, they are projected to the surface behind them.

1. Create a curved NURBS mesh and a closed NURBS curve, as shown in the next picture.


A NURBS surface and a NURBS curve.

2. Select the mesh and the curve. Then rotate the view window to find a desired projection.


Rotate the view window until the curve is in right place over the mesh

3. Then select the 'Tools/Nurbs Construction/Create Trimmed Surface' tool and click 'Accept'.


A NURBS curve projected onto a mesh