cadalyst
Management

Hot Tip Harry

16 May, 2004 By: Bill Kramer

Make shadow polyline boxes, group objects, and more.


GET THE CODE
Download the code for this and all Cadalyst articles. Look for file MAY04.exe in Get the Code.

Tips are tested with AutoCAD 2002 and 2004, unless otherwise noted. By submitting code to Cadalyst, you grant Cadalyst the right to print and distribute your code in print, digitally, and by other means. Cadalyst and individual authors retain all rights to the code, and it is not to be used for commercial purposes. All published tips are entered into the annual Hot Tip Harry Contest. Find out more online, and e-mail your tips and tricks to harry@cadalyst.com.

LIKE CHOCOLATE AND PEANUT BUTTER, Harry quoted. Sure enough, Jim Sturgess combined two old tips into a dandy new one. Tip #1947 (Shadow Polyline Box) contains the function (C:STBOX). Load the LSP file into AutoCAD, type STBOX, and select a text object as prompted. A polyline box with a shadow effect is created automatically around the selected text line.

Tip #1948 (Group Objects), from Stacey Conrad, contains an AutoLISP command named Good Grouper, or GGR for short. GGR lets you select objects that it places into a group automatically. The group name is based on the current system date and time, plus a count of the entity objects you use. Stacey recently started to use groups in AutoCAD because they are a little easier to modify using grips and properties. That's what makes AutoCAD great-the constant discovery of new tricks.

R. Robert Bell discovered that a tip he supplied last year to remove layer filters doesn't work with AutoCAD 2005. The filters are moved to a new location in the drawing object structure. He updated Tip #1949 (Remove Layer Filters) to work with AutoCAD 2005 and earlier. Once you load this AutoLISP routine, type in the command LFD and then supply the name (using wildcards) of the filters you want to keep. Press with no entry to delete all the layer filters out of the drawing dictionary. Isn't discovery fun?

NECESSITY-THE MOTHER OF INVENTION
Perhaps the discoveries come from necessity, as in the case of Tip #1950 (Divide Open Areas), by Jay Miller. This pair of AutoLISP functions automates a series of commands that you often call on when you create drawings. The technique is a good tip all by itself. With Jay's automation, it's really useful.

Suppose you want to use a series of anchor points to dimension or draw other objects that are relative to two known objects. Load the code, type DVX, enter the number of divisions you want, and select a point on the first object. The object snap is already set to the nearest object point option. For the second point, the object snap mode is set to perpendicular. The command draws a temporary line between the two points, uses the Divide command to place a series of points, and then saves the points just added in a selection set for later removal. The temporary line is removed so that you can see and select the points created more easily. You can now pick these points to draw what's needed using the Node snap mode. Points are placed on the Defpoints layer and behave like the points encountered in dimensions-they don't respond to PDMODE and PDSIZE. This is very useful for dividing up open areas.

Saving time is what customization is all about, Harry said as he showed me Tip #1951 (Layer List), by Theodorus Winata. He must work with a lot of layer names, because this utility defines a long list of layers and attributes in a CSV file, a simple comma-delimited text file that you can manipulate with most spreadsheet programs. This utility reads a CSV file into AutoLISP. Data is stored by column. Each row is a different layer- column one contains the layer name, column two the color, column three the linetype (use CN for Continuous in the spreadsheet), and the last column the status of the plot style (a value of Y indicates Plot for the response to Plotting Preference). This solution is elegant when you're working with lots of different standards that need revisions on a regular basis.

NO MORE CALCULATORS
It must be the engineer in me, but I found another tip from Theodorus Winata even cooler. Tip #1952 (Calculate Areas) calculates areas and places the values in the drawing quickly. It has a nice dialog box and is a great addition to your toolbox.

Along the same lines, but a bit more sophisticated in the math department, is a tip from Jerel Walker. Tip #1953 (Calculate Section Modulus of Flat Shapes) contains two AutoLISP files that calculate the section modulus of a flat shape that is defined with polylines. SM1 works with smaller shapes, and SM2 supports larger shapes. You need to know what a section modulus is in order to use this function in your design. Read the source code for information on how to use these utilities-they have some specific requirements. But they sure beat banging on the calculator.


About the Author: Bill Kramer


More News and Resources from Cadalyst Partners

For Mold Designers! Cadalyst has an area of our site focused on technologies and resources specific to the mold design professional. Sponsored by Siemens NX.  Visit the Equipped Mold Designer here!


For Architects! Cadalyst has an area of our site focused on technologies and resources specific to the building design professional. Sponsored by HP.  Visit the Equipped Architect here!