levitra prezzo pastilla sildenafil acheter cialis internet aquisto cialis acheter cialis 20mg compro levitra comprar viagra em portugal levitra effet secondaire commande cialis viagra sin receta acheter accutane vardenafil 10 mg viagra italia achat de levitra viagra versand kamagra apcalis procurer du levitra viagra dosaggio achete levitra levitra prijs generische cialis cialis ordonnance achete cialis generique du cialis trouver du viagra tadalafil bestellen levitra ohne rezept levitra sin receta cialis sur le net levitra sur le net sildenafil receta vente levitra clomid sans ordonnance viagra pharmacie commande levitra generische viagra kamagra rezeptfrei sildenafil venta pilule viagra comprare levitra cialis ohne rezept cialis generico sicuro vendo levitra acquistare levitra tadalafil precio kamagra kopen propecia prix procurer du cialis vendita levitra cialis svizzera viagra europe acheter cialis en pharmacie cialis sur internet impuissance sexuelle viagra ricetta comprar viagra pela internet procurer du viagra levitra en ligne sildenafil kaufen acheter zyban acheter cialis sur internet acheter cialis generic cialis preço cialis venta libre levitra generico aquisto levitra kamagra generique le viagra acheter cialis france citrate de sildenafil prix du viagra levitra precio viagra suisse acheter levitra pas chere cialis effetti collaterali acheter kamagra commander du viagra disfunzione erettile rimedi kamagra oral jelly achat kamagra acheter tadalafil ordina viagra impotenza sessuale aquisto viagra prezzi viagra viagra prezzo comprare viagra viagra donna cialis generico impuissance homme vente de cialis viagra naturel viagra rezeptfrei sildenafil generique acheter cialis pas chere sildenafil bestellen pildoras cialis cialis indien prix de cialis sildenafil generico cialis generique acheter levitra kopen cura impotenza cialis france levitra a vendre achat de viagra pastilla viagra compro viagra viagra acquisto online acheter cialis en ligne vardenafil generika farmaci impotenza zithromax prix acquisto cialis generico acquisto viagra generico acquisto viagra levitra generico achat cialis 20mg acheter du kamagra viagra generico vente cialis prezzi levitra propecia moins cher cialis prix levitra ricetta tadalafil 10 mg viagra svizzera pastilla cialis viagra indien cialis suisse viagra kopen acheter prozac

Auto/VisualLISP 101 – 2

In our first article in this series, we explained that LISP is a List Processing language. This means that all coding you write in this language has to be contained in a list. The list is created by enclosing your phrase in parentheses (). For example, to add two plus one in lisp you would write (+ 2 1).

In this exercise, we are going to start building our function as described in the first article.

In AutoLISP, we are actually going to be DEFining a FUNction. Therefore, we will use the following:

(DEFUN C:CTS ()

)

Now the tools we use in the LISP language are also called functions! This can be a little confusing so we are going to refer to them simply in their proper coding context (what they are used for).

The LISP method named DEFUN defines the function called “CTS”. The “C:” before the function name simply allows us to call the function from the command line. Otherwise, we would have to write the following to the command line “(CTS)” to call the function once it is loaded.

Also note that currently there is an empty parentheses pair after the function name. This is used for variable declaration. A variable is simply a symbol that stores data in memory. To create a variable and store the data we use a method called SETQ. A symbol can be any alphanumeric character or mixture thereof. Any expression can follow but you cannot assign more than one expression to a value. For example, in our sample above of two plus one, we could have written like this:

(SETQ a 2)

(SETQ b 1)

(+ a b)

Using SETQ, I have set the symbol “a” to value of “2″ and “b” to the value of “1″.

There are a few different types of variables you can write. You can write local variables which mean that they will only exist during the length of the function (Only within the DEFUN list). You define the variables as local by adding them to that empty parentheses pair above following a forward slash. For example:

(DEFUN C:CTS (/ a b)

     (SETQ a 2)

     (SETQ b 1)

     (+ a b)

)

You can also define variables as global which means that will exist for the life of the current drawing’s session. This can be useful at times but is considered a bad practice since you aren’t really ‘cleaning’ up after yourself and eating up memory unnecessarily. You define the variables locally simply by leaving them out of the list above.

Lastly, you can create a function which will require variables to be passed INTO it at the time of being called. However, we won’t talk about this in this series.

In our next article in this series, we are going to look at the LISP method called SSGET.

 

1 Response » to “Auto/VisualLISP 101 – 2”

  1. [...] our last article we looked at how to create a function and create variables. Now let’s look at getting some [...]



Calendar Test

September 2009
M T W T F S S
« Aug   Oct »
123456
78910111213
14151617181920
21222324252627
28293031  

Archives