Wiki Home

Visual Lisp


Namespace: SoftwareEng
Visual Lisp is a subset of the common lisp language imbedded in Auto CAD 2000. An addon is available for version 14.0.

AutoLisp (VL's original incarnation) was added to Auto CAD in version 2.5 back in the late 80s. It was originaly called "Variables and Expressions" when first release. The original developers felt the ambiguous name wouldn't scare away the non-CompSci crowd. It was renamed AutoLisp in the next version.

AutoLisp provided a powerful means of customizing and extending Auto CAD.

Visual Lisp added ActiveX / COM support as well as full access to the Auto CAD object model.

If you never seen lisp code it has lot's of paranthesis. :) Here's a sample.

;;;==================================================================
;;; (mAssoc Key AList)
;;;		multi version of (cdr (assoc))
;;;------------------------------------------------------------------
;;; Parameters:
;;;   Key     Key value to search for in a list of dotted pairs
;;;   Alist   list of dotted pairs
;;;------------------------------------------------------------------
;;; Returns:
;;;    a list of all the cdrs that match the key
;;;    ex: (setq a '((1 . 22)(2 . "abc")(1 . 58)))
;;;        (mAssoc 1 a) returns
;;;        (22 58)
;;;------------------------------------------------------------------
;;; Notes:  Uses Recursion
;;;------------------------------------------------------------------
;;; Author: RoiLedford
;;;------------------------------------------------------------------
(defun mAssoc (Key Alist)
	(cond
		((null Alist) '())
		(T
		 (if (= (caar Alist) Key)
			 (cons (cdr (car Alist)) (mAssoc Key (cdr Alist)))
			 (mAssoc Key (cdr Alist))
		 ) ;_ end of if
		)
	) ;_ end of cond
) ;_ end of defun


Category Code Samples
( Topic last updated: 2000.07.07 10:18:30 AM )