. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
This Week's Software TipsSend us your tip, code, or shortcut for your favorite CAD software. If we publish your tip, we'll send you a "Cadalyst: CAD the Way You Want It" T-shirt, and each month Cadalyst editors will randomly select one published tip and send a $100 gift card to its author. Please submit only code and other tips that are your original work (or provide the original source so we can include proper credit) and tell us which software version you use. By submitting code, 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; published code is not to be used for commercial purposes.
Send in Those Tips!
The pace of life slows in the summer -- so they say -- and the same seems to be true for tips! Tips & Tools Weekly could use a few good tips for our readers who are hard at work this time of year. Send us your favorite tip, code, or shortcut you've devised to help you save time and/or do your job better so that we can share it with other readers. We welcome tips related to all CAD software systems. If we publish your tip, you'll receive a Cadalyst T-shirt, and one contributor will be selected randomly to receive a monthly $100 prize.
After reading the LISP routines in this newsletter, Mike Toolen decided to send in some basic routines that he uses every day, even though they were written years ago. He explains: "Express Tools has these layer routines now, but I like to run commands with quick keystrokes -- another good reason I modify the ACAD.PGP file. The routines help if you freeze layers you don't want on and turn all layers on. They won't work well if you use Layer Off instead of Layer Freeze.
"ILC.LSP is very useful if you have everything set at Bylayer. I modified a simple Isolate Layer routine and added something -- it changes the color of a layer with a few quick keystrokes instead of having to run the Layer command, find the layer, change the color, and finally choose the OK button. You also get to see what's on the layer. It does set the layer to "0" and turns all the layers on after that.
(DEFUN C:ILC (/ A B C D)
(PROMPT "\nPICK ENTITY TO ISOLATE LAYER: ")
(SETQ A (ENTSEL))
(SETQ B (ENTGET (CAR A)))
(SETQ C (ASSOC 8 B))
(SETQ D (CDR C))
(COMMAND "LAYER" "SET" D "OFF" "*" "" "")
(SETQ E (GETSTRING "\nChange color layer to: "))
(SETQ F (STRCAT E))
(COMMAND "LAYER" "C" F "" "")
(COMMAND "LAYER" "S" "0" "ON" "*" "")
"AO.LSP is a quick two-keystroke command which turns all the layers on -- very helpful when you need to have all the layers on quickly.
(defun c:ao () (prompt "All layers on")(command "layer" "on" "*" "")(princ))
"L0.LSP was written in 2000 and stands for 'set layer to 0' -- just another quick keystroke command to set the layer to 0."
(defun c:l0 () (prompt "Set Layer to 0")(command ".layer" "s" "0" "")(princ))
NOTES FROM CADALYST TIP PATROL: Our Patrol offers a few thoughts on each LISP routine.
Note that ILC.LSP turns on all layers when it's done, not just the layers it turned off. There is no error checking, so if you enter something other than an integer between one and 255 when it asks for a new color, the routine will crash. In addition, it doesn't support TrueColor and it might fail on non-English versions of AutoCAD.
AO.LSP and L0.LSP work as promised. An alternative to AO.LSP is to add a shortcut to your ACAD.PGP file to use AO to turn on all layers because this is a built-in AutoCAD command (_LAYON).
Follow-up: Keep Files Clean
Just as there are many designers, there are many ways to keep your drawings tidy. In response to questions and comments on last week's tip, we remind readers about Mark Northcott's handy LISP routine, Drawing Cleanup LISP Tool, published in our April 16 edition, which takes the clean-up process even further. Check it out!
Another reader, Michael Cipolla, shares the LISP routine that he wrote for his CAD users to use to clean up drawings:
(defun C:CD ()
(setvar "CMDECHO" 0)
(command "LAYER" "T" "0" "ON" "0" "S" "0" "")
(command "PURGE" "B" "*" "N")
(command "PURGE" "LA" "*" "N")
(command "PURGE" "P" "*" "N")
(command "PURGE" "SH" "*" "N")
(command "PURGE" "ST" "*" "N")
(command "PURGE" "M" "*" "N")
(command "PURGE" "T" "*" "N")
(command "PURGE" "R" "*" "N")
(command "ZOOM" "E")
(setvar "CMDECHO" 1)
Some readers were confused about the terminology and the order of the steps in the original Keep Files Clean tip. Here's some clarification provided by our Tip Patrol:
- Audit. The Audit command will fix many errors that could cause AutoCAD to crash. Run the Audit command. When prompted to Fix any errors detected, type in Y for yes. If errors are detected, a prompt will appear asking if they should be deleted. Type Y for yes; that's why we are doing this.
- Purge. When using the Purge command, select the Confirm Each Item to be Purged box and the Purge Nested Items boxes. This lets you eliminate all purgeable items in the file with one click. If you might need unused items in the future, then select the purgeable items one at a time. This can be cumbersome, but saves items that you might want later.
- Zoom. Zoom in or out in the file so that the drawing border fills the screen.
- Save. This enables any thumbnails of the drawing to clearly indicate the contents of the file.
MicroStation Tip: Redundant Design Key-in
Question: In MicroStation V7, a key-in of the word design brings up a dialog box called Design Options that contains buttons for other dialog boxes for Data Readout, Working Units, Active Scale, etc. What is the equivalent key-in for V8?
Answer: That dialog box is now gone and the buttons it contained are now part of Design Settings, the Reference dialog box, the Cell maintenance dialog box, and others.
You can create a simple VBA macro that opens a form and performs the same end result that is better than the original because you can include other options, as you desire.
Axiom offers many MicroStation Tips on its MicroStationTips.com Web site.
Tips & Tools Weekly software tips for AutoCAD are reviewed by Cadalyst staff and the Tip Patrol before publication. Use all tips at your own discretion, please, and watch later editions of this newsletter for updates and corrections. We're sorry, but editors and Tip Patrol members cannot provide assistance with technical problems; please refer to Cadalyst's Hot Tip Harry-Help discussion forum.
Sincere thanks to our volunteer Tip Patrol members: Brian Benton, Don Boyer, Mitchell Hirschklau, R.K. McSwain, Kevin Sawyer, Ivanhoe Tejeda, and Billy Wooten.