Tips from Our Readers -- March 2007 (Hot Tip Harry AutoCAD Tutorial)28 Feb, 2007 By: Bill Kramer
Fetch dynamic block names, add a tilde, insert and remove vertex points in polylines and more.
Calling all tip writers! The Hot Tip Harry Challenge is under way for 2007 and is sponsored by Autodesk. Share your hot tips and tricks for a chance to win a trip to Autodesk University 2007, cash prizes and an official Cadalyst t-shirt. For more details, click here.
Harry is still working on some of the tips sent in last year and is looking for more. Why? Because you're always looking for more, and Harry's tips are one of the best places to find examples, already finished command functions and ideas on how to improve your AutoCAD operations. Let's dig into the varied and wonderful tips for this month.
Get Dynamic Block's Original Name (Tip #2188) comes from Michel Chayer's programming library. The utility function named NOMBLK fetches the original name of a dynamic block used in a drawing. Dynamic blocks are inserted using anonymous names (asterisk followed by alphanumeric characters) meaning that the (entget) function of an insert object doesn't return the name of the source block. This LISP function has one parameter for the entity name of a block insert. If you want the routine to ask for an entity selection, then supply nil as the variable value. This handy utility digs into the 360 and 340 DXF codes to extract the desired name.
Quick Dimension Style Selection (Tip #2189) from Robert Lehman is a handy command upgrade for AutoCAD users that have multiple dimensioning styles in use. Once loaded, type the DIMUP command and then select an existing dimension in the drawing. The LISP command extracts and uses the style of that dimension object to set the current dimension style to match. Productivity in CAD operations is the result of quick command tools such as this one. Nice job, Robert!
Leader Modification (Tip #2190) by Scott Restmeyer adds a tilde character (~) at the front of the arrow of a leader object. Normally, this represents a region or area in the drawing that the leader is pointing toward. Draw a normal leader in AutoCAD, and then load the LISP code. Type LENDR at the Command prompt and then select the leader object. The tilde character is automatically located at the tip of the arrow and then scaled and rotated to match. If you have to add a couple of scaled and rotated tildes manually to the leader arrows, this tip will save you a lot of time.
Create Section Cut (Tip #2191) by Raymond Rizkallah works with 3D models in AutoCAD to create a hatched-section detail that resides on the same layer (and color) as the original model. Draw a 3D model using cones, boxes and so forth in AutoCAD and then load the LISP code for this tip. Type SEC1 or SEC2 to start the command. SEC1 keeps the hatch on the same layer/color as the original and SEC2 doesn't update the hatch color. Select a LINE object that defines the cut (as viewed down the UCS), and the routine creates the section and then waits for you to place it in the drawing. The section cut program does a lot of work, so it may require a few seconds to accomplish the task based on the complexity of your model. Nice programming!
Locate Override Dimensions (Tip #2192) by Bill Gilliss searches for dimension objects that aren't based on the actual geometry but have been typed by the operator. This tool is handy when working with drawings that originated elsewhere and when you need to check for accuracy. The program simply changes the layers of any dimensions that don't meet the basic criteria to FORCED_DIMS. After loading the LISP code, type FFD (Find Forced Dimensions) at the AutoCAD Command line. Then you can select the dimensions to check. Any that don't contain an associative reference (<>) or that aren't blank text are moved to the FORCED_DIMS layer so that you can verify the values. If the drawing is to be used in a downstream application that requires accurate graphics, this step is essential and Bill's routine makes it easy.
Polyline Edit Tools in VBA (Tip #2193) by Stahimir Antoljak is a robust set of code that contains public functions for inserting and removing vertex points in polylines. Once loaded using the VBA program manager (VBAMAN), select the project and then the macros button to display the two public functions IV and RV. IV is used to insert a vertex and RV can be used to remove an individual vertex. This tip is wonderful for those looking to learn how VBA can be used in AutoCAD to manipulate complex objects such as polylines. The drawing object in the VBA project has a set of documentation as comments to explain how to use these functions in a production environment. Thanks Stahimir, great programming work, and as a result of your efforts you tip is the top tip of the month!
Templates in a Click (Tip #2194) from Matthew Samario is another great example for those who like to dig around in the code, and its an example of making AutoCAD work faster for you. If you've ever wanted to have a quick way to start a new drawing with a selected template, this program is the solution. But to take advantage of this program, you must make some changes in AutoCAD's setup. The needed changes are documented in the LISP source code as comments. This tip is an excellent source for those wondering how to create shortcut menus using LISP and how to take your customizing of the AutoCAD user interface to another level.
Oblique Angle to Zero (Tip #2195) from James Thomassen is a utility for dealing with drawings created by other sources. In this case, the drawings arrived with various oblique angles assigned to the text and the desired standard was to use no oblique angles. Load the LISP code and type FOA to get the command started. It asks you to select the text objects, and this task can be accomplished quickly using a window because a text-only filter is applied inside the code. After finishing your selection, each text object is interrogated and any nonzero oblique angles are set to zero by changing the group code 51 value.
Write Code and Win
Harry is looking for your tips -- and to get your interest arrangements have been made for a special prize to be awarded. Each month, the top tipster (based on style and merit) is awarded a $100 award, sure to impress every AutoCAD user you know, plus all published entries receive a Cadalyst t-shirt and are entered into our annual lottery drawing. The winner of the drawing will go to Autodesk University this year as Cadalyst and Autodesk's guest. Do you have anything interesting to share? For more details, click here.
Until next time, keep on programmin'.