Categories

AutoCAD 2012 & AutoCAD LT 2012 Bible

The most comprehensive AutoCAD book around!

AutoCAD 2012 Bible

Keep your own styles, layers & blocks at the top of the list

You’re always creating styles — text, dimension, etc. — layers, and blocks. But when you open the Layer Properties Manager or any other list with these items, they are alphabetized. Especially if you’re sharing drawings with others who add their own styles, layers, and blocks, what can you do to make it easier to find “your own stuff?”

Thanks to Franck Wallez for this tip! He says:

I like to have my own little creations, such as my dimension or text style, my layers, and my blocks,  always easily accessible. I took the habit of starting their name with the underscore _ character, because  then they are are always at the beginning of the lists and not down somewhere in the middle.

He cutely adds, “Please do not use this trick or I will have to use two underscores to stay at the top!”

What naming conventions do you use to help you find your styles, layers and blocks more easily?

Draw fast, accurate revision clouds

Revision clouds show areas of a drawing that have been recently revised. When the REVCLOUD command was introduced to AutoCAD, I thought that they were for quick and dirty indications of revised areas of a drawing. Then I saw that people liked them to be neat!

If you like neat over messy, here’s the technique. Thanks to Brian Glover for contributing this tip.

  1. Draw the extents of the revision cloud using the POLYLINE, RECTANG, or CIRCLE command.
  2. Start the REVCLOUD command. AutoCAD displays the current minimum and maximum Arc settings.
  3. To change current settings, type A and press Enter. Follow the prompts to enter minimum and maximum settings. Size your arcs according to your page size. For 8-1/2″x 11″ (or an A sheet), use 1/8″ (about 3mm) and 1/4″  (about 6mm). For a 24″ x 36″ (or a D sheet), use 1/2″ (about 13mm) and 3/4″  (about 19mm) arcs.
  4. The default option is Object, so press Enter and select the object you draw around the revised area.
  5. At the Reverse Direction [Yes/No]: prompt, press Enter for No (if the revision cloud looks right) to end the command. If the cloud arcs are the opposite direction from what you want, type Y and press Enter.

autocad_tips-neat-revclouds-1Note: You can only convert one object to a revision cloud at a time. The REVCLOUD command works on any polyline (closed or not) or circle.

Manage embedded shapes (islands) when hatching in AutoCAD

It’s common to have closed figures inside other closed figures in AutoCAD drawings. When you hatch these shapes, you can specify whether or not the inner figures are also hatched. This becomes most important when you have 3 closed figures, one inside the other. In fact, you have 3 options for islands.

To set the options in AutoCAD 2011 and 2012, start the HATCH command to display the Hatch Editor tab. Expand the Options panel and choose an option from the Island Detection drop-down list.

autocad_tips-hatch-islands-2

In earlier releases, expand the Hatch and Gradient dialog box by clicking the right arrow at the lower-right corner. In the Islands section, choose one of the options.

Here is the result of each option.

Outer Island Detection only hatches the outer-most closed shape.

autocad_tips-hatch-islands-1

Normal Island Detection alternates between hatched and not hatched areas.

autocad_tips-hatch-islands-3Ignore Island Detection ignores islands and hatches everything.

autocad_tips-hatch-islands-4Note that text is counted as an island and isn’t hatched, even if the island option would normally hatch the island. This example was done with Normal Island Detection, which would have hatched a circle, but the text wasn’t hatched.

autocad_tips-hatch-islands

Understanding how dimensions are associated with objects

autocad_tips-dimensions-objects-1

This is a guest post by Sanjay Kulkarni, an AutoCAD programmer.

Learning AutoLISP (or any other programming language) doesn’t compel you to become a programmer. You can still use it to better understand the internal working of AutoCAD and enhance your interactive working skill. This can also give you an edge over others.

Recently I received a client’s drawing that was in AutoCAD 2004. Even when I saved it in AutoCAD 2010, the dimension would not adjust when I changed the length of a line. Only after I recreated the dimension was I able to use this capability. The reason, I found, was that the dimension in AutoCAD 2004 did not have the reactor (discussed below). Only when I created the dimension in AutoCAD 2010 was the reactor added.

Let’s learn this lesson with an example

Everybody knows that when you dimension an object, the dimension automatically updates when you modify the object. Have you ever wondered how the dimension knows it has to update? AutoLISP can help you find this out, if you don’t already  know.

Here’s the example:

1. Draw a line.

2. Get its entity list by typing the following piece of AutoLISP code at the command prompt:

(entget (car (entsel)))

and selecting the line when prompted to select an object. You’ll see something similar to the following at the command line in return.

((-1 . <Entity name: 7ee45a18>) (0 . “LINE”) (330 . <Entity name: 7ee43cf8>) (5 . “22B”) (100 . “AcDbEntity”) (67 . 0) (410 . “Model”) (8 . “0″) (100 . “AcDbLine”) (10 10.0 10.0 0.0) (11 160.0 160.0 0.0) (210 0.0 0.0 1.0))

This, you might have guessed, is the record that AutoCAD stores in its database.

3. Create a dimension (aligned for example) to show the length of the line and get the entity list of the line again. You should get a result similar to:

((-1 . <Entity name: 7ee45a18>) (0 . “LINE”) (5 . “22B”) (102 . “{ACAD_REACTORS”) (330 . <Entity name: 7ee45ae8>) (102 . “}”) (330 . <Entity name: 7ee43cf8>) (100 . “AcDbEntity”) (67 . 0) (410 . “Model”) (8 . “0″) (100 . “AcDbLine”) (10 10.0 10.0 0.0) (11 160.0 160.0 0.0) (210 0.0 0.0 1.0))

You might have noticed a new item starting with (102 . “{ACAD_REACTORS”) (330 . <Entity name: 7ee45ae8>) (102 . “}”) in the entity list of the line.

This is a reference to a reactor object that AutoCAD has created after adding the dimension. This reactor ensures that dimension gets modified when the object (line in this case) gets modified.

A reactor is a program that executes automatically when a particular action (change in the length of line in this case) is completed. A reactor executes only AFTER an editing action is completed. Hence, you see that the dimension is modified after the command that modifies the line completes and is not dynamically updated while length of line is being modified.

4. Next, entget the dimension using the same code but selecting the dimension this time.  You will get something similar to:

((-1 . <Entity name: 7ee45a20>) (0 . “DIMENSION”) (5 . “22C”) (102 . “{ACAD_XDICTIONARY”) (360 . <Entity name: 7ee45a90>) (102 . “}”) (102 . “{ACAD_REACTORS”) (330 . <Entity name: 7ee45ae8>) (102 . “}”) (330 . <Entity name: 7ee43cf8>) (100 . “AcDbEntity”) (67 . 0) (410 . “Model”) (8 . “0″) (100 . “AcDbDimension”) (280 . 0) (2 . “*D6″) (10 173.511 146.489 0.0) (11 98.5106 71.4894 0.0) (12 0.0 0.0 0.0) (70 . 33) (1 . “”) (71 . 5) (72 . 1) (41 . 1.0) (42 . 212.132) (73 . 0) (74 . 0) (75 . 0) (52 . 0.0) (53 . 0.0) (54 . 0.0) (51 . 0.0) (210 0.0 0.0 1.0) (3 . “Standard”) (100 . “AcDbAlignedDimension”) (13 10.0 10.0 0.0) (14 160.0 160.0 0.0) (15 0.0 0.0 0.0) (16 0.0 0.0 0.0) (40 . 0.0) (50 . 0.0))

You will notice that exactly same reactor appears in the entity list of dimension. Thus, this reactor is the link between the line and dimension.

5. Add one more dimension to the line and get the entity list of line once more. You will see one more item with (330 . in the reactor reference. Thus each dimension associated with line is added as an item with 330 dxf code in the entity list of line..

6. Now delete one of the dimensions and get the new entity list of the line. You will find that one of the (330 . item has been removed.

7. After you delete all dimensions, the entity list of the line returns to its original form without any (102 . items.

A possibility to improve associativity

It is interesting to note that when object is deleted, dimension does not get deleted. Thus it lacks true associativity with the object.

You could create a situation whereby the dimension would be deleted when the object was deleted by adding a reference to one more reactor in the dimension’s entity list that responds to deleting its associated object, but you would have to write code to do so.

Sanjay Kulkarni is an experienced CAD (AutoCAD, Inventor, SolidEdge, CATIA, NX) programmer and a member of the Autodesk Developer Network. He is fluent in AutoLISP, VBA, and VB.NET. He has written for AugiWORLD and Inside AutoCAD (a monthly magazine that has since gone out of publication). You can contact him at sanganakskha@gmail.com.

How to create a text style for a dimension

You should have at least 1 text style for your dimensions and perhaps a text style for each dimension style.

When you create a dimension style, you can create a text style from within the New Dimension Style dialog box. On the Text tab, click the Ellipsis button as shown here.

autocad_tips-text-style-for dimension-1

The Text Style dialog box opens.

The secret here is to set the height of the text style to zero. This allows you to set the height as part of the dimension style. If you instead specify a height in the text style, that height overrides the dimension style’s setting.

autocad_tips-text-style-for dimension-2

If you want the default settings, just click Cancel. Otherwise, make the desired changes and click Apply, then click Close.

Now, you can set the text height in the New Dimension Style dialog box, as you see here.

autocad_tips-text-style-for dimension-3

Now, go do some dimensioning!

What techniques do you use to make sure that your text looks the way you want it to in your dimensions? Leave a comment!

AutoCAD tutorial: Attach an xref

Xrefs (external references) let you view another drawing within your current drawing without actually inserting that other drawing.

Why use xrefs?

  1. Xrefs keep your drawing smaller.
  2. Each time you open a drawing, AutoCAD loads a current copy of the xref, so that you always have the most updated version. The drawing contains a link to the xref, so you don’t have to worry if what you’re seeing is outdated.
  3. You can attach and detach xrefs easily. You can also load and unloaded them to display or hide them, without losing the connection.

Xrefs are ideal for times when you need to reference another drawing but don’t want the relationship to be permanent. They are also ideal for situations in which multiple people work on a drawing. For example, both an electrician and a plumber might add an architect’s plans to their drawing as an xref.

Attach an xref

Follow these steps to attach an xref:

  • Choose Insert tab> Reference panel> Attach (the ATTACH command) to open the Select Reference File dialog box. (In earlier releases, this was the XATTACH command.)
  • Make sure Drawing (*.dwg) is visible in the Files of Type drop-down list in the dialog box. If not, click the list and choose it.
  • Navigate to the drawing you want to attach, choose it and click Open. The Attach External Reference dialog box appears.

  • Set the Reference Type to Attachment (the default). If you want, you can specify the scale, insertion point, and rotation in the dialog box. Click OK.
  • If you used the settings you see in the dialog box here, you’ll be prompted for an insertion point. You’ll see an image of the xref, so you can place it by eye if you want. Click to place the xref.

Notes:

  1. An overlay is useful when you’re sharing drawings over a network. If someone else attaches your current drawing, that person doesn’t see the overlay, only the main drawing.
  2. In the Scale section, you can check the Uniform Scale checkbox to ensure that the Y and Z values are always the same as the X value. This ensures that the xref isn’t distorted from its original ratios.

Do you use xrefs a lot? What tips do you have to make using xrefs easier and more efficient? Please leave a comment and let everyone know!

Autofill AutoCAD table data like you do in Excel

You can auto-fill data in an AutoCAD table like you can in an Excel spreadsheet. This makes it easy to copy data along a row or column and to automatically create incremental data, such as consecutive numbers.

To auto-fill cell data, click in a cell that you’ve already filled with a value. Click and drag the cyan (turquoise) diamond to the desired cell and click.

To auto-fill incremental data, such as consecutive numbers, drag across two cells that already have incremental data. For example, if you typed 1 and 2, drag across those cells. Then click and drag the cyan diamond to the desired cell and click. Before the final click, a tooltip shows you what results to expect. Click to place the data.

Dynamic blocks in AutoCAD–When and why?

I’ve written posts about how to create specific types of dynamic blocks and about some of their features, but I’ve never explained when and why you would use a dynamic block.

If you have a block library that contains variations on an object or component and you insert them at various scales and rotations angles, you can probably save a lot of time with dynamic blocks. For example, you may have a desk that comes in various lengths. You can create one dynamic block to replace all the individual variations.  Moreover, your dynamic block will give you even more flexibility to add additional lengths.

It takes some time to define a dynamic block — of course, simple ones take less time but complex ones can take a long time. For this reason, the most common use for dynamic blocks is to create a block library. That means you don’t usually define  dynamic blocks for your current drawing. Instead, you create them and save them to use in future drawings.

But if  you’ll need to draw several components in variations in your current drawing, you can create a quick dynamic block to save yourself some time.

The first part of the process of creating dynamic blocks is to define the block. Here’s an overview of the workflow:

  1. In your block library drawing or a new drawing, create the block.
  2. Choose Home tab> Block panel> Block Editor (BEDIT command) or just double-click the block. In the Edit Block Definition dialog box, choose the block, and click OK to open the Block Editor. (You can also start the BEDIT command, name the block, and create the objects in the Block Editor.)
  3. Add parameters and associated actions, or geometric parametric constraints. Here’s a tutorial on creating a dynamic block.
  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. You do this when creating a block library that has one block per drawing.
  7. Save the drawing.

You may want to follow this process for any number of blocks. When your blocks are defined, 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 to modify the block. Some dynamic block parameters involve choosing a visibility or option from a drop-down list or table.

Here you see the process of stretching the desk length.

When and why do you use dynamic blocks? What is your process for creating and storing them?

How to load an AutoLISP program

This is a guest post by Sanjay Kulkarni, an AutoCAD programmer.

This post describes the method to load an AutoLISP program in an open drawing.

Some basic & fundamental information before we move to the procedure

An AutoLISP program runs inside (in the same workspace of) an open drawing. Therefore it is necessary to load the program in each individual drawing you want to use the program in. You can load a program into a drawing at any time.

Once you load the program in a drawing, it remains loaded into that specific drawing until the drawing is closed. This means that you can use the functions in the program multiple times once you load the program.

The flip side is that you can’t unload an AutoLISP program once you load it except by closing the drawing.

If you want to use the same program in multiple drawings, you will need to load the program in each individual drawing even if there exists a drawing in which the program has been already loaded.

Loading an AutoLISP program

Now to the action:

  1. Type appload at the command prompt (In AutoCAD 2012, you can go to Manage tab>Applications panel>Load Application.). This will display the Load/Unload Applications dialog box as shown below.

  1. Click the History List tab at the bottom of the dialog box. In case the program was previously loaded in any drawing with Add to History checked, it will be listed there. Select the desired file in the list and go to step 7. Otherwise, go to step 3.
  2. Make sure that Files of type displays the .lsp extension.
  3. Using the LookIn drop-down, you browse to the desired location (folder).
  4. If you want to be able to use step 2 above in future, select the Add to History checkbox.
  5. Select the .lsp file to load in the window.
  6. Click Load. If the file is successfully loaded, a message to that effect is displayed at the bottom of the dialog box. Also if you have checked Add to History, the names of loaded programs are added to in the History List tab of the window.
  7. Click the Close button to close the dialog box.

You are now ready to use the functions in the loaded files.

Notes:

  • You can select multiple files in the History List or the browser using Shift & Control keys and then click the Load button to load all the selected files simultaneously.
  • You can double-click on an individual file to both select and load it. Then you don’t need to click the Load button.
  • When you double-click on a file in History List with Add to History checked, the file name is added again to the History List. You can remove filenames in the History List by selecting the file and clicking the Remove button.
  • If you load a file multiple times in a drawing, AutoCAD does not generate any error and overwrites the previous version of the loaded file.

For a quicker method of loading a program, see the tip, “Loading AutoLISP programs quickly.” This will also obviate the need to load program in each drawing.

Sanjay Kulkarni is an experienced CAD (AutoCAD, Inventor, SolidEdge, CATIA, NX) programmer and a member of the Autodesk Developer Network. He is fluent in AutoLISP, VBA, and VB.NET. He has written for AugiWORLD and Inside AutoCAD (a monthly magazine that has since gone out of publication). You can contact him at sanganakskha@gmail.com

How to trim objects quickly

When you trim objects, the first prompt asks you for a cutting edge. Gerardo Martinez e-mailed me a reminder that you can press Enter (or right-click, depending on your right-click settings) to specify all objects as potential cutting edges.

Then you just select the part of the object that you want to trim and AutoCAD automatically trims it at the closest possible cutting edge.

So remember:

  1. Start the TRIM command
  2. At the Select cutting edges … Select objects or <select all>: prompt, press Enter.
  3. Select the object(s) to trim.

There’s another shortcut for trimming objects—the EXTRIM command. EXTRIM lets you choose an object and then one side of the object. Here are the steps:

  1. Type extrim on the command line.
  2. At the Pick a POLYLINE, LINE, CIRCLE, ARC, ELLIPSE, IMAGE or TEXT for cutting edge: prompt, select one of the listed objects.
  3. At the Specify the side to trim on: prompt, pick on one side of the selected object.

What tips do you have for trimming objects? Leave a comment!