Find Articles in:
All
Business
Reference
Technology
News
Lifestyle

Tips from our readers: center text, offset polylines, and more

CADalyst, Sept, 2004 by Bill Kramer

"THE COMPETITION IS HEATING up for the big bucks," said Harry as he fired up his laptop, a worn hodgepodge with what looked like a bullet hole near the touch pad. "This is some great stuff."

First up was a cute little trick from W. Kirk Crawford called Centit that moves text to the center of a circle (Center Text In Circle; Tip #1974). This type of notation is commonly used for change notes or a callout reference to another place in the drawing or sheet set. To use Centit, draw the text and circle reasonably close to what is desired, then load and run Centit. Pick a point on the text (and inside the circle). Centit then hunts down the text and circle objects to obtain the center point of the circle. The text location then changes so that it's centered in the circle. That's a timesaver in the neatness category!

Polyline Offsets (Tip #1975) from Stanley Pijl, is a timesaving tool for those who do drawings that contain multiple parallel polylines. Instead of running the Offset command for each parallel run along a centerline, use Ploffs after loading it in Visual LISP. You can add multiple offsets from the centerline by supplying the distances from the centerline or relative to the last offset created. This makes highway layouts a breeze and provides a nice demonstration of commands and logic combined to increase productivity.

For something deeper in terms of object manipulations, take a look at Text Box (Tip #1976) from Juan Cadavid. This utility draws a box around text objects, kind of like we've seen before, but this one has a new twist in that it supports dimension, plus regular text and multiple-line text objects. This nicely structured example of object data access in Visual LISP is useful for making text dimensions stand out in a cluttered drawing.

TIPS FROM OLDTIMERS

Leonid Nemirovsky gives us two new gems to consider. Dimension an Arc (Tip #1977) is an elegant example of object data access and command use. The arc length is obtained from a selected arc object, and then the Dimangular command draws the arc dimension. Load the Dimarc program and then type Dimarc at the Command line to activate.

Field Features (Tip #1978), also from Leonid, explores the field features of AutoCAD 2005. A field is text you expect to change during the lifecycle of a drawing. Typical fields are those data elements found in title blocks, including dates, filenames, and so on. You can also quickly create custom fields using Leonid's utility Sfld. It represents a bold pioneering effort into the newest tools in the AutoCAD programmer's toolbox.

Jeffery Sanders, another past contributor, gives us two more juicy tips. Block Library Manager (Tip #1979) is a handy tool that helps you organize directories of blocks. The several files for this tip need to be located in AutoCAD's current search path. The program attempts to load them while evaluating, so it's not good enough to simply load them in the VLIDE unless you also modify the code. The Library command starts the ball rolling. To create a new library, start with a blank drawing, then load and run the Library command. From your DWG files, pick the blocks that you want included in the library, and the system creates corresponding slide files to preview the library elements. Once the libraries are completed, you can use the Library command to insert blocks into drawings based on your own library naming and slide previews. This is a great example of Visual LISP power, and it contains some handy utilities for programmers.

Jeffery was not content to share just the block library manager. Interface with Excel (Tip #1980) provides a set of tools for interfacing AutoCAD drawings with Microsoft Excel. Visual LISP programmers interested in a nice set of examples that can be used right away as handy utilities should look at Jeffery's work. If you're just starting into the concepts of interfacing Excel with AutoCAD through Visual LISP, you can learn a great deal from these well-documented and consistently structured programs. One handy aspect of this set is the Replace Text option that searches out text objects in the drawing that are cell names in a spreadsheet, such as A1 or B12. When found, the cell name label is changed to match the value in the current spreadsheet at the same location.

"These are hot, but this is not!" Harry scoffed as he ordered another round of coffee. Yes, the competition is heating up, all right. Keep on programming!

Get the code Download free code for this and all articles at www.cadalyst.com. Look for sep04.exe in Get the Code. Tips are tested with AutoCAD 2005, 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. Vote for your favorite tip this month at: www.cadalyst.com

 

BNET TalkbackShare your ideas and expertise on this topic

The following tags are supported in BNET comments:
<b></b> <i></i> <u></u> <pre></pre>

Leave a Reply

  1. You are currently a guest | Login?
advertisement
CIO SessionsVision Series on ZDNet

See and hear what CIOs the world over thinks about the business of technology and how it's changing the way we live and work.

Go
advertisement
  • Click Here
  • Click Here
advertisement

Content provided in partnership with http://findarticles.com/source//