BRL-CAD Tutorial Series: Volume II - Introduction to MGED

April 2001


Table of Contents

Preface
Acknowledgements
1. Creating Primitive Shapes
1.1. Launching the MGED Program
1.2. Entering Commands in the Command Window
1.3. Using the GUI
1.4. Opening or Creating a New Database when Launching MGED
1.5. Using the GUI to Open or Create a Database
1.6. Assigning a Title to Your Database
1.7. Selecting a Unit of Length
1.8. Selecting a Primitive Shape
1.9. Creating a Sphere from the Command Line
1.10. Clearing the Graphics Window
1.11. Drawing a Previously Created Object
1.12. Erasing an Item from the Graphics Window
1.13. Creating a Sphere Using the GUI
1.14. Viewing a Shape's Parameters
1.15. Listing the Contents of a Database
1.16. Killing a Shape or Object
1.17. Editing Commands in the Command Window
1.18. Quitting MGED
1.19. Review
2. Learning the Viewing Options
2.1. Creating a Radio
2.2. Locating Viewing Information in the Command Window
2.3. Identifying Elements of the MGED Viewing System
2.4. Summing up on Azimuth and Elevation and the xyz Coordinate System
2.5. Viewing Your Radio from Different Angles
2.6. Working with Shift Grips
2.7. Review
3. Using the Insert Command to Size and Place Shapes
3.1. Creating a New Database from the Command Window
3.2. Creating a Sphere Using the Make Command
3.3. Using the In Command to Create Shapes
3.4. Combining Arguments on One Line
3.5. Making a Combined-Command Form for the In Command
3.6. Considering MGED Naming Conventions
3.7. Viewing the Shapes
3.8. Quitting MGED
3.9. Review
4. Assigning Material Properties and Raytracing
4.1. Opening the Database
4.2. Creating a Region
4.3. Assigning Material Properties to a Region
4.4. Clearing the Graphics Window and Drawing the New Region
4.5. Raytracing Your Model
4.6. Changing Layers of the Graphics Window
4.7. Clearing the Graphics Window
4.8. Review
5. Lesson 5: Learning About Boolean Expressions
5.1. Combinations and Regions: Boolean Tools
5.2. Boolean Operations
5.3. Making Regions with Boolean Operations
5.4. Operator Precedence
5.5. Review
6. Creating a Goblet
6.1. Creating a New Database
6.2. Creating, Editing, and Copying the Parts of the Goblet
6.3. Making Regions of the Goblet's Base, Stem, and Basin
6.4. Making a Combination of the Regions
6.5. Viewing a Data Tree
6.6. Raytracing the Goblet
6.7. Review
7. Assigning Material Properties to Your Goblet
7.1. Review of Opening an Existing Database
7.2. Assigning Colors and the Plastic Shader to Regions of the Goblet
7.3. Using the Transparency and Mirror Reflectance Shader Options
7.4. Raytracing the New Forms of the Goblet
7.5. Review
8. Assigning More Material Properties to Your Goblet
8.1. Specular and Diffuse Reflectivity
8.2. Refractive Index
8.3. Shininess
8.4. Extinction
8.5. Emission
8.6. Applying Attributes of the Plastic Shader to the Goblet
8.7. Review
9. Creating a Globe in a Display Box
9.1. Create a New Database
9.2. Creating the Display Box
9.3. Create a Globe Inside the Display Box
9.4. Using the Combination Editor to Assign Material Properties that Make the Objects Appear More Realistic
9.5. Moving and Rotating an Object
9.6. Use the Color Tool of the Combination Editor to Produce Customized Colors.
9.7. Review
10. Creating a Mug
10.1. Creating a New Database
10.2. Creating the Outside Cylinder Using the In Command
10.3. Creating the Inside Cylinder
10.4. Creating the Handle
10.5. Creating the Bodyout.s-Bodyin.s Combination
10.6. Creating the Handle.s - Bodyout.s Combination
10.7. Creating the Region Mug.r
10.8. Review
11. Refining the Mug
11.1. Assigning Material Properties to the Mug Using the mater Command
11.2. Raytracing the Mug
11.3. Refining the Mug
11.4. Combining the Shapes
11.5. Review
12. Creating the Mug Through the GUI
12.1. Creating the Body of the Mug
12.2. Creating the Handle of the Mug
12.3. Creating the Rim of the Mug
12.4. Creating Combinations of the Various Shapes
12.5. Making a Region of the Combinations
12.6. Checking the Data Tree
12.7. Assigning Material Properties Using the Combination Editor
12.8. Raytracing the Design
12.9. Review
13. Placing Shapes in 3-D Space
13.1. Creating the Tabletop
13.2. Creating the Candle Base
13.3. Creating the Candle
13.4. Creating the Candle Flame
13.5. Making a Combination of the Base, Candle, and Flame
13.6. Checking the Data Tree
13.7. Assigning Material Properties to the Elements of the Design
13.8. Raytracing Your Design
13.9. Review
14. Gaining More Practice Placing Shapes in Space
14.1. Making the First Sphere
14.2. Using the Draw Grid Feature
14.3. Using the Multipane Feature
14.4. Creating Copies of a Shape
14.5. Making Regions of the Spheres
14.6. Combining the Spheres with the Candle Base
14.7. Review
15. Creating a Toy Truck
15.1. Creating an rpp for the Cab of the Truck Using the In Command
15.2. Using the Inside Command to Create an rpp for the Hood of the Cab
15.3. Using an rcc to Create a Wheel Well in the Cab
15.4. The Difference Between OK, Accept, Apply, Reset, Cancel, and Dismiss
15.5. Using the Primitive Editor to Make a Copy of the Wheel Well
15.6. Making a Combination of the Cab Shapes
15.7. Creating an rpp for the Body of the Truck Using the In Command
15.8. Using the Primitive Editor to Make Two More Wheel Wells
15.9. Making a Combination of the Truck Body and Wheel Wells
15.10. Making a Region of the Cab and Body
15.11. Making Wheels for the Truck
15.12. Making a Region of the Wheels
15.13. Assigning Material Properties to the Truck Regions
15.14. Using the On-Screen Help Option
15.15. The Stacker Option
15.16. Using the Stacker Option
15.17. Making a Combination of the Truck Regions
15.18. Raytracing the Truck
15.19. Review
16. Learning Modeling Techniques and Structures
16.1. Making the Shapes into Regions
16.2. The Body of the Radio
16.3. The Other Regions
16.4. Gathering the Regions into an Assembly Combination
16.5. Assigning Material Properties to the Regions
16.6. Adding Internal Components
16.7. Making Specialty Models of the Radio
16.8. Redefining the Structure of the Radio
16.9. Review
A. MGED Commands

List of Tables

2.1. Viewing Data at the Bottom of the Command Window
2.2. Shift Grip Keys and Effects

Since 1979, the U.S. Army Research Laboratory (formerly the Ballistic Research Laboratory) has been developing the BRL-CAD constructive solid geometry (CSG) modeling package for a wide range of military and industrial applications. The strength of the package lies in its ability to build realistic models of complex objects from a relatively small set of "primitive shapes" by employing the basic Boolean operations of union, subtraction, and intersection and by assigning real-world material attributes.

The package comprises a large collection of tools, utilities, and libraries including an interactive geometry editor, ray-tracing and generic framebuffer libraries, a network-distributed image-processing and signal-processing capability, and an embedded scripting language.

Although BRL-CAD has continued to mature in performance and utility, developers have strived to keep the package approachable and easy to use, as evidenced by the package's dual command formats, its newly renovated graphical user interface (GUI), and its customization potential through user scripting.

In addition, a multivolume tutorial series is being developed to assist users in a variety of BRL-CAD areas and applications. The "Introduction to MGED," which is the second volume in the series, is intended to provide new users with a basic understanding of the Multi-Device Geometry Editor (MGED), which is the heart of the BRL-CAD package. Other volumes focus on installation procedures, advanced features, and programming.

The authors would like to thank Paul Tanenbaum, TraNese Christy, Sean Morrison, and the other members of the Advanced Computer Systems Team who reviewed this document in a timely manner and made many helpful suggestions to improve its accuracy and presentation.

In addition, the authors would like to acknowledge team member Mike Muuss, who passed away while this volume was in preparation. Mike was the original architect of the BRL-CAD package and guided its development for 20 years until his death on 20 November 2000. He embodied a unique blend of unparalleled intellect, unquenchable curiosity, and unending energy to advance the capabilities of everything and everyone he touched. A natural-born troubleshooter, Mike approached every job, big or small, with a passion for excellence and a child-like enthusiasm, which helped drive BRL-CAD far beyond expectations.

Although he never got a chance to review this document, much of this work is a result of his vision and attention to detail. Therefore, the BRL-CAD Tutorial Series is dedicated to his memory. His sharp mind, his warm spirit, and his loyal friendship will be greatly missed.

In this lesson, you will:

Sometimes when you are making a model, you might want to view a shape's parameters, such as height, width, or radius, in the Command Window. You can easily list the attributes of a shape by typing the l (for "list") command at the Command Window prompt as follows: l shape_name[ENTER][1]

Note

Note: If you attempt to type in the Command Window and you see no words appearing there, chances are the focus has not been set on that window (i.e., keyboard input is still directed to another window). Depending on your system's configurations, the focus is set to a window either by moving the cursor into the window or clicking on the window.

An example of the dialog that might occur in the Command Window for the parameters or attributes of the first sphere you created is as follows:


mged> l sph1.s

sph1.s: ellipsoid (ELL)

     V (1, 1, 1)

     A (1, 0, 0) mag=1

     B (0, 1, 0) mag=1

     C (0, 0, 1) mag=1

     A direction cosines=(0, 90, 90)

     A rotation angle=0, fallback angle=0

     B direction cosines=(90, 0, 90)

     B rotation angle=90 fallback angle=0

     C direction cosines=(90, 90, 0)

     C rotation angle=0, fallback angle=90

Don't be concerned if you notice in the preceding output that MGED stores your sphere as an ellipsoid. In actuality, the sphere is just a special case of the ellipsoid (see Appendix C). Also, note that it is not important if the numbers in your output do not match what is shown in this example.

Use the l command to list both sph1.s and sph2.s before continuing with this lesson.



[1] Note: The command is the lowercase letter l, NOT the number one.

In this lesson, you will:

Models in BRL-CAD are constructed in a single xyz coordinate system, which we sometimes refer to as model space. The Graphics Window of MGED displays a portion of this space. The xyz coordinate system is used for specifying both the geometry and the view of the geometry that is presented in the Graphics Window.

MGED offers a default view and a variety of optional views. You can switch back and forth between these views during and after model creation. This lesson is designed to help you understand the viewing process and options.

To gain practice viewing actual geometry, let's build a simple geometric object-a "walkie-talkie" radio. Note that the commands we use to do this are not discussed here because our current concern is on applying the principles of viewing. Later lessons on creating geometry address these commands in detail. Begin by launching MGED and creating a new database named radio.g. Remember that one way to do this is to type the following command in a Terminal Window: $ mged radio.g

Type the following in the Command Window, carefully checking each line before pressing ENTER. If you make a mistake, use BACKSPACE or the left/ right arrow keys to make corrections before pressing ENTER (see Appendix B for the editing command list).

An image similar to the following should now appear in the Graphics Window.

The size of the view is the amount of model space that is shown in the Graphics Window. For example, consider using a camera with a zoom lens to photograph a rose. As shown in the following figures, if you zoom in on the rose, it will appear large in relation to your viewing field. If you zoom out, it will appear smaller. In actuality, the view size for the rose image on the left might represent only 15 mm across while the view size for the image on the right might represent 100 mm across. In both cases, however, the actual size of the rose is the same.

Zoom In to View Details (small size of view)Zoom Out to View Object in Relation to Environment (large size of view)

To change the view size of your radio through the GUI, click the right mouse button to zoom in and the left mouse button to zoom out. Each time you click the left or right mouse button, the view of the design will increase or decrease in size by a factor of 2 (i.e., two times larger or two times smaller than the previous size).

You can also zoom in or out on your design by going to the View menu and selecting Zoom In or Zoom Out. A drawback to this method is that you can only zoom in or out one time because the drop-down menu closes once you make a selection.

If you get lost at any point while creating a model, you can use the zap (Z) command to clear the geometry from the Graphics Window and then recall the shape with the draw command. When drawing in an empty Graphics Window, MGED automatically sizes the view to fit what you draw into the window.

You can control the view size of your radio more accurately with the Command Window. To set the size to 100 (of whichever units you have selected), type at the prompt: size 100[Enter]

You can also zoom in or out on a design by typing zoom on the Command Line. To make your radio appear 50% smaller, you would type: zoom 0.5[Enter]

To make your radio appear twice as large, you would type: zoom 2[Enter]

Azimuth, elevation, and twist (all measured in degrees) determine where you are in relation to the object you are viewing. Azimuth determines where you are around the sides of it (i.e., to the front, left, right, behind, or somewhere in between), elevation determines where you are above or below it, and twist determines the angle you are rotated about the viewing direction.

To better understand azimuth, imagine walking around a truck with a camera to photograph it. As shown in the following illustrations, you would be at 0'0 azimuth if you stood directly in front of the truck to take its picture. If you circled around slightly to your right, you would be at 35'0 azimuth. If you moved further around until you were looking directly at the driver's side (in U.S. trucks), you would be at 90'0 azimuth. Standing behind it would put you at 180'0 azimuth. If you were facing the passenger's side, you would be at 270'0 azimuth.

Front (az=0, el=0)az=35, el=0
Left (az=90, el=0)Rear (az=180, el=0)
Right (az=270, el=0)

Elevation, on the other hand, involves the viewer's position above or below an object. In the preceding example, you circled around a truck without changing your relative height. You had an elevation of 0'0, which means you were level with it. As the following figures illustrate, however, imagine stopping at the 35'0 azimuth position and then climbing a ladder to photograph the truck from 25'0 elevation. Climbing higher, you would be at 60'0 elevation. If you were directly above it with the camera facing down, you would be at 90'0 elevation. If you crawled under the truck and looked directly up at it, you would be at -90'0 elevation.

az=35, el=0az=35, el=25
az=35, el=60az=35, el=90
Top (az=270, el=90)Bottom (az=270, el=-90)

Finally, twist (which is an optional setting in MGED) specifies a rotation about the viewing direction. This rotation is applied to the view after azimuth and elevation have been designated. So, returning to our truck example, imagine standing in front of the vehicle (az=0, el=0) and then tilting your camera counterclockwise 14'0. This would give your view a 14'0 twist angle, as shown in the following figure (on the left). Note again that it is not the truck that is tipped up, but simply your view of it. For more information on specifying twist, see the ae command in Appendix A.

Front (az=0, el=0, tw=14)

The Shift Grip options of MGED are handy hot-key and mouse button combinations that can be used in two different ways. With regard to our present discussion on viewing, the Shift Grips can, in effect, "drag" the world around in front of the viewer (but without actually changing the coordinates of the viewed objects). The same Shift Grips can also be used in Edit mode to actually move or alter the geometry of your objects. In both cases, the Shift Grips appear to do the same thing, so it is important always to know the mode in which you are operating.

In general, the SHIFT key translates (moves), the CTRL key rotates, and the ALT key constrains (or limits) translation or rotation to a particular axis (x, y, or z). These axes correspond to the three mouse buttons as follows: the left button represents the x axis, the middle button represents the y axis, and the right button represents the z axis. In addition, the SHIFT and CTRL keys can be used in conjunction with any mouse button to scale an object (although the ALT key will not constrain this action). The following table lists all of the key bindings and their functions.


Caution

Depending on your window manager or desktop environment settings, some key combinations may already be designated to perform other tasks (e.g., resizing or moving a window). If so, you may need to adjust settings to allow the Shift Grip options to function. Furthermore, left-handed users may have switched the behavior of the left and right mouse buttons in their system configurations. In such instances, the terms left mouse button and right mouse button should be switched throughout this document.

Probably the easiest way to familiarize yourself with the Shift Grip options is to try them out on your radio. Using the preceding table as a guide, experiment with translating, rotating, constraining translation and rotation to particular axes, and sizing your radio view.

Note

Remember, although the Shift Grip options may appear to be manipulating objects, unless you are in Edit mode they are only manipulating your view of the objects.

In this lesson, you will:

This lesson focuses on creating shapes from the Command Window using the make and in commands. You will create a sphere (sph) and a right circular cylinder (rcc) using both commands so that you can see how each command works. Later in the lesson, you will practice viewing your model from different angles.

Begin by making the Command Window active (usually done by clicking anywhere in the window). Then, use the Z (zap) command to clear the Graphics Window. You are now ready to create a sphere using the in command. At the MGED prompt type: in sph2.s sph[Enter]

MGED will respond with: Enter X, Y, Z of vertex:

You must tell MGED where to position the vertex (center) of your sphere in space. Type at the MGED prompt: 4 4 4[Enter]

Your sphere will now be placed at (x,y,z)=(4,4,4), as measured in millimeters. Notice that the numbers are separated by spaces followed by the ENTER key. MGED will now ask you to:

The radius of your sphere will be 3 mm. The following is the dialog that should appear in your Command Window (including the appropriate responses). mged> in sph2.s sph Enter X, Y, Z of vertex: 4 4 4 Enter radius: 3 51 vectors in 0.000543 sec The last line of this dialog is simply a record of the computer's speed in drawing the shape. It has no real usefulness to the user at this point.

A sphere has now been created, and a wireframe drawing similar to the one created using the make command should appear in your Graphics Window.

To make the right circular cylinder, type at the Command Window prompt: in rcc2.s rcc[Enter] MGED will ask you to enter values for x, y, and z of the vertex (where you want the center of one end of the rcc placed in space). Type: 4 4 0[Enter] Be sure to leave spaces between each of these numbers.

MGED will now ask you to enter the x, y, and z values of the height (H) vector (i.e., how long you want the rcc to be). Type: 0 0 4[Enter] The last value you will need to enter is the radius of the rcc. Type: 3[Enter] The dialog in the Command Window for the creation of the rcc should look like this:

You should now have new versions of the sphere and rcc shapes. Notice how these two shapes compare in size to the first two you created. The rcc is now in proportion to the sphere and is placed in space off to the left in your Graphics Window. By specifying the dimensions of the shapes and their locations in space, you were able to create the model more precisely.

Shapes Created with Make CommandShapes Created with In Command

Another way to use the in command is to combine all of the required information on one line. Once you become familiar with using the in command, you will probably prefer to use this method as it allows you to input all the parameter values more quickly.

Clear the Graphics Window by using the Z command. Now make another sphere by typing after the MGED prompt: in sph3.s sph 4 4 4 3[Enter]

The meaning of this longer form of the command is:

insph3.ssph4443
Insert a primitive shapeName it sph3.sMake the primitive shape a sphereMake the x of the vertex a value of 4Make the y of the vertex a value of 4Make the z of the vertex a value of 4Make the radius a value of 3

To make the right circular cylinder using this method, type after the MGED prompt: in rcc3.s rcc 4 4 0 0 0 4 3[Enter]

The meaning of this command is:

inrcc3.srcc4400043
Insert a primitive shapeName it rcc3.sMake the primitive shape a right circular cylinderMake the x of the vertex a value of 4Make the y of the vertex a value of 4Make the z of the vertex a value of 0Make the x of the height vector a value of 0Make the y of the height vector a value of 0Make the z of the height vector a value of 4Make the radius a value of 3
Make the shape four units long, pointing straight toward positive z

When you are first starting to use MGED, if you want to use the Command Window rather than the GUI, you may want to make yourself some blank, combined-command forms for each type of primitive shape you will be creating. This can speed up the design process and help remind you of which values must be entered for each shape. A form for the sphere might be:

in?sph????   
Insert a shapeName of primitive shapeType of shape is a sphereValue of xValue of yValue of zRadius of sph   
Center   

A Combined-Command Form for the rcc might be:

in?rcc???
Insert a primitive shapeName of shapeType of shape is a right circular cylinderValue of xValue of yValue of zValue of xValue of yValue of zRadius of rcc
VertexHeight vector

In this lesson, you will:

Now go to the File menu and select Raytrace. A dialog box called the Raytrace Control Panel will appear. At the top are menus for Framebuffer and Objects. Select Framebuffer. A drop-down menu will appear with six choices: Active, All, Rectangle Area, Overlay, Interlay, and Underlay. Make sure the Active, All, and Underlay options are activated (as shown by the presence of a red indicator to the left of each choice). Select OK.

Change the background color produced by the raytracer by selecting Background Color in the Raytrace Control Panel. A drop-down menu will appear with some predefined color choices plus a color tool. Select the white option. The select button should now appear white, in accordance with your selection.

Next select Raytrace from the four options along the bottom of the box. The Graphics Window should start changing, and you will soon see your design in shades of green with the wireframe superimposed on the design, as shown in the following example:

As we have seen, you can specify the background color for the raytraced image.

You can also fill the entire framebuffer with the background color. To do this, select the desired color and then click the fbclear (framebuffer clear) button at the bottom of the Raytrace Control Panel.

The Graphics Window of MGED is used to display different types of graphical information: 3D wireframes and 2D pixels (or images). Conceptually, each type of data occupies a separate layer in the display. The 3D wireframes occupy the wireframe layer, while the 2D pixels (images) occupy the framebuffer layer. These layers can be thought of as transparencies, and the order in which they are stacked and displayed can be changed.

As mentioned previously, there is a Framebuffer menu within the Raytrace Control Panel. At the top of this menu is a toggle button labeled Active. This turns the display of the framebuffer layer on and off. Near the bottom of the same menu are three radio buttons: Overlay, Interlay, and Underlay. When the underlay mode is selected, the pixel data are displayed under or behind the vector data. Conversely, when the overlay mode is selected, the pixel data are in front of the vector data. The interlay option is similar to the overlay mode. The subtle difference is an advanced topic not covered here.

Framebuffer in Underlay ModeFramebuffer in Overlay Mode

To see how this works, go to the framebuffer menu and select Overlay. Notice that the wireframe representation disappears. Where does it go? If you answered "behind the framebuffer," you would be correct. To view the model's geometry, you would have to make the framebuffer inactive or select underlay mode.

The wireframe layer has a yellow dot in the center that marks the center of the view talked about in Lesson 2. This allows you to determine whether the framebuffer is in overlay or underlay mode. If you can see the yellow dot, the framebuffer is in underlay mode. If you've told MGED to draw some geometry and the Graphics Window seems to remain blank, you are probably seeing a blank framebuffer masking the wireframe layer.

Note that you can change the view in the wireframe, but the view in the framebuffer does not automatically update to match. It is not possible to directly manipulate the view in the framebuffer. You must raytrace again in order to update the framebuffer image.

In this lesson, you will:

The three Boolean operators employed by the MGED program are union, subtraction, and intersection. You can use Boolean operations to combine shapes to produce more complex shapes.

Begin by opening the database shapes.g that you created in Lesson 3. At the Command Window prompt, type: draw sph2.s rcc2.s[Enter] This lets us see the shapes we will be using to create our regions. As seen earlier, the two shapes should look something like the following:

In this lesson, we will create different shapes to demonstrate the function of Boolean operations. In the Command Window, type the following: r part1.r u rcc2.s - sph2.s[Enter] This command tells MGED to:

rpart1.rurcc2.s-sph2.s
Make a regionCall it part1.rMerge...The shape named rcc2.sSubtract...The shape named sph2.s

In the previous lesson, we applied material properties to objects from the Command Line. Now we are going to use the graphical interface to do the same thing. From the Edit menu, choose Combination Editor. This will pop up a dialog box. Select the button to the right of the Name entry box and then Select from All. A drop-down menu will appear with the regions you have created. Select part1.r. The result should look like the following:

Click on the button next to Color and select red from the pull-down menu.

Now click the OK button at the bottom left of the dialog window. This will apply your changes and close the panel.

At the moment, we have only the primitive shapes displayed, not the region. Before we can raytrace, we must remove the primitive shapes from the display, and draw the region. Otherwise, we will not be able to see the region with the color properties we applied. We can do this by typing: B part1.r

We are now ready to raytrace this object. From the File menu, bring up the Raytrace Control Panel and click the Raytrace button. The image you get should look similar to the left-hand image that follows. Note that it may take several minutes to raytrace the window, depending on the speed of your particular system.

Raytraced part1.rRaytraced part2.r

You should see that a spherical "bite" has been taken out of the top of the cylinder.

Next we will make a blue region using the intersection operator instead of subtraction. Once again, we start by creating a region: r part2.r u rcc2.s + sph2.s[Enter]

For comparison to the GUI approach used to make part1.r, let's use the Command Line to assign the color to part2.r: mater part2.r plastic 0 0 255 0[Enter]

Finally, Blast this new region onto the display as follows: B part2.r[Enter]

Now raytrace the object. It should look similar to the preceding right-hand image.

When you use the intersection operator, the order in which you specify the shapes doesn't matter. We would have gotten the same results if we had specified the Boolean operation as r part2.r u sph2.s + rcc2.s

However, when using the subtraction operator, the order of the two shapes is very important. Let's make a region with the order of the shapes reversed from that used for part1.r: r part3.r u sph2.s - rcc2.s

This time we won't bother to set a color. (When no color is set for objects, the raytracer (rt) will use a color of white. However, these objects may appear gray because of the amount of light in the scene.) Blast this design to the display and raytrace it:

Now let's raytrace all three objects we have created together. To draw the three regions at once, we could type: B part1.r part2.r part3.r

Doing this once is no problem. However, if these were three parts that made up some complex object, we might like to be able to draw all of them more conveniently. To make drawing a collection of objects together easier, we create an assembly combination to gather them all together. We will create one called dome.c for our three regions. This is accomplished by the following command: comb dome.c u part1.r u part2.r u part3.r

Notice the similarity between this command and the r command we used to create the regions.

Remember from the discussion at the beginning of this lesson, the difference between a region and a combination is that combinations are not necessarily composed of only one kind of material. Several objects of different materials can make up an assembly combination such as the one we have just created.

All that is necessary to draw all three objects is the much simpler command: B dome.c

Now we can raytrace the collected set and get the following image:

In this lesson, you will:

In this lesson, you will create a goblet similar to the one in the following example.

MGED requires a certain logical order to the model data tree so it knows how to raytrace the various elements. In the goblet, the base and basin consist of regions composed of only one primitive shape each. The stem, in contrast, consists of a region composed of the union of three spheres. The three regions were combined to form a complex object.

To view the data tree for this combination, type at the Command Window prompt: tree goblet1.c[Enter]

MGED will respond with:

The name of the overall combination of this design is goblet1.c. It is composed of the three regions: base1.r, stem1.r, and basin1.r. The region base1.r is composed of the primitive shape named base1.s minus ball1.s. The region stem1.r is composed of three primitive shapes named ball1.s, ball2.s, and ball3.s. The region basin1.r is composed of the primitive shape named basin1.s minus the region stem1.r.

Remember that regions define volumes of uniform material. In the real world (and in BRL-CAD), no two objects can occupy the same space. If two regions occupy the same space, they are said to overlap. To avoid having the base and stem overlap, we subtract ball1.s from base1.s when we create base1.r. We also subtract the stem1.r from basin1.s when we create basin1.r. This removes material from one region that would otherwise create an overlap with another. The following figure shows the overlap between ball1.s and base1.s in blue. This is the volume that is removed from base1.r.

In this lesson, you will:

In this lesson, you will add material properties to the goblet you created in the previous lesson. The finished goblet should appear similar to the one in the following example.

Go to the Edit menu and select Combination Editor. To select the various regions of the goblet you made in the last lesson, go back to the Name box and click the button to the right of the entry box. A submenu will appear. Double click on Select From All Regions. A list of regions created for this database will appear, including base1.r, basin1.r, and stem1.r. double click on base1.r to select that region.

Click on the button to the right of Color in the Combination Editor, and a drop-down menu will appear with a list of available colors along with a color tool that will let you create more colors. Click on blue. Next, click the button to the right of the shader box. A list of available shaders will appear. Click on plastic. A new set of options will appear. You will use two of these options in this lesson. Click on Apply to assign the color blue and the plastic shader to the goblet base.

Repeat this process to assign the color green and plastic shader to the stem1.r region and the color yellow and plastic shader to the basin1.r region. When you are finished, select OK to dismiss the Combination Editor box.

Although the changes have been made to the database, the display in the Graphics Window doesn't reflect them yet. So, return the mouse pointer to the Command Window and type at the prompt: B goblet1.c[Enter]

This command clears the screen and redraws the goblet with the color selections applied.

The raytraced goblet looks fairly realistic, but it could be enhanced by using other options of the Combination Editor. When you selected the plastic shader, a new set of options appeared, allowing you to choose various properties or attributes of the shader. Among the options was Transparency. You can adjust this property on individual regions by entering any value between 0.0 (opaque) and 1.0 (transparent).

Just as you applied color and a shader to each of the goblet's three regions, you can adjust the transparency of each region by (1) selecting the region in the Combination Editor, (2) left clicking on the box next to Transparency, and (3) entering any value between 0.0 and 1.0.

For this lesson, open the Combination Editor, click the button to the right of the Name box, choose Select From All Regions in the drop-down menu, and then choose the base1.r region. Make sure plastic is the shader selected and type in .5 to make your region semi-transparent. Click on Apply and repeat this process for each of the other two regions. Then Raytrace the goblet, which should look similar to the following:

The colors of the semi-transparent goblet are brighter than those of the opaque goblet because more light is allowed to penetrate the plastic material. You could make the goblet more realistic in appearance by returning to the Combination Editor and adding a Mirror Reflectance. For each region, place your mouse cursor in the box next to this option, click the left mouse button, and type in .45. This will cause about half of the available light to be reflected off the surface of the goblet.

In this lesson, you will:

Open the goblet.g database using whichever method you prefer. Go to the Edit menu and select Combination Editor. Select basin1.r.

In the last lesson, we assigned values for two shader attributes-transparency and mirror reflectance. In this lesson, we will assign values for still other shader properties. When the plastic shader is selected for region basin1.r, eight attribute entry boxes currently appear in the Combination Editor. These boxes contain either the values that the user has previously set (e.g., those we previously set for transparency and mirror reflectance) or the default values that the raytracer will use if no others are specified. When any of these values is modified, the change can be seen in braces in the shader string box and in the appropriate attribute entry boxes, as indicated by the arrows in the following example:

In this example, the shader entry box indicates that the transparency (tr) is set at .5 and the mirror reflectance (re) is set at .45. The eight abbreviations currently used in the shader entry box are as follows:

tr - transparencysp - specular reflectivityri - refractive indexex - extinction
re - mirror reflectancedi - diffuse reflectivitysh - shininessem - emission

Now that you understand the various attributes of the plastic shader, it is time to experiment with how they affect the final product-the goblet you created in the previous two lessons. You have already assigned values for transparency and mirror reflectance. Now add the attributes of specular reflectivity and diffuse reflectivity to basin1.r. Once you see how these two attributes affect your design, add the refractive index, then shininess and extinction. You might want to capture some of these changes so that you can refer to them later, when you are creating other models using the plastic shader. Remember to click Apply in the Combination Editor to actually incorporate the changes.

As you change the values for the attributes of the plastic shader, you will notice that some changes do not significantly alter the design. This is because there are a variety of ways to produce a particular look on an object. The following are two examples of the goblet with various values of the plastic attributes (which do create a noticeable difference) applied to basin1.r.

By the time you have finished experimenting with changing attributes of the plastic shader, your Combination Editor window might look something like this:

Notice that while the shader string entry box reflects the values set by the user in the attribute entry boxes (e.g., the Transparency of .5), it does not reflect the default values (e.g., the Shininess of 10).

In previous lessons, you combined various shapes into new objects. These new objects have been created using solid building blocks, much like those used in a wooden toy truck. However, in real life, most of the objects that you will design will consist of an outside shell and various inside parts.

In this lesson you will:

Go to Edit and select Combination Editor. In the dialog box, click the button next to the Name entry box. Select globe1.r from Select From All or Select From All Regions. Double click on the globe1.r name. Assign this region a Shader of cloud. Check the Boolean Expression box to make sure the region is made up of u globe1.s. Click on Apply to accept your choices. Go to View and select az35, el25.

Go back to Name and select cube1.r from the Select From All menu. Assign this region a Shader of glass. The glass shader is a shortcut to individually changing the attributes of the plastic shader to make it appear like glass.

Go to the Color option and enter the values 244 255 255. This will give your glass box a light cyan color. Click on Apply to accept your changes.

Before you can raytrace your design, you need to clear the Graphics Window by typing Z at the Command Window prompt because both shapes and regions are being displayed at this point. Next, type in the Command Window: draw cube1.r globe1.r[Enter]

The display box and globe should reappear in the Graphics Window. Go to the File menu and select Raytrace. Next, select the white option for Background Color. Click on Raytrace.

Your design should show a light cyan-colored glass cube with a blue globe inside. To eliminate the wireframing, go to Framebuffer (in the Raytrace Panel) and select Overlay. The display should appear similar to the following illustration:

To make this design more interesting, you can place the globe on a base. Do this by going back to Framebuffer and clicking on Active to deactivate the framebuffer. Next, go to the Create menu and select the trc (truncated right cone) under the Cones and Cylinders category. Name the shape base1.s. Working from a Front view, go to the Edit menu and select Scale. Click the middle mouse button to reduce the trc in size until the bottom of it appears to be an appropriate size for the globe base. (You may need to increase the size of your Graphics Window or decrease your geometry view size to see the bottom of the trc.) Next, reduce the height of the shape by selecting Set H from the Edit menu and clicking with the middle mouse button. You may need to switch back and forth between these two options a few times to get an acceptable size. When finished, however, do not select Accept yet, as we have more changes to make.

As with other features in MGED, moving and rotating objects can be accomplished in several ways, according to the amount of precision desired. As previously described, the Shift Grip functions can be used as a quick way to change an object when its exact angle and location do not necessarily matter. Alternatively, to achieve greater precision, the Translate (move) and Rotate commands under Edit can be selected and specific parameter numbers can be entered in the Command Window. In this lesson, we will experiment with both methods.

With your trc still in edit mode and still in a Front view, use the SHIFT key and the left mouse button to drag your shape (the bottom of the base) and sit it on the floor of the cube (just touching the inside box). Note that you could have selected Translate under Edit and entered parameters on the Command Line to move the trc to an exact location; however, in this case, aligning the shape with the drag-and-drop "eyeballing" method was appropriate. At this point, you may notice that your trc needs to be resized a little to better fit the globe. Use Scale and Set H as needed and then Accept your changes.

Now we need to make a second trc named base2.s, which we will use for the top of the base. On the Command Line, type: cp base1.s base2.s

The second trc will appear directly on top of the first trc, so we will have to use Primitive Selection under the edit menu to put base2.s in edit mode so that we can flip it upside down and then drag it to the top of the first trc.

To do this, we could use the CTRL and ALT (constrained rotation) keys and left mouse button and then move the mouse up or down until the trc is upside down. (If this method is used, note that you can release the mouse button and regrab the object if you need to.) However, because we know we want to rotate the shape an exact amount (180'0) about the x axis, let's use a more precise method to flip the shape. Select Rotate under Edit and then type in the following parameters (abbreviated as p) on the Command Line: p 180 0 0[Enter]

Our shape should have flipped upside down and jumped to the bottom of the first trc. (The two zeros you input indicate no rotation along the y and z axes.) Now use the SHIFT key and the left mouse button to drag base2.s upward and sit it on top of base1.s. The two shapes should form a base in which to hold your globe. Check your alignment using multiple views and then Accept your changes.

Go to Edit and Primitive Selection and select globe1.r/globe1.s. As you did with the trc shapes, use the Shift Grips to drag the globe down until it is in place on the base. Go back to the Edit menu and select Accept. Your design should look as follows:

To make a region of the base, type in the Command Window: r base1.r u base1.s u base2.s[Enter]

In this lesson, you will:

In this lesson, you will be continuing your work creating real-life objects-in this case, the basic body shape of a coffee mug. In the next lesson, you will refine the body so that it is more realistic.

To combine the handle with the outside cylinder, type: comb handle.c u handle.s - bodyout.s[Enter]

combhandle.cuhandle.s-bodyout.s
Make a combinationCall it handle.cCreate a union ofthe handle.s torusand subtractthe bodyout.s cylinder

In this lesson, you will:

In this lesson, you will refine the mug you made in the previous lesson. If you stopped at the end of that lesson, open the database mug.g before continuing.

In this lesson, you will:

In the previous two lessons, you created a mug by entering commands at the Command Window prompt. Now, you will create the same type of mug using the GUI and different shapes.

Begin by opening a new database. Call it mug2.g.

Go to the Create menu and select rcc (right circular cylinder) under the Cones and Cylinders category. Enter the name for the rcc. Call it outside.s.

Go to the Edit menu, where you will be offered the following options:


    Set H
    Set H (Move V)
    Set A
    Set B
    Set c
    Set d
    Set A,B
    Set C,D
    Set A,B,C,D
    Rotate H
    Rotate AxB
    Move End H(rt)
    Move End H
  


    Rotate
    Translate
    Scale
    None of the Above
  


    Reject
    Accept
    Apply
    Reset
  


    Primitive Editor
    Combination
    Editor
  

Select Set H. From a Front view, move your mouse cursor to the lower half of the screen and click the middle mouse button to reduce the scale of the cylinder's height. Next select Set A,B,C,D. Move your mouse cursor to the upper half of the screen and click the middle mouse button to increase the diameter of the cylinder. Accept your changes when your object appears similar to the one shown in the following figure.

Next, create an inside right circular cylinder and name it inside.s. Edit the cylinder the same way you edited the outside cylinder. Before you accept your changes, change View to Top and make sure your cylinders are in alignment. If the cylinders are out of alignment, use the SHIFT key and left mouse button to drag the inside cylinder into position. Return your View to Front and Accept your changes when the cylinders are lined up. Your cylinders should look like those in the following example:

In this lesson, you will:

In previous lessons, you created and edited shapes. You also placed objects in three-dimensional space. This lesson will provide more advanced practice on creating and editing shapes and placing them in 3-D space.

The design you will make in this lesson is a simple candle in a candle holder sitting on a table (as shown in the following figure). In the next lesson, you will add decorations and lighting to make the design more realistic.

Begin by creating a new database called candle.g. Title your database Candle Tutorial.

Create an eto and name it eto1.s. To create the bottom of the candle base, you will need to flip the eto 180'0. Type at the Command Window prompt: rot 0 180 0[Enter] This tells MGED to rotate the shape 180'0 along the y axis. Next, select Scale and make the eto a little smaller than its default size. Place the eto on the tabletop by using the SHIFT key and left mouse button to drag the base into position.

View your design from different angles to make sure the eto sits flush on the center of the tabletop. Select Accept when you are satisfied with its size and placement. Your base should be similar to the one shown as follows:

The next step in creating a candle base is to make a right circular cylinder (rcc). Name the shape rcc1.s.

Go to Edit. In addition to the standard commands, you will be presented with a menu of thirteen shape-specific ways to edit this shape.


Set H
Set H (Move V)
Set A
Set B
Set c
Set d
  


Set A,B
Set C,D
Set A,B,C,D
Rotate H
Rotate AxB
Move End H(rt)
Move End H
  

Scale the shape until it is slightly larger in diameter than the top of the eto1.s (you can check this by switching to a top view). Go back to Edit and select Set H. Reduce the height of the shape until the rcc is about two times the height of eto1.s. Position the cylinder on the candle-holder base. Check the placement of the rcc from the top, left, and front to ensure that it is centered in the eto. Make sure the bottom of the rcc is not quite touching the tabletop. Accept your changes. When done, your design should look like the following:

The last step in making the candle base is to create another eto. Name it eto2.s. Edit this shape as you did the previous eto and place it on top of the rcc, as shown in the following figure. Accept your changes when finished. Your candle base should now look like this:

Make a region of the three shapes of the base. Name it base1.r. Your Boolean expression should read: r base1.r u eto1.s u rcc1.s u eto2.s Note that we could have written it r base1.r u eto1.s u eto2.s u rcc1.s but the first expression is preferred to be consistent with the order of a later example. In a moment, we will want to remove some material that eto2.s gives us. By placing eto2.s last in the list, we can perform this removal easily.

In this lesson, you will:

In previous lessons, we created and edited shapes and placed objects in 3-D space. This lesson provides more advanced practice in these areas using the candle design you created in the last lesson.

Open the candle.g database if it isn't already open and draw candle1.c.

To make more jewels for the base, you could use the copy command on the Command Line (cp sph1.s sph2.s), but another way to do this is to go to the Edit menu and select Primitive Editor. Type sph1.s in the text box to the right of Name. Click on Reset and then change the name to sph2.s and click Apply. Continue doing this until you've made eight jewels. Because each of the new spheres is an exact copy of the first sphere, you won't be able to see them until you select and then move them.

To position your new spheres, go to Primitive Selection. A submenu of shapes you have created will drop down. Use the scrollbar to the right of the list of shapes to access the spheres you have created, as shown in the following illustration.

Click on sph2.s and drag it into position. Once you have positioned the eight spheres around the rcc, your design should look similar to the following ones when viewed from the top and front.

Candle from Top ViewCandle from Front View

Notice from the front view that there appears to only be five spheres around the base of the candle, but there are eight spheres when you view the design from the top. That is because you are viewing 3-D space on a 2-D screen and the spheres in the back are behind the ones in the front. If you change the view to an az35, el25 view, all of the spheres will appear, as shown in the following figure. This is one reason why it is important to continually check your design from multiple views. A mistake in placement that doesn't appear from one view may be very noticeable from another view.

Now that all your spheres are made and in place, it is time to make a region of each sphere. To do this, type the following in the Command Window: r sph1.r u sph1.s[Enter] r sph2.r u sph2.s[Enter] r sph3.r u sph3.s[Enter] r sph4.r u sph4.s[Enter] r sph5.r u sph5.s[Enter] r sph6.r u sph6.s[Enter] r sph7.r u sph7.s[Enter] r sph8.r u sph8.s[Enter]

Next, go to Edit and then Combination Editor. Select sph1.r from the Select From All choice in the pull-down menu to the right of the Name entry box. Assign properties of plastic and the color red and then press Apply. We then can go back to the Select From All menu listing and repeat this process for the other seven spheres. Alternatively, we could use Apply after selecting the appropriate material properties and then type in the next sphere's name; however, this method requires the user to remember to update the Boolean Expression box (e.g., change u sph1.s to u sph2.s) so that the Booleans for one shape are not applied to another shape.

We are now faced with an important decision. At the moment, the jewels overlap a portion of the candle base (specifically, the rcc1.s portion). Because two objects cannot occupy the same space, we must decide how to resolve this situation. There are two choices:

For this lesson, we will use the first choice.

Now we are faced with a second decision: how to achieve this result. The key is that the space the jewels occupy must be subtracted from the correct part (rcc1.s) of the base.

On the Command Line, create rcc1.c by typing: comb rcc1.c u rcc1.s - sph1.r - sph2.r - sph3.r - sph4.r - sph5.r - sph6.r - sph7.r - sph8.r[Enter] Next, bring up the Combination Editor and select base1.r. Change the union of rcc1.s in the Boolean Expression window to a union of rcc1.c, and click OK. The tree of base1.r should now look like:

Now we need to add the jewels to the whole of candle1.c: comb candle1.c u sph1.r u sph2.r u sph3.r u sph4.r u sph5.r u sph6.r u sph7.r u sph8.r[Enter]

There are just a couple of things left to do before you raytrace your design. If you have enabled Multipanes or Draw Grid, go back to the Modes menu and disable them. Then, clear your screen and draw your new design by typing in the Command Window: B candle1.c table1.r Your new design should appear in the Graphics Window. Open the Raytrace Control Panel and select a pale blue color (200 236 242) by typing the three values in the Background Color entry box. When you raytrace your design, it should look similar to the following one:

In this lesson, you will:

In previous lessons, you created and edited shapes to produce simple objects. This lesson focuses on creating a slightly more complex object, a toy truck, from the Command Window. Your completed truck should look similar to the following truck:

Begin by creating a new database called truck.g.

To make the hood of the cab, you will need to make another rpp shape, this time using the inside command. This special command was originally created to hollow out objects such as gas tanks and boxes; however, it can be used to create any new shape that has some relationship to a pre-existing shape. In this lesson, it is used to cut away material above the hood and in front of the cab.

If you are using BRL-CAD version 6.0 or later, at the Command Window prompt, type: inside cab1.s caboff1.s -.1 .7 -.1 -.1 .5 -.1[Enter] The inside command tells MGED to:

insidecab1.scaboff1.s-.1.7-.1-.1.5-.1
Inside the shapenamed cab1.s,create rpp called caboff1.sMake face 1234 (front) -.1 units thickMake face 5678 (rear) .7 units thickMake face 1485 (right) -.1 units thickMake face 2376 (left) -.1 units thickMake face 1265 (bottom) .5 units thickMake face 3487 (top) -.1 units thick

When in Multipane mode, the design should resemble the following illustration.

In previous lessons, you applied color and a shader to an object to make it appear realistic. Sometimes, however, you will need to apply two or three shaders to an object to get the design you want.

MGED offers three categories of shaders: paint, plastic, and light. Any combination of these three types of shaders can be applied to the same object using the stacker option of the shader menu.

There are three plastic shaders: glass, mirror, and plastic. A plastic shader is used to give the perception of space. It does this by making the object's surface shiny so that it reflects light. A plastic shader is normally applied last in the stacker process.

The paint shaders are used to apply pigment and texture to the surface of an object. Color is pigment, and texture is the three-dimensional quality of the surface material (such as stucco paint).

Pigment shaders include camo, texture (color), texture (black/white), fake star, cloud, checker, test map, and projection. Texture shaders include bump map, fbm bump, and tur bump. Paint shaders are normally applied first in the stacking process and are used in combination with the plastic shader.

The light shader is used to produce illumination in the scene. This helps produce realism in the final image. The light shader is technically complex and is not discussed in this tutorial.

The camo shader involves applying pigments, in a random pattern, to the surface of an object. The camo shader doesn't indicate the three-dimensional nature of an object. If you want your design to show depth, you will need to stack the camo shader and the plastic shader.

In this lesson, you will be:

In Lesson 2, we made the basic shapes of a walkie-talkie radio to gain experience in viewing objects. Now that we have successfully modeled a few simple objects, let's return to the radio to make it more realistic and, in so doing, discuss logical techniques and structures in modeling. When finished, our radio should look as follows:

If we think about it, the body of a radio is actually a hollow case. So, the first thing we need to do is hollow out the case's interior to make room for internal components. To do this, we can use the inside command to create a shape, which we'll call cavity.s: inside body.s cavity.s 1 1 1 1 1 1[Enter] Now, we'll make a region called case.r and define it as what's left of body.s after cavity.s has been subtracted out. The command should look like this: r case.r u body.s - cavity.s[Enter]

With our case now made, we can proceed to cut several holes through this structure to accommodate the antenna, the volume control knob, and the talk button. To do this, we must subtract the three shapes from the case as follows: r case.r - ant.s - knob.s - btn.s[Enter] Finally, we need to "glue" the lip around the speaker to the case's front face by typing r case.r u spkr.s[Enter]

Our body is now finished. Note that an experienced modeler would probably have combined the preceding three Boolean functions into a single command as follows: r case.r u body.s - cavity.s - ant.s - knob.s - btn.s u spkr.s[Enter] If we were to raytrace case.r at this point, we would see the following:

Note the hole for the antenna in the top of the case and the hole for the talk button on the side of the case. We will now fill these holes with their respective components.

Now, what would happen to the circuit board if we were to raytrace the radio at this point? It would disappear because it lies within the case. So how can we make the circuit board visible outside of the case?

There are two common ways to do this: a transparent view and a cutaway view. Each method has its advantages and disadvantages. With the transparent view, the Boolean operations remain unchanged, but some of the material properties of the "outside shell" are altered to better view interior parts of the model. With the cutaway view, the material properties remain unchanged, but some of the Boolean operations are altered to remove parts of the model that are obstructing our view of other parts. We will try both ways to view the inside of our radio.

Different Approaches to Creating Specialty Models

An important point to note here is that the transparent and cutaway views are specialty models. They are similar in nature to items a manufacturer might make for special purposes. For example, an automobile manufacturer makes cars for everyday use, but also makes modified versions for display at certain events. The body panels might be replaced with a transparent material or be partially cut away to reveal interior components.

Good modeling practice follows the same pattern. The actual model of an item should not have to be changed in order to create a specialty view of it. Instead, a modified version of the item should be created. Thus, the modeler will not have to worry about remembering to return the model to the original condition after its special-purpose use, and the modeler can also retain the "display model" for future use.

There are two common approaches to making these specialty models: First, the modeler can copy the original and replace components with modified versions. Second, the modeler can create new, unique parts from scratch and construct the modified item. The method chosen is a matter of personal choice and is usually determined by the extent of the modifications being done and the complexity of the original object.

Making a specialty radio with a transparent case would probably be the easiest way to view the circuit board inside. All we have to do is make a copy of our present radio case and modify its material properties. We'll call the specialty case case_clear.r. Type cp case.r case_clear.r[Enter] We can now use the Combination Editor to set the material properties on this case without affecting the "master" design of the radio. When this has been done, we can combine this modified case with the other unchanged radio components and group them as a new specialty radio named radio_clear.c.

To set the material properties of case_clear.r, choose plastic from the drop-down menu to the right of the Shader entry box in the Combination Editor. (Although this is the shader that is used by default, we want to explicitly select it in order to change one of its values.) Now change the Transparency of the case to a value of .8. Apply the change and close the Combination Editor.

Finally, create the specialty radio combination by typing: g radio_clear.c case_clear.r button.r knob.r ant.r board.r[Enter] and then Blast the display with B radio_clear.c[Enter]

Now raytrace your design to view the resulting effect. The new transparent case should appear similar to the following:

As shown in the following tree diagram, the structure of this specialty radio_clear.c is not much different than that of the regular radio.c. The only difference is that case.c has been replaced with case_clear.c.

Another way we can make the interior components of the radio visible is to create a cutaway view. Although it is a little more complex to make than the transparent view was, the cutaway view offers a particularly interesting way to view geometry.

There are several ways to make the cutaway view. Probably the easiest way is to use the "chainsaw" method to cut off part of the radio and reveal what is inside.

To do this, create an arb8 called cutaway.s, which will be used to cut off the front corner of the radio. Because this is a cutting shape (i.e., it is simply used to erase a portion of another shape and will not actually be viewed), the dimensions of the arb8 are not critical. The only concern is that cutaway.s be as tall as the case so that it completely removes a corner from it.

Use the Shift Grips and multiple views (especially the Top view) to align cutaway.s so that it angles diagonally across the top of the radio (as shown in the following wireframe representation). When you've aligned the shape the way you want it, create the following radio_cutaway.c combination that unions in radio.c and subtracts out the shape (cutaway.s) that is covering what you want to see (board.r): comb radio_cutaway.c u radio.c - cutaway.s[Enter]

Blast the radio_cutaway.c combination onto the display and raytrace. Depending on how your arb8 intersected the radio, the cutaway should look similar to the following:

Notice in the preceding figures that cutaway.s removes everything it overlaps (including part of the circuit board). This is okay if we just want to see inside the case. However, if we want to see all of the circuit board and any other component overlapped by cutaway.s (e.g., button.r), we would have to adjust our Boolean operations a little so that the cutaway is subtracted only from our case.

To do this, we basically have two options: (1) we could move cutaway.s in the structure so that it is subtracted from only case.r, or (2) we could move cutaway.s in the structure so that it is subtracted from both body.s and spkr.s, the two components that make up case.r. While both of these options would produce the same effect, the first method requires just one subtraction, whereas the second method potentially provides more control by having the user select the individual components that will subtract out the cutting shape.

Take a minute and compare the following trees for the cutaways we have discussed so far. Especially note the position of cutaway.s in the different structures. Also, note that when cutaway.s was subtracted from a particular region or combination, the name of that region or combination was changed. The reasoning behind this goes back to our original discussion of specialty models. Remember that our purpose is to create a new special-purpose model, not change the existing model. So, we must change the name of any region or combination that contains any modified components or structures. If we don't, the master model will also be changed.

As shapes are added in a design, the modeler often finds that the structure or association of components needs to change. Thus, we should pause at this point and consider how our radio is structured. While there are many ways to structure a model, two common modeling categories are location and functionality. For our radio, we have so far grouped everything together under the general category of Radio, as shown in the following:

If we wanted to categorize our components according to location, however, we might structure the model as follows:

If we wanted to define our components according to functionality, we might structure the model another way. For instance, to repair an actual radio, we would open the case, take out the circuit board, fix it, and put it back in. When taking out the board, however, the knob and button would probably be attached to it in some way, and so they too would need to come out. Accordingly, our structure should be changed as shown in the following diagram to associate the knob and button with the circuit board.

To accomplish this restructuring according to functionality, create an assembly called electronics.c to hold these components together. Type: g electronics.c board.r knob.r button.r[Enter] Of course, we now need to remove board.r, knob.r, and button.r from the radio.c assembly so that when electronics.c is added to the radio.c assembly, we won't have the knob and button included twice in the model. To do this, use the rm (remove) command: rm radio.c board.r knob.r button.r[Enter] and then union in the electronics assembly: g radio.c electronics.c[Enter]

Now the tree for radio.c should appear as follows:

Now let's remake our cutaway view. This time, let's do what we discussed earlier and make the cutaway remove material from only the case, showing all the other components.

First, we need to get rid of the old radio_cutaway.c, which was based on our previous structure. To do this, type kill radio_cutaway.c[Enter] and then remake the combination by typing comb radio_cutaway.c u case.r - cutaway.s u electronics.c u ant.r[Enter] Now when we Blast the display and raytrace radio_cutaway.c, we should see the following:

Appendix