Command Function

Mar 10

You can use the AutoLISP command function to invoke the AutoCAD or DOS commands under control of an AutoLISP program. Your program may compute parameters on the fly and pass them one at a time to AutoCAD via a series of command function calls, or all the arguments may be prepared and delivered to AutoCAD at once with a single Command function call. There are three...

Read More

List Iteration Part I

Mar 11

MAPCAR Function To Iterate means to repeat. When the same procedure is to be performed over and over on a whole list of things, the AutoLISP function(mapcar) can be used. Suppose, for example, that you need the ASCII values of a list of characters. From the list (“A” “B” “C” “D”) we would expect to get (65 66 67 68). To accomplish this with...

Read More

List Iteration Part II

Mar 11

FOREACH Function FOREACH is another function that uses iteration to operate upon lists and is expressed in the format: (foreach <name> <list> <expressions>) The <list> is examined one item at a time by the (foreach) function, and each item is passed to the <expressions> that follow as if they were a variable. Using an example similar to...

Read More

List Building Part I

Mar 12

APPEND Function Constructing and combining lists is an essential part of using AutoLISP. Many times two separate lists need to be combined into one list. This can be accomplished with the (append) function. This function has the form: (append <list>…..) The (append) function takes any number of <list>s and appends them together to form one list....

Read More

List Building Part II

Mar 12

CONS Function Another function that will add a new element to a list is the (cons) function which is short for CONStruct. This function takes a new element and returns the addition of that element to the list: Command: (cons ‘1 ‘(2 3)) Lisp returns: (1 2 3) Command: (cons ‘(a) ‘(b c d)) Lisp returns: ((A) B C D) Command: (cons ‘((a) (b)) ‘(c)) Lisp...

Read More

SSName

Apr 24

SSName Function The (ssname) function obtains the entity names of these main entities in the selection set and has the syntax: (ssname <selection set> <index>) To place 4 entities into a selection set called SS1 type the following: Command: (setq SS1 (ssget)) ;Select 4 entities Lisp returns: <Selection set: 1> To find the name of the fourth entity...

Read More