Did you know you can do this in autocad?
UrbanLISP
AutoCAD AutoCAD AutoCAD
Menu

UrbanLISP provides commands to extend your AutoCAD. The commands come as files with .fas extension. There are several ways to load an UrbanLISP command into AutoCAD. Here are some ways to load .fas files in AutoCAD. Pick the one you prefer!

 

Method 1: Drag and drop

The easiest way to install a .fas file is to open a drawing and drag and drop the .fas file you need in the drawing. The commands will work in that drawing as long as you have it open.

Method 2: Appload

When you have a drawing open you can type 'appload' or just 'ap' and navigate to the files. Click the files you need and select 'Load'. Also for this method the files will only work in the drawing you've loaded them in as long as the drawing is open.

Method 3: Add a line to your startup script
If you want to have the commands loaded in every drawing when opening them you can add a line to the startup script. Check the video below to see how.




In the video the following line is added to the startup script:

(princ (load (strcat LISPPATH "/XXX") "XXX.fas file not loaded"))

Replace XXX with the name of the .fas file. When you purchase more than one file you will receive a text file that can be added to your startup script. For every command you've downloaded it will have an entry to load the commands you've purchased, as shown in the video. It will save you some writing!

4. Load and control the command entries - 1

If you extended or customised your AutoCAD already you may use a key combination that is also used for one of the UrbanLISP commands. As you are probably used to that key combination you don't want to change it into a new command. In that case you can use the UrbanLISP custom mode. It will allow you to change command entry to a key combination you prefer. Add the script below and the number of entries you need.

(setq UrbanLISPcustommode 1)

(defun c:XXX() (LOAD (strcat LISPPATH "XXX") "XXX.fas file not found"))


5. Load and control the command entries - 2

If you use the script below you don't have to add any entries. You have to place the .fas files in a folder of your preference. You should copy that path to the sample path in the script. Make sure it's between quotation marks and ends with a forward slash. When adding this script to your startup files it will load all the .fas files in that folder and use the name of the file as command entry. If you change the name of the file you change the entry of the command. Please not that the command will load any .fas file as you don't define them in a startup script. There are some known .fas files which may do harm. In other words, this script makes your life easier but increases risks as well.


(vl-load-com)
(setq folder "C:/AutoCAD files/my fas files/")
(setq filelist (vl-directory-files folder "*.fas"))
(setq UrbanLISPcustommode 1)

;;; create shortcut for file to load file when shortcut is entered when activated
(foreach fasfile filelist

(setq shortcut (substr fasfile 1 (- (strlen fasfile) 4)))

(eval (read (strcat "(defun c:" shortcut "() (LOAD (strcat "" folder shortcut ))(princ))")))

); end foreach