Results 1 to 5 of 5

Thread: Create Alias for Lisp Functions or Add Description to Defun

  1. #1
    Member
    Join Date
    2011-09
    Location
    Tamworth, NSW, Australia
    Posts
    20
    Login to Give a bone
    0

    Default Create Alias for Lisp Functions or Add Description to Defun

    Hi All,
    I have an extensive library of Lisp routines I have created with short names eg LL0, BKL, PJ, etc. which are the command I want to enter on the command line.

    I now have a new drafty that is not familiar with my abbreviations and as such I am wanting to essentially add a description to the commands.

    For example, when you type L on cmd line acad shows L (Line), This is what I am after so typing BKL would show BKL (BK_Lisp).

    I have discovered that creating an alias in the Acad.pgp file (BKL, *BK_Lisp) will achieve this but will mean that I need to add all the LISP commands into the pgp file and ensure that it is updated with each autocad upgrade.

    Does anyone know if it is possible to create an alias directly from LISP or add a description to the defun command to replicate the autocad functionality?

    Thanks in Advance
    Steve

  2. #2
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,719
    Login to Give a bone
    0

    Default Re: Create Alias for Lisp Functions or Add Description to Defun

    Adding to .PGP works, but then has to be distributed & maintained.

    Adding to the source .LSP is also some work, but at least gets you to a single source of truth if located on the network:

    Code:
    (defun c:BKL ()
      (princ "\rBKL (BK_Lisp)")
    
      ;;<-- do something useful
      
      (princ)
    )
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

  3. #3
    All AUGI, all the time
    Join Date
    2003-07
    Posts
    560
    Login to Give a bone
    0

    Default Re: Create Alias for Lisp Functions or Add Description to Defun

    If you look into "Autoload" it may be the answer for you you have a lisp that has all the lisps that you want to run from a shortcut. Its like acad.pgp.

    Code:
    (autoload "COPY0" '("COPY0"))
    (autoload "COPYCOMMAND" '("ZZZ"))
    (autoload "COVER" '("COVER"))
    (autoload "DIMFLIP" '("DIMFLIP"))
    (autoload "DRAWXFALL" '("DRAWXFALL"))
    The other thing to do is make a manual explaining what all the commands do. I use Word as its easy to copy and paste. Yeah I need to update forgot to change 2005. This was given to all new staff.

    Code:
    LISP programs November 2005
    
    General instructions
    
    These lisp programs are accessed via the following methods from within AutoCAD.
    
    The majority of programs that you will use often have been set-up to load automatically and you need only type a short key sequence to use eg "XP"
    
    If your computer is not set up to load automatically please read the instruction at the back of this guide to enable this method.
    
    How to use 
    
    Some programs start straight away and you just follow the prompts. Others will give you a message on the required keyboard entry so program can be repeated again without reloading.
    
    The programs below, names are indicated as well as their shorthand keystroke if available.

  4. #4
    Member
    Join Date
    2011-09
    Location
    Tamworth, NSW, Australia
    Posts
    20
    Login to Give a bone
    0

    Default Re: Create Alias for Lisp Functions or Add Description to Defun

    Thanks @BIG-AL,
    I will have a look into autoload.
    Currently I have a LISP routine to list all the shortcuts and a breif description.
    Cheers
    Steve

    - - - Updated - - -

    Thanks @Blackbox,
    I currently have the list in .lsp file.
    Cheers
    Steve

  5. #5
    Member
    Join Date
    2011-09
    Location
    Tamworth, NSW, Australia
    Posts
    20
    Login to Give a bone
    0

    Default Re: Create Alias for Lisp Functions or Add Description to Defun

    Hey @Big-AL,
    Looks like this does not allow changing the command name.
    I am thinking I just need to set the LISP routines to the full command name I want then add "dummy" lisp command for the shortcuts
    Thanks the the suggestion
    Cheers
    Steve

Similar Threads

  1. Replies: 0
    Last Post: 2012-11-24, 07:38 PM
  2. DEFUN's "arguments"
    By BeKirra in forum AutoLISP
    Replies: 6
    Last Post: 2009-03-18, 09:31 PM
  3. assigning variables inside defun
    By jeff.richards in forum AutoLISP
    Replies: 3
    Last Post: 2008-11-26, 09:37 PM
  4. Having some Issues with defun
    By KGC in forum AutoLISP
    Replies: 10
    Last Post: 2008-05-20, 03:30 PM
  5. Explain the difference between defun and defun c
    By David van Erk in forum AutoLISP
    Replies: 6
    Last Post: 2007-06-08, 09:18 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •