- •Contents
- •Contents at a Glance
- •Acknowledgments
- •Preface
- •Is This Book for You?
- •How This Book Is Organized
- •How to Use This Book
- •Doing the Exercises
- •Conventions Used in This Book
- •What the Icons Mean
- •About the CD-ROM
- •Other Information
- •Contacting the Author
- •Foreword
- •Credits
- •About the Author
- •Summary
- •AutoCAD’s Advantages
- •Comparing AutoCAD and AutoCAD LT
- •Starting AutoCAD and AutoCAD LT
- •Creating a New Drawing
- •Using the AutoCAD and AutoCAD LT Interface
- •Creating a New Folder
- •Using the Interface
- •Saving a Drawing
- •Closing a Drawing and Exiting from AutoCAD and AutoCAD LT
- •Summary
- •Creating a New Drawing from a Template
- •Working with Templates
- •Opening a Drawing with Default Settings
- •Opening an Existing Drawing
- •Using an Existing Drawing as a Prototype
- •Saving a Drawing Under a New Name
- •Summary
- •The Command Line and Dynamic Input
- •Command Techniques
- •Of Mice and Pucks
- •Getting Help
- •Summary
- •Typing Coordinates
- •Displaying Coordinates
- •Picking Coordinates on the Screen
- •Overriding Coordinate Settings
- •Locating Points
- •Summary
- •Choosing Unit Types
- •Drawing Limits
- •Understanding Scales
- •Creating a Title Block
- •Specifying Common Setup Options
- •Customizing with the MVSETUP Command
- •Using the Setup Wizards
- •Summary
- •Using the LINE Command
- •Drawing Rectangles
- •Drawing Polygons
- •Creating Construction Lines
- •Creating Rays
- •Summary
- •Drawing Circles
- •Drawing Arcs
- •Creating Ellipses and Elliptical Arcs
- •Making Donuts
- •Placing Points
- •Summary
- •Panning
- •Using the ZOOM Command
- •Using Aerial View
- •Saving Named Views
- •Working with Tiled Viewports
- •Using Snap Rotation
- •Understanding User Coordinate Systems
- •Creating Isometric Drawings
- •Summary
- •Editing a Drawing
- •Selecting Objects
- •Summary
- •Copying and Moving Objects
- •Resizing Commands
- •Using Construction Commands
- •Creating a Revision Cloud
- •Hiding Objects with a Wipeout
- •Double-Clicking to Edit Objects
- •Grips
- •Editing with the Properties Palette
- •Selection Filters
- •Groups
- •Summary
- •Working with Layers
- •Changing Object Color, Linetype, and Lineweight
- •Working with Linetype Scales
- •Importing Layers and Linetypes from Other Drawings
- •Matching Properties
- •Summary
- •Drawing-Level Information
- •Object-Level Information
- •Measurement Commands
- •AutoCAD’s Calculator
- •Summary
- •Creating Single-Line Text
- •Understanding Text Styles
- •Creating Multiline Text
- •Creating Tables
- •Inserting Fields
- •Managing Text
- •Finding Text in Your Drawing
- •Checking Your Spelling
- •Customizing the spelling dictionary
- •Summary
- •Working with Dimensions
- •Drawing Linear Dimensions
- •Drawing Aligned Dimensions
- •Creating Baseline and Continued Dimensions
- •Dimensioning Arcs and Circles
- •Dimensioning Angles
- •Creating Ordinate Dimensions
- •Drawing Leaders
- •Using Quick Dimension
- •Editing Dimensions
- •Summary
- •Understanding Dimension Styles
- •Defining a New Dimension Style
- •Changing Dimension Styles
- •Creating Geometric Tolerances
- •Summary
- •Creating and Editing Polylines
- •Drawing and Editing Splines
- •Creating Regions
- •Creating Boundaries
- •Creating Hatches
- •Creating and Editing Multilines
- •Creating Dlines
- •Using the SKETCH Command
- •Digitizing Drawings with the TABLET Command
- •Summary
- •Preparing a Drawing for Plotting or Printing
- •Creating a Layout in Paper Space
- •Working with Plot Styles
- •Plotting a Drawing
- •Summary
- •Combining Objects into Blocks
- •Inserting Blocks and Files into Drawings
- •Managing Blocks
- •Creating and Using Dynamic Blocks
- •Using Windows Features
- •Working with Attributes
- •Summary
- •Understanding External References
- •Editing an Xref within Your Drawing
- •Controlling Xref Display
- •Managing Xrefs
- •Summary
- •Preparing for Database Connectivity
- •Connecting to Your Database
- •Linking Data to Drawing Objects
- •Creating Labels
- •Querying with the Query Editor
- •Working with Query Files
- •Summary
- •Working with 3D Coordinates
- •Using Elevation and Thickness
- •Working with the User Coordinate System
- •Summary
- •Working with the Standard Viewpoints
- •Using DDVPOINT
- •Working with the Tripod and Compass
- •Displaying a Quick Plan View
- •Shading Your Drawing
- •Using 3D Orbit
- •Using Tiled Viewports
- •Defining a Perspective View
- •Laying Out 3D Drawings
- •Summary
- •Drawing Surfaces with 3DFACE
- •Drawing Surfaces with PFACE
- •Creating Polygon Meshes with 3DMESH
- •Drawing Standard 3D Shapes
- •Drawing a Revolved Surface
- •Drawing an Extruded Surface
- •Drawing Ruled Surfaces
- •Drawing Edge Surfaces
- •Summary
- •Drawing Standard Shapes
- •Creating Extruded Solids
- •Drawing Revolved Solids
- •Creating Complex Solids
- •Sectioning and Slicing Solids
- •Using Editing Commands in 3D
- •Editing Solids
- •Listing Solid Properties
- •Summary
- •Understanding Rendering
- •Creating Lights
- •Creating Scenes
- •Working with Materials
- •Using Backgrounds
- •Doing the Final Render
- •Summary
- •Accessing Drawing Components with the DesignCenter
- •Accessing Drawing Content with Tool Palettes
- •Setting Standards for Drawings
- •Organizing Your Drawings
- •Working with Sheet Sets
- •Maintaining Security
- •Keeping Track of Referenced Files
- •Handling Errors and Crashes
- •Managing Drawings from Prior Releases
- •Summary
- •Importing and Exporting Other File Formats
- •Working with Raster Images
- •Pasting, Linking, and Embedding Objects
- •Summary
- •Sending Drawings
- •Opening Drawings from the Web
- •Creating Object Hyperlinks
- •Publishing Drawings
- •Summary
- •Working with Customizable Files
- •Creating Keyboard Shortcuts for Commands
- •Customizing Toolbars
- •Customizing Tool Palettes
- •Summary
- •Creating Macros with Script Files
- •Creating Slide Shows
- •Creating Slide Libraries
- •Summary
- •Creating Linetypes
- •Creating Hatch Patterns
- •Summary
- •Creating Shapes
- •Creating Fonts
- •Summary
- •Working with the Customization File
- •Customizing a Menu
- •Summary
- •Introducing Visual LISP
- •Getting Help in Visual LISP
- •Working with AutoLISP Expressions
- •Using AutoLISP on the Command Line
- •Creating AutoLISP Files
- •Summary
- •Creating Variables
- •Working with AutoCAD Commands
- •Working with Lists
- •Setting Conditions
- •Managing Drawing Objects
- •Getting Input from the User
- •Putting on the Finishing Touches
- •Summary
- •Understanding Local and Global Variables
- •Working with Visual LISP ActiveX Functions
- •Debugging Code
- •Summary
- •Starting to Work with VBA
- •Writing VBA Code
- •Getting User Input
- •Creating Dialog Boxes
- •Modifying Objects
- •Debugging and Trapping Errors
- •Moving to Advanced Programming
- •Summary
- •A Final Word
- •Installing AutoCAD and AutoCAD LT
- •Configuring and Using Workspaces
- •Configuring AutoCAD
- •Starting AutoCAD Your Way
- •Configuring a Plotter
- •Discovering AutoCAD and AutoCAD LT
- •Accessing Technical Support
- •Autodesk User Groups
- •Internet Resources
- •System Requirements
- •Using the CD-ROM with Microsoft Windows
- •What’s on the CD-ROM
- •Troubleshooting
- •Index
Chapter 18 Working with Blocks and Attributes |
543 |
Cross- |
For information on installing Express Tools, see Appendix A. For information on shape defini- |
Reference |
tions, see Chapter 32. |
|
Usually when you insert a file into a drawing, the block name and file name are the same. Likewise, when you WBLOCK a block, you usually name the file with the name of the block. Be aware that when you use block substitution, you have a block in your drawing that is the same as a file of a different name. For example, if you have a block in your drawing called smalldesk and substitute a file called bigdesk, you now have a block called smalldesk that is actually the same as the file bigdesk. This can become confusing, so use block substitution with care.
On the
CD-ROM
Wb.exe unzips to three programs that create a list of blocks in your drawing, and writes them to separate drawing files. Display the list of blocks and open selected drawings from the list; after you modify them, update those drawings as blocks in your current drawing. WBLOCKM also write blocks all of the blocks in your drawing to a folder that you specify. Look in \Software\Chap18\Wb. These programs work with AutoCAD only. MPE-arch is a library of mechanical, plumbing, and electrical symbols for architectural drawings, mostly lights and outlets. Mpe.dwg contains all of the symbols and can be used as a legend. Look in \Software\ Chap18\Mpe-arch. North is a collection of North symbols for architectural drawings. Look in
\Software\Chap18\North.
Creating and Using Dynamic Blocks
New
Feature
You probably have multiple similar blocks that you store and use on a regular basis. Moreover, you might insert these blocks at various scales and rotation angles. For example, you could have several sizes of doors that you insert at various angles, sometimes right-opening and sometimes left-opening. Dynamic blocks are blocks that contain intelligence and flexibility so that you can insert them in many variations. Potentially, you could significantly reduce the number of blocks in your block library.
Dynamic Blocks are new for AutoCAD 2006. AutoCAD LT 2006 doesn’t include the ability to create (author) dynamic blocks, but it can insert and display them.
Dynamic blocks include instructions that specify the types and amounts of variations for each block. You create (author) dynamic blocks in the new Block Editor. For a block to be dynamic, it must include at least one parameter. Each parameter usually has an associated action.
Parameters define the special properties of the dynamic block, including locations, distances, and angles. Parameters can also constrain the values within which the parameter can function. An action specifies how a block uses its associated parameter to change in some way.
For example, you may want to move one component of a block independently of the block, such as the chair in a block containing a desk and a chair. To accomplish this, you add a point parameter that specifies a point on the chair. You then add a move action that allows you to move the chair from that point. Figure 18-14 shows a desk and a chair block that includes the following dynamic components:
The desk has a distance parameter with a stretch action. Therefore, you can stretch the desk without affecting the chair. You would use this type of action if you have several sizes of desks that you need to include in your drawing.
544 Part III Working with Data
The chair contains a point parameter with a move action. As a result, you can move the chair independently of the rest of the block. If you stretch the desk, you might want to move the chair so that it remains centered in front of the desk, or you might simply want to move the chair further away from the desk.
Stretch action grip |
This desk is being stretched |
Move action grip |
The chair has been moved away from the desk |
Figure 18-14: This dynamic block contains components that enable you to stretch the desk’s length and move the chair.
If you open a dynamic block in a prior release of AutoCAD or in AutoCAD LT, you see the last current view of the block. You cannot use the dynamic features of the block, but you can edit it as a regular block. The block is assigned a name, such as U2.
To change the background color of the Block Editor, choose Tools Options and click the Display tab. Click the Colors button. From the Window Element drop-down list, choose Block Editor Background. Then choose a color from the Color drop-down list. Click Apply & Close, and then click OK.
Understanding the work flow of dynamic blocks
Because defining a dynamic block takes some time — although simpler dynamic blocks are not very time-consuming to set up — the most common use for dynamic blocks is to create a block library. Normally, you define your dynamic blocks and save them for future use in your drawings. In other words, unless you need to insert a new block many times in several variations in a drawing, you won’t create dynamic blocks for the current drawing on which you’re working.
A block library can have two configurations:
One block per drawing: You save each block in its own drawing. Use the BASE command to specify the origin of the drawing, which is usually on an object snap somewhere on the block. (I explain the BASE command in the “Saving blocks as files” section earlier in this chapter.) You use the INSERT command to insert the drawing, thereby inserting its block.
Many blocks per drawing: You put a number of (usually) related blocks in a drawing. To insert the block, you use the DesignCenter to locate the drawing and find the individual block that you want. (See the section “Using the DesignCenter” earlier in the chapter for information on inserting blocks with the DesignCenter.)
Chapter 18 Working with Blocks and Attributes |
545 |
The first part of the process of creating dynamic blocks is to define the block. I explain the details in the next few sections, but here I provide an overview of the workflow:
1.In your block library drawing or in a new drawing, create the block.
2.Open the new Block Editor (the BEDIT command) and choose the block.
3.Add parameters and associated actions.
4.Save the block definition in the Block Editor.
5.Close the Block Editor.
6.If the drawing will contain just this block, use the BASE command to set the drawing origin where you want the insertion point to be, usually somewhere on the block.
7.Save the drawing.
You may want to follow this process for any number of blocks. When your blocks are defined, you do the following to insert your dynamic blocks.
1.In your current drawing, either use the INSERT command to insert the drawing containing the block, or use the DesignCenter to choose the block from within the drawing.
2.Select the block to see its special grips. These grips show you where you can modify the block.
3.Usually, you click and drag a grip. Some dynamic block parameters involve choosing a visibility or lookup option.
Defining a dynamic block
To define a dynamic block, first create the objects that you want for the block, or explode an existing block down to its component objects. Then choose Block Editor from the
Standard toolbar, or choose Tools Block Editor to start the BEDIT command. In the Edit Block Definition dialog box, choose <Current Drawing> and click OK.
You may see a message that asks whether you want to see how dynamic blocks are created. Click Yes to open the New Features Workshop, which contains an animated tutorial on dynamic blocks. (You can access the New Features Workshop at any time from the Help menu.) Otherwise, click No. The Block Editor opens, as shown in Figure 18-15. At the same time, the Block Authoring palette opens.
Note |
If blocks already exist in the drawing, they appear in the Edit Block Definition dialog box, and |
|
you can choose a block to edit it. |
Before you start defining your block, you need to decide the types of variations that you want the block to have. You build flexibility into your blocks with a combination of parameters and actions. Table 18-2 lists the parameters, the actions that you can add to each parameter, and a description of the possible uses for those parameters and actions on the specified component of the dynamic block.
546 Part III Working with Data
Block Authoring palette |
Block Editor toolbar |
Figure 18-15: The Block Editor is a special window for authoring dynamic blocks.
Table 18-2: Dynamic Block Parameters and Actions
Parameter |
Available Actions |
Uses |
|
|
|
Point |
Move, Stretch |
Move or stretch from that point (X,Y coordinate). |
Linear |
Move, Scale, |
Move, scale, stretch, or array along the line between two points. |
|
Stretch, Array |
|
Polar |
Move, Scale, Stretch, |
Move, scale, stretch, stretch at an angle, or array along the line |
|
Polar Stretch, Array |
between two points and at the specified angle. |
XY |
Move, Scale, |
Move, scale, stretch, or array at the specified X and Y distance. |
|
Stretch, Array |
|
Rotation |
Rotate |
Rotate at the specified angle. |
Flip |
Flip |
Flip along a reflection line. Flipping is like mirroring. |
Alignment |
None |
Align the entire block with other objects. You can align perpen- |
|
|
dicular or tangent to other objects. No action is required. |
Visibility |
None |
Control the visibility of components in the block. No action is |
|
|
required. See the section “Adding visibility parameters” later in this |
|
|
chapter. |
Chapter 18 Working with Blocks and Attributes |
547 |
Parameter |
Available Actions |
Uses |
|
|
|
Lookup |
Lookup |
Choose a custom property from a list or table that you define. See |
|
|
the section “Adding lookup actions” later in this chapter. |
Base point |
None |
Define a base point for the dynamic block. |
|
|
|
Adding a parameter
To create a dynamic block, you start by adding a parameter. Click the parameter that you want from the Parameters tab of the Block Authoring palette. Each parameter prompts you for the information it needs. For example, the linear parameter responds with the Specify start point or [Name/Label/Chain/Description/Base/Palette/Value set]: prompt. When you specify the start point, you get a prompt for the endpoint. The flip parameter prompts you for a reflection line, which is like a mirror line.
The options for each parameter are fairly similar. Here’s how to use the options:
Name: You can change the name of the parameter. The name appears in the Properties palette when you select the parameter. However, you may find it confusing to change the name, because the name clearly denotes which parameter the block uses. On the other hand, if you have more than one of the same type of action, such as two stretch actions, renaming the actions to identify what they apply to can eliminate confusion. For example, you could have two Move actions, “Move table” and “Move chair.”
Label: The label appears in the Properties palette, but also next to the block when you have the Block Editor open. Change the label to suit your needs. For example, the linear parameter uses a label of “Distance.” You might want to change that to Length, Width, or even something more specific.
Chain: Sometimes, you might want one action to cause more than one change in a block. To do this, you can chain parameters. Then, activating one parameter’s actions causes a secondary parameter’s action to occur. The primary parameter must have an action whose selection set includes the secondary parameter in addition to any other objects it will act on. (If the action is a stretch action, the stretch frame also needs to include the secondary parameter.) Then set the secondary parameter’s chaining property to Yes.
Description: You can add a description to a parameter. This description displays in the Properties palette when you select the parameter in the Block Editor.
Base: Creates a base point parameter, which sets a base point for the block.
Palette: By default, displays parameter labels in the Properties palette when you select the block reference in a drawing. Change to No if you don’t want to display the labels.
Value set: You can constrain the available values for your block’s size, either as increments (for example, from 3 feet to 7 feet in 6-inch increments) or by providing a list (for example, only 36", 40", and 42"). This option prompts you to choose either the increment or the list method, and then prompts you for values.
When you are finished using the options or have specified the necessary coordinates (such as a start point and endpoint for a linear parameter), the Specify label location: prompt appears. Pick a point to place the label for the parameter.
548 Part III Working with Data
An exclamation point now appears next to the parameter. This exclamation point alerts you that you have not yet added an action to the parameter. Most parameters require
an action to function properly. Figure 18-16 shows a chair with a linear parameter.
|
Figure 18-16: This chair has a linear parameter, |
|
but no action. |
|
You can use the grips of the parameters as insertion points when you insert the dynamic |
|
block. During insertion, you press Ctrl to cycle among the grips if their Cycling property is set |
|
to Yes. To check, select a grip, open the Properties palette, and look for the Cycling property. |
|
You can specify the order of the cycling. Select a grip, right-click, and choose Insertion Cycling |
|
to open the Insertion Cycling Order dialog box, where you can turn cycling on or off for each |
|
grip and move the grips up and down in the order of the list. |
|
Adding an action |
|
When you have placed a parameter, you’re ready to add an associated action. Table 18-2 lists |
|
which actions you can associate with your parameter. Click the Actions tab of the Block |
|
Authoring palettes, shown in Figure 18-17. |
Note |
Sometimes the parameter and action labels become too large. When this happens, click the |
|
Update Parameter and Action Text Size button on the Block Editor’s toolbar. |
|
Sometimes, the parameter that you want to use has more grips than you need. For example, if |
|
you use a linear parameter, you end up with two grips, one at each end of the length that you |
|
define. However, you might want to stretch only in one direction; in this case, you need only |
|
one of the grips. To remove the extra grip, select the parameter, right-click, and choose Grip |
|
Display 1. The other option is to use a point parameter with a stretch action. |
Tip |
Why use the linear parameter when you want to add a stretch action? When you stretch the |
|
inserted dynamic block, if you have Dynamic Input turned on, you see a linear tooltip that |
|
allows you to enter a total length. You can set the total length in the Properties palette, |
|
although that isn’t nearly as convenient. Also, a point parameter doesn’t offer the Value Set |
|
option, which lets you constrain sizes. |
Chapter 18 Working with Blocks and Attributes |
549 |
Figure 18-17: Use the Actions tab of the Block Authoring palettes to associate an action with a parameter.
To add an action, choose an appropriate action for your parameter. At the Select parameter: prompt, select the parameter. Remember that you always apply an action to a parameter, rather than to an object. However, as part of the process, you specify a selection set for the action, which means selecting the object or objects.
Caution |
Be sure to select the actual parameter, and not the object or the grip. An easy way to select |
|
the parameter is to click its label. |
The next prompts depend on the action that you choose and on the parameter to which you’re attaching the action. Table 18-3 explains some of the prompt options that you find for commonly used actions.
Table 18-3: Action Prompt Options
Action |
Parameter |
Option Responses |
|
|
|
Move |
Point |
Select the objects. |
Move |
Linear, polar, or XY |
Because you have more than one point, you need to specify which point |
|
|
you want to associate with the action. You can choose the point by |
|
|
moving the cursor over it; a red circle appears over the active point. You |
|
|
can also use the sTart point/Second point options. You can press Enter |
|
|
to use the second point (the default), and then select the objects. |
Scale |
Linear, polar, or XY |
You select the objects. You can also specify a dependent base (relative |
|
|
to the base point of the action’s parameter) or an independent base |
|
|
point (which you specify). If you used an XY parameter, you can also |
|
|
specify whether the distance is the X distance, the Y distance, or the XY |
|
|
distance (the default). |
Stretch |
Point |
Select the objects. |
Continued
550 Part III Working with Data
|
|
|
Table 18-3: (continued) |
|
|
|
|
|
Action |
Parameter |
Option Responses |
|
|
|
|
|
Stretch |
Linear, polar, or XY |
Because you have more than one point, you need to specify which |
|
|
|
point you want to associate with the action. You can choose the |
|
|
|
point by moving the cursor over it; a red circle appears over the |
|
|
|
active point. You can also use the sTart point/Second point options |
|
|
|
or press Enter to use the second point (the default), and then |
|
|
|
select the objects. Then you specify diagonal corners of a stretch |
|
|
|
frame that defines the area that is included in the stretch. (You can |
|
|
|
also use a Cpolygon.) Finally, you select objects. This window |
|
|
|
duplicates the area of the stretch frame, but cannot be exactly on |
|
|
|
top of it. You can continue to add or remove objects, just as you do |
|
|
|
when stretching. |
|
Polar stretch |
Polar |
Identical to the prompts for the Stretch parameter. In addition, you |
|
|
|
specify objects to rotate only (but not stretch). |
Note |
|
||
Defining the stretch frame for a stretch action is similar to specifying a crossing selection win- |
|||
|
dow in the STRETCH command, except that you can create the stretch frame from left to right. |
||
|
For example, objects within the frame are moved, and objects that cross the frame are |
||
|
stretched. However, you also select objects for a stretch action. If objects are in the stretch |
||
|
frame but not in the selection set, they are not stretched or moved. If objects are outside the |
||
|
frame, but are in the selection set, they are moved. After you select objects, you can select or |
||
|
deselect individual objects to add them to, or subtract them from, the selection set. |
||
The final step is to specify the location of the action’s label. At this point, you can also use one of two options:
Multiplier: Multiplies the parameter value by a factor that you specify. For example, you can multiply a stretch by a factor of .5. For example, if you want to keep a circle centered inside a rectangle that you’re moving or stretching, use a .5 multiplier so that the circle moves or stretches half of the distance of the rectangle, thereby remaining centered.
Offset: Changes the parameter angle by an amount that you specify. For example, you can increase an angle by 30 degrees.
Caution |
If the exclamation point doesn’t disappear after you add an action, the action was not success- |
|
fully added! Undo the last command (BACTIONTOOL) and try again. Usually the problem |
|
involves selecting the proper parts of the parameter and correctly selecting the applicable |
|
objects. Also, reducing the number of grips may solve this problem. Select the parameter, right- |
|
click, and choose Grip Display. |
Adding visibility parameters
Visibility parameters enable you to turn the visibility of a block component on and off when you insert it. You can define multiple named visibility states, thereby creating many variations of visibility or invisibility. You can use visibility parameters in two ways:
Make one component visible or invisible: You can choose to display or not display one component. For example, if you have a telephone on a desk, you can display or not display the telephone.
Chapter 18 Working with Blocks and Attributes |
551 |
Switch among multiple components: You can include variations of a component, and cycle among them during insertion. For example, you can have three types of telephones (such as single-line, two-line, and multiple-line), all in the same location, with one on top of the other. When inserting the block, you can choose which telephone to display.
Visibility parameters are a very powerful way to add flexibility to a block and to reduce the number of similar blocks you store. You can add only one visibility parameter per block.
To add a visibility parameter, follow these steps:
1.Open the Block Editor in a drawing that contains the components that you need. If you want to switch among multiple components, place them on top of each other.
2.Choose Visibility Parameter from the Parameters tab of the Block Authoring palettes, and place it near the components.
3.Choose Manage Visibility States on the Block Editor toolbar (or double-click the visibility parameter) to open the Visibility States dialog box, shown in Figure 18-18.
Figure 18-18: Use the Manage Visibility States dialog box to add and name visibility states.
4.Click the default visibility state (VisibilityState0) to select it. Enter a new name for your first state and press Enter. The name should relate to what the state will display. In the telephone example, you might use telephone or single-line as the state.
5.Click New to open the New Visibility State dialog box, shown in Figure 18-19.
Figure 18-19: The New Visibility State dialog box.
552 Part III Working with Data
6.Enter a new visibility state name. In the telephone example, you might use no telephone or two-line. To leave the visibility of existing objects unchanged, use the default option, Leave Visibility of Existing Objects Unchanged in New State. If you want the new state to hide all objects, choose Hide All Existing Objects in New State. To display all objects, choose Show All Existing Objects in New State. Whichever option you choose, you can change the visibility of individual objects for each state afterwards. Click OK.
7.If you need more visibility states, repeat Step 5 and 6 until you’re done.
8.Click OK to close the Visibility States dialog box and return to the Block Editor.
9.Choose the first state from the Visibility States drop-down list at the right side of the Block Editor’s toolbar. For that state, select all of the objects that you want to
make invisible, if any. Then Click the Make Invisible button on the Block Editor’s toolbar.
10.Repeat Step 10 for each state. If you chose to hide objects when you created the state, you may instead need to make certain objects visible by clicking the Make Visible button.
Note |
If you need to select an object that’s invisible, click the Visibility Mode button. The |
|
object is displayed in a light gray color so that you can see and select it. |
11.Check each visibility state by choosing each state in turn from the Visibility States drop-down list and making sure that each state displays what you want it to display.
When you insert the dynamic block and select it, you see a down arrow. Click the arrow to display the list of visibility states. Choose the state that you want.
Adding lookup parameters and actions
A lookup parameter/action combination creates a table that pairs labels with values. For example, you might have a desk that comes in three sizes. You can create this desk and use the Value Set option to create a list of three sizes: 4 feet, 5 feet, and 6 feet. You can then create labels that say 4’ desk, 5’ desk, and 6’ desk. When you insert the desk, you can choose the label that you want from a drop-down list; the desk automatically stretches to the proper size. You don’t need to use the Value Set option, as you can specify values in the lookup table.
Lookup tables are great when you want pre-set sizes for a block. When you insert the block, you don’t even have to think about exact measurements; you just choose from a drop-down list, as shown in Figure 18-20.
Figure 18-20: You can specify a pre-set size by choosing from the drop-down list.
To create a lookup parameter and action, follow these steps:
1.In the Block Editor, add another parameter and action that you will use as the basis for the Lookup parameter and action. For example, add a linear parameter and a stretch action. If you add a value set (list or increment), the measurements will be available in advance when you create the lookup table.
Chapter 18 Working with Blocks and Attributes |
553 |
2.From the Parameters tab of the Block Authoring palettes, add a lookup parameter.
3.From the Actions tab, add a lookup action. At the prompt, select the lookup parameter and place the lookup action. The Property Lookup Table dialog box opens.
4.Click the Add Properties button, choose the parameter that you want to work with (for example, the linear parameter), and click OK. You return to the Property Lookup Table dialog box, as shown in Figure 18-21.
Figure 18-21: The Property Lookup Table dialog box enables you to associate values with labels.
5.If you have values from a value set, you can see them by clicking the first row in the Input Properties side of the dialog box. A drop-down arrow appears. Choose the first value. If you don’t have a value set, you can enter values on each row. Click the same row on the Lookup Properties side of the dialog box and enter the label that corresponds with the value. For example, in Figure 18-21, the label was Desk Chair. Then click the next row, choose the next value, and enter the next label. Continue until you’re done.
6.Click the lower-right cell in the dialog box, which says Read Only by default. Choose Allow Reverse Lookup. (To do this, all of the rows in the table must be unique.) You need to use this option in order to choose a value from a drop-down list of labels when you insert the block.
7.Click OK to return to the Block Editor.
Now each value in the lookup table is associated with the labels that you entered.
Using parameter sets
The Parameter Sets tab of the Block Authoring palettes contains a number of ready-made parameter-action combinations that you can use. These sets are great for quick creation of dynamic blocks that are not complex. Hover the cursor over any parameter set to see a tooltip explaining the set’s functioning.
When you place a parameter set, you see that exclamation point, because you have not yet selected the objects for the action. Double-click the action to display prompts that allow you to select objects.
554 Part III Working with Data
Tip |
You can edit these parameter sets. Right-click a parameter set and choose Properties. Then |
|
change the settings in the Tool Properties dialog box. |
Saving dynamic blocks and closing the Block Editor
When you have finished creating a dynamic block, click Save Block Definition on the Block Editor toolbar. Always save the block definition before closing the Block Editor.
Then click the Close Block Editor button.
If you want to put the base point for the block somewhere on the block, use the BASE command. Then save your drawing.
Inserting and modifying dynamic blocks
You insert a dynamic block in the same way that you insert a regular block: by using the Insert dialog box or the DesignCenter. For more information, see “Inserting Blocks and Files into Drawings” earlier in this chapter.
During insertion, you can press Ctrl to cycle among the grips if their Cycling property is set to Yes. Each time you press Ctrl, the cursor moves to another grip on the block.
To modify the block to use its dynamic features, first select the block. You see special, turquoise dynamic block grips, depending on the type of action. For example, in Figure 18-14, you see grips for stretch and move actions. You click and drag these grips in the same way that you do for regular grips; the difference is that the resulting modification is controlled by the parameters and actions that you defined. If you have created a value set, you see vertical lines at the available lengths, as shown in Figure 18-22. Lookup and visibility actions have a down arrow so that you can open a drop-down list and choose a visibility state or lookup label.
Figure 18-22: This block can be a chair, loveseat, or sofa.
The vertical lines indicate the available lengths as you drag.
On the |
The drawing that you need for the following exercise on creating and inserting dynamic |
CD-ROM |
blocks, ab18-f.dwg, is in the Drawings folder on the CD-ROM. |
STEPS: Creating and Inserting Dynamic Blocks
1.Open ab18-f.dwg from the CD-ROM. This is a set of office furniture, as shown in Figure 18-23.
2.Save the drawing as ab18-06.dwg in your AutoCAD Bible folder.
3.Hover the cursor over any part of the drawing. You can see that it is all one block, called DeskSet.
Chapter 18 Working with Blocks and Attributes |
555 |
Figure 18-23: The office furniture is a block that can be more useful if they are dynamic.
4.Choose Block Editor from the Standard toolbar. In the Edit Block Definition dialog
box, choose DeskSet and click OK. The Block Editor opens with the desk set (including a desk, armchair, computer, monitor, and phone) displayed. Inside the Block Editor, you work with the individual components of the DeskSet block. The Block Authoring palette also opens.
5.You want to be able to move the armchair separately from the rest of the block. To add a point parameter to the chair, click the Parameters tab of the Block Authoring palettes and choose Point Parameter.
6.Follow these prompts:
Specify parameter location or [Name/Label/Chain/Description/Palette]:
Right-click and choose Label.
Enter position property label <Position>: Chair Location
Specify parameter location or [Name/Label/Chain/Description/Palette]:
Pick the endpoint at the middle of the front of the chair.
Specify label location: Pick a location for the Chair Location label.
7.To add a move action to the point parameter, click the Actions tab and choose Move Action. Follow the prompts:
Select parameter: Select the point parameter by clicking its label.
Specify selection set for action. Select objects: Select all of the objects that make up the chair. (In this instance, it doesn’t make any difference whether or not you include the actual parameter in the
selection set.)
Select objects:
Specify action location or [Multiplier/Offset]: Place the action in the middle of the chair (or anywhere near the chair).
8.To add a linear parameter to the desk, click the Parameters tab and choose Linear Parameter. Follow the prompts:
556 Part III Working with Data
Specify start point or [Name/Label/Chain/Description/Base/Palette/ Value set]: Right-click and choose Label.
Enter distance property label <Distance>: Desk length Specify start point or
[Name/Label/Chain/Description/Base/Palette/Value set]: Right-click and choose Value set.
Enter distance value set type [None/List/Increment] <None> : Choose Increment from the drop-down list.
Enter distance increment: 6 Enter minimum distance: 48 Enter maximum distance: 72 Specify start point or
[Name/Label/Chain/Description/Base/Palette/Value set]: Choose the endpoint at the upper-left corner of the desk.
Specify endpoint: Choose the endpoint at the upper-right corner of the desk.
Specify label location: Pick a location above the desk.
9.To simplify matters, we only want the right grip for the linear parameter. This makes sure that the desk can only be stretched towards the right. Select the linear parameter. Right-click and choose Grip Display 1. The left grip disappears.
10.Click the Actions tab and choose Stretch Action. Follow the prompts:
Select parameter: Select the linear parameter by clicking its label.
Specify parameter point to associate with action or enter [sTart point/Second point] <Start>: Pass the cursor over the right grip and click.
Specify first corner of stretch frame or [CPolygon]: Click at 1 in Figure 18-24.
Specify opposite corner: Click at 2.
Specify objects to stretch. Select objects: Click close to but not on top of 2.
Specify opposite corner: Click close to but not on top of 1.
Select objects:
Specify action location or [Multiplier/Offset]: Place the action label to the right of the grip on the right side of the desk.
11.The block should look like Figure 18-24.
12.To allow for various size monitors, click the Parameters tab and choose Linear Parameter. Right-click and choose the Label option. Type Monitor width .
13.At the next two prompts, pick points 3 and 4 in Figure 18-24. Then place the parameter label above the monitor.
14.You can also create a value set in the Properties palette. Select the Monitor width parameter and open the Properties palette (Ctrl+1). In the Value Set section, choose List from the Dist Type drop-down list. Next to the Dist Value List item, click the Ellipsis
(. . .) button to open the Add Distance Value dialog box. The current width is already there. In the Distances to Add text box, type 18-1/2 . The value changes to 1'-6 1⁄2" and moves below to the list box. Again in the Distances to Add text box, type 20-1/2 . Click OK to close the dialog box. Close or minimize the Properties palette.
15.Select the linear parameter. Right-click and choose Grip Display 1.
Chapter 18 Working with Blocks and Attributes |
557 |
1
3 5 4 6
2
Figure 18-24: The DeskSet block after adding a move action to the armchair and a stretch action to the desk.
16.Click the Actions tab on the Block Authoring palette and choose Stretch Action. At the Select parameter: prompt, select the linear parameter that you just created. At the next prompt, click the right parameter point. To specify the stretch frame, pick 5 and then 6 in Figure 18-24. To select objects, pick near 6 and then near 5. Press Enter to end selection. Specify a label location above the monitor.
17.We want to create a lookup parameter for the monitor. On the Parameters tab, choose Lookup Parameter and pick a location on the monitor. On the Actions tab, choose Lookup Action. Select the lookup parameter and select a location just below it. The Property Lookup Table dialog box opens.
18.Click Add Properties. In the Add Parameter Properties dialog box, choose the Linear 1 parameter and click OK. Back in the Property Lookup Table dialog box, click the first row on the Input Properties side, below the Monitor width heading, and choose the first measurement from the drop-down list. In the same row on the Lookup Properties side, type 15 monitor. (Note that monitors are measured diagonally, and so the horizontal width of a 15" monitor is not 15".) In the second row on the Input Properties side, choose the second measurement and enter 17" monitor on the right. In the third row on the left, choose the last measurement and enter 19" monitor on the right.
19.Click the Read Only cell and choose Allow reverse lookup from the drop-down list. The Property Lookup Table dialog box should look like Figure 18-25. Click OK.
20.Because some people may not have a phone, we want to create a visibility parameter and action for the phone. On the Parameters tab, choose Visibility Parameter. Follow the prompts:
Specify parameter location or [Name/Label/Description/Palette]:
Right-click and choose Label.
558 Part III Working with Data
Enter visibility property label <Visibility>: Phone/No Phone Specify parameter location or [Name/Label/Description/Palette]: Pick a location near the phone.
Figure 18-25: The Property Lookup Table dialog box is ready to create a lookup table for the computer monitor.
21.Choose Manage Visibility States from the Block Editor toolbar. The Visibility States dialog box opens. Click the VisibilityState0 item and type Has phone . Click New.
In the Visibility State Name text box of the New Visibility State dialog box, type No phone. Click OK twice to return to the Block Editor.
22.From the Visibility States drop-down list, make sure that No Phone is displayed; if
not, choose it. Click the Make Invisible button on the Block Editor toolbar. At the Select objects: prompt, select all of the objects of the phone and press Enter to end selection. To double-check the visibility states, choose the Has Phone state and make sure that the phone appears.
23.Your block should look like Figure 18-26. Click Save Block Definition on the Block Editor toolbar. At the message asking whether you want to update the block refer-
ence in the drawing, click Yes. Then click Close Block Editor. Save your drawing.
24.Open a new drawing based on the default template or any template that you usually use. Open the DesignCenter. In the Folder List pane, browse to, and double-click, ab18-06.dwg. Click Blocks. Drag the DeskSet block from the right side of the DesignCenter to your drawing.
Note If you create a block inside a drawing and then make it dynamic, you need to use the DesignCenter to insert it. If you try to insert the entire drawing, you see only a regular block. However, if you don’t create a block in the source drawing and create the dynamic block in the Block Editor without ever creating and naming a block, you can use the INSERT command to insert the entire drawing and use the dynamic features of the block.
25.Choose Zoom Extents. Close or minimize the DesignCenter.
26.Select the DeskSet block. It should look like Figure 18-27.
Chapter 18 Working with Blocks and Attributes |
559 |
Figure 18-26: The completed dynamic block in the Block Editor.
Visibility state |
Lookup action |
Stretch actions |
Move action
Figure 18-27: When you select a dynamic block, you see grips for its dynamic features.
27.Click the desk’s stretch grip and stretch the desk one vertical line to the left to make it 6 inches shorter. The computer moves with the desk.
