Booleans and Mechanical Desktop1 Jun, 2000 By: John E. Wilson
Figure 1. Non-parametric solid modelers, such as the one that is part of AutoCAD, typically construct complex solid models by using Boolean operations to combine components having basic geometric shapes.
|Table 1. The Three Different Types of Boolean Operations|
|This operation combines two or more 3D solids into one solid. The volume common to the solids is absorbed into the combined solid. Some solid modelers call this operation Join.|
|This Boolean operation subtracts the volume of one set of solids from the volume of a second set of solids. The volume of the subtracted set that is not within the base set is deleted. Some programs use the word Cut for this operation, and others call it Difference.|
|This operation creates a solid from the volume shared by a set of solids. The volume that is not common is deleted.|
Although Mechanical Desktop's way of implementing Booleans has a couple of disadvantages-you can only operate on two solids at a time, and you must imagine what one of them looks like-most people do not have any trouble adapting to it. Also, in some circumstances Mechanical Desktop's Boolean operations work a little differently than those of other solid modelers. In AutoCAD, for instance, when you subtract solid A from solid B and no common volume exists between them, solid A is deleted. In Mechanical Desktop, on the other hand, solid A remains even though you can't see it, and if you should move or create a solid within this space, the subtract operation will take effect.
Combining Mechanical Desktop Parts
Mechanical Desktop does, however, have provisions for creating parts individually and combining them with Boolean operations similar to the methods of non-parametric solid modelers. You can even completely bypass Mechanical Desktop's normal feature-by-feature approach by building a 3D model entirely by combining parts. For example, you can create all of the components shown on the left in Figure 1 as separate parts, and then combine them with Boolean operations to create the part shown on the right. Most of the time, though, you will
Figure 2. The large part in this figure models the front of a pump. The outlet of the pump, which is on the upper-left side of the part, is deliberately left unfinished so that either the flanged or the threaded part located above the base part can be used for the outlet.
The Mechanical Desktop command that combines parts is AM COMBINE. (Since Mechanical Desktop has about five ways to initiate most commands, I'll use just command names in this column, rather than list the toolbar buttons or menu options you'll probably really use, because that is the most basic way to start an operation.) Two key restrictions of this command are that only parts, not features, can be combined, and only two parts can be combined during one call to AMCOMBINE. The current active part is called the base part. The other part is referred to as the toolbody. The steps to combine two parts are:
- Move the parts into a position relative to each other that will achieve the results you want (You take this same step in non-parametric solid modelers to setup a Boolean operation.) Often you will use Mechanical Desktop's assembly constraints, which are sometimes referred to as 3D constraints, to do this. See the Third Dimension column in the December 1998 issue of CADENCE ("Putting the Pieces Together with Mechanical Desktop," pp. 86-89) for information about assembly constraints.
- If necessary, use the AMACTIVATE command to establish which part is to be the base part for the combine operation. In Mechanical Desktop's assembly environment any part can be the base part. In the single-part environment, though, only the part that was first created in the file can be the base part, and it must be the active part.
- Invoke AMCOMBINE. Choose Cut, Intersect or Join as the Boolean operation from the command-line prompt that the AMCOMBINE command issues.
- Select the toolbody that you want to interact with the base part. For Cut operations, the toolbody is subtracted from the base part.
You can combine toolbodies to create a nested toolbody. Also, you can make a mirror image of a part with the AMMIRROR command and then combine the two parts. This is a convenient way to create parts that have symmetrical geometry. And, you can create an array from a toolbody that has been combined, even if the toolbody is nested, with the AMARRAY command.
A variety of options for creating a toolbody that is to be combined with the base part are available to you. One is to select the Part option of the AMNEW command. Then, you will start from scratch in constructing a part, just as if you had opened a new drawing file. If you are working in the single-part environment, the new part will be called a toolbody. When you have finished constructing the new part, it is ready to be combined with the original part.
In addition to constructing a toolbody in the current drawing file, you can import a part from another file for use as a toolbody. If the current file is in Mechanical Desktop's single-part environment, the file of any part you import must also be in the single-part environment. One way to import a toolbody from another file is with the AMCOPYIN command (this command was named AMPARTIN prior to Mechanical Desktop Release 4). This command displays a file-list type dialog box for you to use in locating the file of the part you want to import. The part in that file is inserted in the current file without additional prompts, and you can proceed to combine it with a part in the current file.
You can also import a part from an external file with AutoCAD's INSERT command. Although the imported part will be listed as an AutoCAD block, you do not have to explode it before combining it with another part. AutoCAD Xrefs, on the other hand, are not recognized by Mechanical Desktop as either a part or a toolbody and cannot be combined with a part.
Even if Xrefs worked, though, you probably would not use them for combining parts since Mechanical Desktop's AMCATALOG command is more a power tool for working with external files. Like AutoCAD's XREF command, AMCATALOG allows you to insert a part from an external file into the current file, and that inserted part will change as the external file is changed. Unlike XREF, though, you can modify the inserted part, and you can choose to have that modification made in the external file as well.
Figure 3. You can import parts from external files for use as toolbodies through Mechanical Desktop's AMCATALOG command. You will use the Directories and the Part Definitions panes of the dialog box the command displays to locate the file containing the part you want and to attach that part to the current file.
The steps to import a part from an external file for use as a toolbody are:
- Invoke AMCATALOG. If you are in the single-part environ ment, a part must already exist.
- Select the External tab of the Part (or Assembly) Catalog box.
- Right-click within the Dir- ectories pane to display its menu. Select Add Directory from this menu and browse to locate the directory that con- tains the file you want to import.
- The files in the directory you select will appear in the Part Definition pane. If you are working within the single-part environment, only files in the single-part environment will be displayed.
- Locate the file you wish to import. When you click a file name, an image of its contents will appear in the Preview pane. Once you have located the file, either double click on its name, or right-click its name and select Attach from the resulting menu.
Editing Combined Parts
Parts that have been combined do not lose their internal parametrics. However, there are no true parametric relationships between parts because you can't add dimensions between two separate parts. The best you can do to establish editable spatial relationships between parts is to use assembly, or 3D, constraints. For example, to position a box-shaped part in the middle of a larger box-shaped part, you could use the AMMATE command to constrain a face on one part with a face on the second part and then specify a distance, or offset, between the two faces. You would have to do this three times to completely establish the precise relative location between the two parts. You can edit 3D constraints by invoking the AMEDITCONST command.
You can't edit the results of the AMCOMBINE command. For instance, you can't change a cut combine operation to a join operation. You can, though, edit parts that have been combined and edit the features of those parts.
To edit a specific feature in a part that has been combined, whether the part is the base or the toolbody, invoke AMEDITFEAT and select the feature. The dialog box used in creating the 3D feature will reappear, and you can change the parameters within that dialog box, just as if the feature was in a part that had not been combined. As with other modifications to features, you must invoke AMUPDATE before the changes take effect.
If you want to edit the profile sketch of a feature, choose the Sketch option of AMEDITFEAT, and then select the feature you want to modify. The selected feature along with all features created after it will disappear and the profile of the selected feature will appear for you to modify as you want. Update the part to initiate the changes and restore the features.
You probably remember that Mechanical Desktop gives a name that consists of a lowercase d followed by a consecutively assigned number to every dimension in a part (some example names are d3 and d115). These names are a powerful parametric tool because you can use them in an equation to establish another dimension. Since two parts are likely to have some dimension names that are the same, you may wonder how dimension names are handled in combined parts. It's simple. Even though the two parts are combined to form one part, the parameter space of the two parts remains independent of each other. Thus, if one part has an equation-based dimension that is d8=d7*2, Mechanical Desktop knows which of the combined parts the d7 dimension belongs to.
When you select the Toolbody option of AMEDITFEAT, Mechanical Desktop will prompt you to select the toolbody from a pair of parts that have been combined. The combined parts will then be restored to their condition before they were combined, and the toolbody will become the active part. Mechanical Desktop refers to this condition as the rollback state. In this state, you can freely edit the toolbody by invoking AMEDITFEAT again. You can also add features to the toolbody, and you can add or modify the 3D constraints between the toolbody and the base part. If you edit features of the toolbody part, you must either use the Part option of AMUPDATE to update the part and repeat AMUPDATE to update the combination, or use the Full option of AMDATE to perform both updates simultaneously.
You can edit an external part by invoking the AMACTIVATE command in the rollback state. Mechanical Desktop will issue a message asking you to confirm the command, the part will be activated and you can use AMEDITFEAT to modify it. After you have modified the part, you must update the part, and then you must update the combination (Mechanical Desktop's prompts refer to the combined parts as an assembly, even though they are not). When you update the combined parts, you can choose whether or not to change the part in the external file as well as in the open file.
In her easy-to-follow, friendly style, long-time Cadalyst contributing editor and Autodesk Technical Evangelist Lynn Allen guides you through a new feature or time-saving trick in every episode of her popular AutoCAD video tips. Subscribe to the free Cadalyst Video Picks newsletter and we'll notify you every time a new video tip is published. All exclusively from Cadalyst!