Wednesday, September 3, 2014

ResourcesBlog
 Blog
Share |
28

Here's how to start using Lisp to insert commonly used notes:

  1. Create a folder called "Layout" on your network. If you don't have a network, put it on your hard drive. It just makes it easier to share Lisp commands and files with the network. I will be using T:/ as my network drive.
  2. Create a subfolder called "Miscellaneous" within the "Layout" folder.
  3. Make a copy of your .dwg template file and rename it as deletemelater.dwg. Open deletemelater.dwg.
  4. The commonly used notes that I am going to use for the example are "4" SPLASH" and "WALL (NO SPLASH)". If you don't use these notes, you can either create them or substitute a couple of your notes for the ones that I'm using. I am also assuming that you have Noun/Verb selection turned on (Enter pickfirst->1).
  5. Window around the "4" SPLASH" note.
  6. Click on File->Export.
  7. Browse to T:/Layout/Miscellaneous in the dialogue box.
  8. Under "Files of type:", select "Block (*.dwg)".
  9. Under "File name:", enter "4insp.dwg".
  10. Click "Save".
  11. For the insertion base point, click on a point close to the center of the note.
  12. Repeat steps 5 through 11 for the "WALL (NO SPLASH)" note. Use "wallnosp.dwg" for the filename.
  13. Open up notepad or another word-processing program.
  14. Create the following folder/subfolder: C:/AutoCAD Applications/Lisp. I keep my lisp files on my C: drive because AutoCAD can access them faster there than if they are on a network drive.
  15. Save the file as notes.lsp in the C:/AutoCAD Applications/Lisp folder. You will need to select "All Files" under the "Save as Type:" drop-down list in the Save As dialogue box.
  16. Copy and paste the following highlighted text into the file.
    (defun c:4insp ()
     ;define the function
    ;**********************************************************
     ;Start of Command Function
     (command   "-Insert" "T:/Layout/Miscellaneous/4insp.dwg" pause "" "" ""
       "_Explode" "Last"  
     )        ;End Command
     ;End of Command Function
    ;**********************************************************
     (princ)
     ;finish cleanly
    ) ;end of defun
  17. Press Enter twice to provide some spacing, and paste the highlighted text from above again.
  18. In the text that you pasted in step 16, change "4insp" to "wallnosp". There shoud be two places that you need to change. See the highlighted text below for what the finished code should look like.
    (defun c:4insp ()
     ;define the function
    ;**********************************************************
     ;Start of Command Function
     (command   "-Insert" "T:/Layout/Miscellaneous/4insp.dwg" pause "" "" ""
       "_Explode" "Last"  
     )        ;End Command
     ;End of Command Function
    ;**********************************************************
     (princ)
     ;finish cleanly
    ) ;end of defun

    (defun c:wallnosp ()
     ;define the function
    ;**********************************************************
     ;Start of Command Function
     (command   "-Insert" "T:/Layout/Miscellaneous/wallnosp.dwg" pause "" "" ""
       "_Explode" "Last"  
     )        ;End Command
     ;End of Command Function
    ;**********************************************************
     (princ)
     ;finish cleanly
    ) ;end of defun
  19. Save the file and exit.
  20. In AutoCAD, click Tools->AutoLISP->Load...
  21. In the bottom right-hand corner of the Load/Unload Dialogue Box, there is a box that reads "StartUp Suite". Click "Contents".
  22. Click "Add" and browse to the notes.lsp file that you created.
  23. Click "Add", and then click  "Close" three times.
  24. Type "4insp" and press Enter.
  25. You should see the "4" SPLASH" note that you saved earlier.
  26. Type "wallnosp" and press Enter.
  27. You should see the "WALL (NO SPLASH)" note that you saved earlier.
  28. You can right click or press Enter to repeat the command again, just like you can with the typical AutoCAD commands.

Now you can setup lisp commands for all of your commonly used notes. There are many other uses for lisp commands. I will talk about those in later blog entries. I will also be doing an entry on how to add these commands and others to your menus for easy access.

 

 About the Author:  Seth Emery is a CAD Drafter/CNC Programmer for Henry H. Ross & Son, Inc. in Lititz, Pennsylvania.  H.H.  Ross specializes in the fabrication and installation of solid surface, granite, and engineered stone countertops in residential and commercial applications.  Seth can be reached at seth77@ptd.net  Visit the H.H. Ross website at http://www.hhross.com



Comments

diggles2003
# diggles2003
Friday, February 29, 2008 5:39 PM
Thanks for the great post Seth. I never learned about LISP commands when I was in school, so this is very informative. I have a lot of blocks and notes that I use on a regular basis, and this will be much easier than copying and pasting from my template file.

Post Comment

Only registered users may post comments.
    
Radianz Quartz Sparkling

  Sponsors
MIA - Join Today
Nelson Wood Shims - Buy in Bulk
Moraware - Sorftware for Fabricators
Gemstone Premier Sink Manufacturer
  

Copyright 2004-2014 by Karben Copy LLC. All rights reserved.