See the top rated post in this thread. Click here

Results 1 to 10 of 11

Thread: AutoLISP 101

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Past Vice President / AUGI Volunteer peter's Avatar
    Join Date
    2000-09
    Location
    Honolulu HI
    Posts
    1,109
    Login to Give a bone
    5

    Default AutoLISP 101

    Comments and Headers


    Please post comments to discussion thread

    The first place I would like to start is comments.

    I have adopted a standard where all of my lisp libraries and routines have a file header and function header comments.

    The file header includes
    1.) My name and year for copyright
    2.) A disclaimer prohibiting unauthorized use
    3.) An abstract that describes what is the purpose of the file or library
    4.) The command line functions with descriptions (alphabetically) including hot key assignments
    5.) The general functions with descriptions
    6.) Version or last modified date

    The function headers include
    1.) Function Description

    The functions are alphabetical (although I let the hot keys supersede their respective functions)

    I use a noun first verb last function name to help organize the functions together when alphabetical.

    I will talk more about function and variable naming.

    So be honest how many of you actually take the time to create a LISP file header?

    Code:
    ;___________________________________________________________________________________________________________|
    ;
    ; Written By: Peter Jamtgaard copyright 2017 All Rights Reserved
    ;___________________________________________________________________________________________________________|
    ;
    ; Any use by unauthorized person or business is strictly prohibited.
    ;___________________________________________________________________________________________________________|
    ; 
    ; Abstract: This routine will display an alert dialog with the words "Hello World" in it.
    ;___________________________________________________________________________________________________________|
    ;
    ; Command Line Function Header List
    ;___________________________________________________________________________________________________________|
    
    ;  Function and Description
    
    ;* C:HW 
    ;* Command Line Function (or hot key) to display Hello World Dialog
    
    ;* C:HelloWorld
    ;* Command Line Function to display Hello World Dialog
    
    ;___________________________________________________________________________________________________________|
    ;
    ; General Function Header List 
    ;___________________________________________________________________________________________________________|
    
    ;  Function, Arguments and Description
    
    ;* (DialogAlertHelloWorld)
    ;* Function to Display an Alert box with the words "Hello World"
    
    ;___________________________________________________________________________________________________________|
    ;
    ; Include Libraries List
    ;___________________________________________________________________________________________________________|
    
    ;* None
    
    ;___________________________________________________________________________________________________________|
    ;
    ; Include Data File List
    ;___________________________________________________________________________________________________________|
    
    ;* None
    
    ;___________________________________________________________________________________________________________|
    ;
    ; Include Dialog Control Language File List
    ;___________________________________________________________________________________________________________|
    
    ;* None
    
    ;$ End Header
    ;___________________________________________________________________________________________________________|
    ___________________________________________________________________________________________________________|
    ;
    ; Command Line Functions
    ;___________________________________________________________________________________________________________|
    ;
    ; Command Line Function to display Hello World Dialog
    ;___________________________________________________________________________________________________________|
    
    (defun C:HW ()(C:HelloWorld))
    
    (defun C:HelloWorld ()(DialogAlertHelloWorld))
    
    ;___________________________________________________________________________________________________________|
    ;
    ; Function to display Hello World Dialog in Alert Dialog Box
    ;___________________________________________________________________________________________________________|
    
    (defun DialogAlertHelloWorld ()(Alert "Hello World"))
    
    ;___________________________________________________________________________________________________________|
    ;___________________________________________________________________________________________________________|
    
    (princ "!")
    (vl-load-com)
    Attached Files Attached Files
    Last edited by peter; 2017-06-29 at 12:47 AM.
    AutomateCAD

Similar Threads

  1. Add Schedule Headers to Existing Grouped Headers
    By Wish List System in forum Revit MEP - Wish List
    Replies: 1
    Last Post: 2015-04-22, 03:24 PM
  2. Structural Headers
    By ford347 in forum Revit Architecture - General
    Replies: 9
    Last Post: 2007-07-11, 04:51 PM
  3. Headers
    By rick.74802 in forum Revit Architecture - General
    Replies: 3
    Last Post: 2004-10-20, 03:13 AM

Posting Permissions

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