Coffee Mug Tutorial

This describes a way to make a coffee mug using CADZilla.

Making a polygon section

We will first create the coffee mug vessel, the part the holds the coffee beverage. We will do this by making a solid of revolution, since the vessel is symetrical this way. We will revolve a polygon section 360 degrees.

First, lets turn on the line grid and the coordinate system tripple visuals by using these functions the showLineGrid function and the showUCS function The handy tools for these functions may be found at the bottom of the viewport. A purple grid of lines should appear, and a small coordinate tripple should appear in the center. The grid spacing needs to be adjusted by using the gridSpacing function. This is also found on the bottom of the viewport. The grid is used as a scale to gauge the location of coordinates. The coffee mug we will draw is about three inches wide and tall, so it seems reasonable to set the grid spacing to 0.25 inches, in x and y. (Enter 0.25, 0.25). The snap ratio effects how many points between the grid elements are snapped to by the point picker. Set this to 0.5.

A couple more preparations need to be done. We want to draw our polyline aided by a grid snap. Turn on the grid snap using the gridSnap function. It may be found on the bottom of the viewport. And we need to scale the viewpoint down so that three inches of the model are visible. Before doing this we should turn on some grid labels using the gridSpacing function. Now lets shift the model down the viewport so that the origin is near the bottom. Use the translateViewpoint function. and drag the right or middle mouse button down. To make the more of the model fit in the viewport use ths scaleViewpoint function.

The polyline is created with the polyline function. The round tool for this may be found at the right of the viewport. The polyline is an object type that is a series of connected strait lines. Start the function, and you will notice as you move the cursor a yellow cross hair follows it around. The cross hair is showing you where the tentatively selected coordinate is. The polyline is defined by picking a series of coordinates. (Hence forth called points). Also, you will notice a group of points that seems to surround the immediate vicinity of the cross hair. These points indicate the allowable points of the grid snap are. The first point of our polyline object will be (0, 0). Move the cursor around the viewport to that point on tht picking plane, or type it into the point set widget in the "New Polyline" dialog. Although you could design a coffee mug how ever you wanted, this demo expects you will enter the following points:

        (0.0, 0.0, 0.0)
        (1.25, 0.0, 0.0)
        (1.25, -0.125, 0)
        (1.375, -0.125, 0)
        (1.375, 0.0, 0)
        (1.5, 0.0, 0)
        (1.625, 3.0, 0)
        (1.5, 3.0, 0)
        (1.375, 0.125, 0)
        (0.0, 0.125, 0)

You might be tempted to type this into the point box, but the fastest way is to pick them off the viewport as if you were drawing. We are going to round those corners later.

files/CADZilla_demos/coffee_mug/mug_0.mvg.

Revolving the section

The next step is to revolve the section using the revolution function. If you read the documentation to this function you would find out that it is a sequential input function that requires the following fields:

        
        1) a section to revolve
        2) an axis to revolve it about
        3) an angle of revolution

To pick the section to revolve, pick if off the viewport with the mouse. When you pick it it will become highlighted. To finalized this selection you may right click in the viewport or hit the OK button on the dialog. Finishing this entry will start the next, the axis of revolution. This data entry section has two sub entries it self - an axis base point and direction point. These sub entries are not visible by default. These are both point entries - just pick the points of the viewport or type them in. You should use (0.0, 0.0) for the base point and any point on the y axis for the direction point. The revolution function has the property that the axis direction has no effect on the sweep direction - the sweep is done out of the positive z direction of the xy plane of the current user coordinate system. (The UCS is reflected by the grid visual). After the second axis point is selected, the angle field is highlighted. Enter 360. Hit in this field or OK will finalize this function.

files/CADZilla_demos/coffee_mug/mug_1.mvg

Lets take a minor diversion at this point and check the undo/redo system. Use the undo function to restore the situation with a section and no revolution. Use the redo function to bring the revolution back. The entire undo history that shows what undo information has been stored is available from the undoHistory function.

Making sweep sections

The next step the handle. This may be created many ways, but we will do it by sweeping a section over a path. The authors coffee mug handle has an uncomfortable triangular section shape. We will make the handle in its final location right away rather than making it somewhere else and them moving it. Since we will define the handle solid with a path and a section, we must first create these. In this case it is easiest to start with the path. The path needs to be drawn so that it begins and ends where the existing mug solid intersects the xy plane.

Lets make the mug transparent to enable us to see the the grid everywhere. To make it transparent, double click on it to get its settings. Find the transparency setting and increase it to 0.75 or so.

Now lets change the coordinate system to make the handle line up easier. We are going to translate the grid so that its origin is at the old grid's (1.5, 0, 0), and rotate it about z so that the y axis is aligned to the side of the vessel. The best way to this is to make use of the ucs3 function. Start the function. Pick the origin as (1.5, 0, 0), pick the point on the x axis as (1.625, 3, 0), and pick a point on the xy plane as any point on the grid not on the line of the previous two points. Now since we wanted the x axis and not the y axis is aligned to the side, we need to rotate the grid about z by -90 degrees. To do this, use the ucsRotZ function. Enter -90 degrees.

At last we are set up to draw the handle path. Although the handle is curved we will start out by drawing it with strait lines and then smoothing it. Use the polyline function again, and draw within the current coordinate system these four points: (0, 0.25) (1.5, 0.25) (1.5, 2.75) (0, 2.75).

Now we will smooth the lines, by using the smoothPoly function. It's tool may be found to the left of the viewport. This function simply takes a selection of polygons so smooth. Pick the path polygon you just make. And change the "type" parameter to "Uniform Cubic Spline". Hit OK.

We have just made the handle path. Now we will create the handle section. It needs to be created in a plane perpendicular to the path polygon. So we need to rotate the coordinate system about its y-axis by 90 degrees, by using the ucsRotY function. Enter 90 degrees.

Use the polyline function again to draw a closed triangle around the end of the path polygon, using these four points: (-0.25, 0.375) (0 0.125) (0.25 0.375) (-0.25, 0.375). And we will round the corners. To to this, use the filletPolyfunction. This is a sequential input function that first asks for a radius and then a set of corners to fillet. Enter 0.05 for the radius. The focus should move to the fillet set entry, and as you move the mouse over the corners to fillet a green ball should appear over the corner. Pick each corner and hit OK.

files/CADZilla_demos/coffee_mug/mug_3.mvg

Sweep the sections

The elements of the handle solid are ready to use now. The handle can be created by sweeping the handle section over the handle path. To do this, use the sweep function, which sweeps a single section over single path. It may be found on the left of the viewport. This function is specified by a path selection and a section selection. Pick the the path polygon to fill in the "path" field, hit OK, and pick the "section" polygon to fill in the section field, and hit OK again. A polygons should be replaced by a swept solid.

files/CADZilla_demos/coffee_mug/mug_4.mvg

Moving the handle

The handle is floating in space right now, apart from the vessel. We are going to push it into the vessel and then union the two into one solid object. First we will translate the handle over. The best way to do this is to recall the UCS to the global position, and use the translate object function. Pick "Global" and hit OK. The UCS should move the original position. Now push the handle using the translate function. Pick the handle, hit OK, then enter the vector (-0.05, 0.0, 0.0) by typing it in or picking two points.

files/CADZilla_demos/coffee_mug/mug_5.mvg

We would like to verify that the handle is actually pushed inside the vessel. A way to do this is to render the vessel as a wire frame and check visually. The rendering properties are changed by double clicking on the object and then selecting the surface property from the list. Make edgeModel=All and surfaceModel=Wire. You should be able to twirl the viewpoint and verify the handle is pushed inside the vessel.

Unioning the handle

Now we will now union the handle to the vessel so that they are a single object, formed by a single closed surface. Use the solid union function. This function is specified by a single selection set of the solids to union. Select both the vessel and the handle and hit OK. You may now verify the mug is a single closed surface by changing its rendering properties to wire frame as for the vessel. Notice none of the surface of the original handle is existing inside the vessel, and like wise none of the vessel surface exists inside the old handle.

files/CADZilla_demos/coffee_mug/mug_6.mvg

Rounding the corners

Notice that there are several features of the mug that should be rounded instead of sharp. We will change the sharp corners of the vessel's polygon section to make them rounded. It is not important that the vessel solid has already been created - the Modelzilla database is keeps the intelligence of the objects (the way they were defined by the user) - not only the resultant geometries. We will need to get access to the polygon that formed the section of revolution for the vessel. It is now embedded in the the coffee mug object. Use the objectChildren function. Pick the coffee mug and hit OK. A section of the database comes up showing the tree of objects that forms the coffee mug. Select the object called "Polygon" and the geometry should automatically become visible. It is still part of the coffee mug object, only now it's visibility has been switched on. Now cancel the the "Object Children" dialog and double click in the viewport to de-select the polygon. We will use the filletPoly function to round some corners that result in sharp edges in the coffee mug. Enter a radius of 0.05. Now pick the corners of the polygon section. As you pick the corners the polygon you are filleting should become filleted, the revolution should be regenerated and the solid union should also regenerate.

files/CADZilla_demos/coffee_mug/mug_7.mvg