Speaker Name: Bill Kramer. Course: CP31-2 A Visual LISP Wizard's Advanced Techniques. Course Description

Size: px
Start display at page:

Download "Speaker Name: Bill Kramer. Course: CP31-2 A Visual LISP Wizard's Advanced Techniques. Course Description"

Transcription

1 Speaker Name: Bill Kramer Course: CP31-2 A Visual LISP Wizard's Advanced Techniques Course Description Ready to move beyond DEFUN, SETQ, GETPOINT, and COMMAND? This class is intended for veteran AutoCAD LISP programmers who already know the basics of creating LISP applications and are ready to learn some new tricks. Objects, Active X servers, reactors, lists, recursion, and dynamic dialogs are just some of the advanced techniques. Each topic will include an example scroll (program that we'll explore in detail as we learn the concepts involved and become more familiar with the features available to the Visual LISP programming wizard.

2 Α ςισυαλ ΛΙΣΠ Ωιζαρδ σ Αδϖανχεδ Τεχηνιθυεσ Bill Kramer Advanced Techniques This is NOT an introduction to Visual LISP class! I am going to assume you know things like SETQ and DEFUN, the difference between an integer and a real, the difference between entity lists and names, and the basics of the Visual LISP language. Using examples, we will learn about a variety of Visual LISP elements including: Objects, ActiveX Servers, Reactors, Lists & recursion, Dialog boxes, and more. We will not go into great detail for everything - we don't have enough time for that. But the goal is to introduce these aspects of Visual LISP with an example so that you can see they exist and begin to learn how to exploit them. The Challenge presented by a class of this nature is rather extreme for the instructor. The challenge is to create a set of examples that transcended all disciplines. That is, create something that is equally useless to everyone but yet shows a lot of the Visual LISP language. So instead of a bunch of disassociated examples I thought how about a complete, but useless, application? And since we are in Vegas, I decided how about "AutoKeno"? The Example Application will run a KENO type game in AutoCAD. It uses objects, can keep track of data in lists and objects, can be enhanced with reactors - basically it will show many different advanced techniques and be fun as well! AUTO-KENO Specifics The basic program outline is simple: Draw a Keno card (we ll use 100 numbers Allow the user to select a set of numbers Generate a list of 20 random numbers (1-100 Compare lists to compute winnings Draw a Keno Card The goal is to place 100 numbers in the drawing in ten rows of ten columns. A nested or double loop can be used to accomplish this action. (repeat 10 (setq P1 (list (car BaseP (- (cadr P1 RD 0.0 (repeat 10 (Text_At P1 (itoa N (setq N (1+ N P1 (polar P1 0.0 CD

3 Function (TEXT_AT will draw the text Variables needed BEFORE starting loop BaseP = Base point of chart P1 = initially set to BaseP CD = distance between columns RD = distance between rows N = initially set to 1 Coding (TEXT_AT What is the simplest format for creating this function. The options are to use the (COMMAND expression, we could also use the ENTMAKE form, or we can use the Object form. The real question is "Will we want to do anything else with it?". If we think we might, then it is important to know that the object form enables the easiest expansion. Drawing with Objects The term Drawing should actually be Adding. The reason is that objects are added to the drawing. The programmer decides where to add them. The options are to add them to a named block or to model space or to a named paper space. In each case you simply establish an object link with the host and then add the new object to it. In AutoCAD, everything is in the block table. Model and paper spaces are block references in this same table. To get to the model space object start at the root, the AutoCAD object. (setq ModelSpace (vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object Given link to the space or block where you want to add a new object, use Add... as in (VLA-AddText ModelSpace... We will now look into the remaining parameters of the VLA-ADDTEXT function. You will not find (VLA-AddText in the help system for Visual LISP directly. You need to use the VBA help to locate "ADDTEXT". (VLA-AddText <space> <string> <point> <hgt>

4 Utility Function (LinkModelSpace (defun LinkModelSpace ( (if (null ModelSpace (setq AcadObj (vlax-get-acad-object ActiveDoc (vla-get-activedocument AcadObj ModelSpace (vla-get-modelspace ActiveDoc ModelSpace The (TEXT_AT Function (defun Text_At (P1 TX (vla-addtext (LinkModelSpace TX (vlax-3d-point P1 (getvar "TEXTSIZE" Function VLAX-3D-POINT converts a point list into a variant array for use in the object system. Object Approach Simple and sweet, although a bit rough to read when first learning and getting used to VBA help conversions. The biggest feature of the object approach is future expansion. Object based systems can often be expanded with ease. When used in Visual LISP you simply save the Object reference returned from the ADD function. Then use the reference with a large host of other functions to accomplish a variety of activities. Back to the Keno application (repeat 10 (setq P1 (list (car BaseP (- (cadr P1 RD 0.0 (repeat 10 (text_at P1 (itoa N (setq N (1+ N P1 (polar P1 0.0 CD Set up the Variables (defun Make_Keno_Card ( (initialize_keno_variables (repeat 10...

5 Initialize the Variables CD = 0.9 Column distance RD = 0.75 Row distance BaseP = '( Base point P1 = BaseP Setting up the drawing This application has complete control of the environment, a luxury! Before creating a new card we will want to make room for it and now is when we must consider the standards by which the card will be drawn. The following rules will be used in this application: Text to layer 0 using TextSize variable When selected, text objects will move to layer PICK When Keno ball played, text object will move to layer USED or layer WIN Layers use colors to allow us to see what is going on. Layer and color assignments 0 = White/black PICK = Cyan blue USED = Red WIN = Green The Command Approach (defun Setup_Keno_Layers ( (if (null (tblsearch "LAYER" "Used" (command "_LAYER" "_N" "Used, Win, Pick" "_C" "Red" "Used" "_C" "Green" "Win" "_C" "Cyan" "Pick" "" The Object Approach (defun Setup_Keno_Layers ( / LL LayerTableObj (setq LayerTableObj (vla-get-layers (vla-get-activedocument (vlax-get-acad-object (setq LL (vla-add LayerTableObj "Used" (vla-put-color LL acred (setq LL (vla-add LayerTableObj "Win" (vla-put-color LL acgreen (setq LL (vla-add LayerTableObj "Pick" (vla-put-color LL accyan Object work is more coding however greater control is available at the time the operation is taking place thus allowing future revisions to take advantage of the already coded object references. Finish the set up process

6 (text_at (list (car BaseP (- (cadr P1 (* 0.8 RD 0.0 "Visual LISP AutoKENO - AU 2003" Display available funds for operator (text_at (list (car BaseP (+ (cadr BaseP (* 2.0 RD 0.0 (strcat "Available funds = " (itoa AvailableFunds Save link to available funds string (setq AvlMsg (vlax-ename->vla-object (entlast Spruce up the place, a casino should look neat. (command "_RECTANG" '(0 0 0 (mapcar '+ P1 (list CD (- RD 0.0 "_ZOOM" "_E" "_ZOOM" "0.8x" Put all the above together into a function set to create the card and draw the text labels with the screen centered. This completes the setup of the Keno card. The next step involves the most "danger", the user input. User Selection The next step involves the operator selecting the numbers to play on the card. Now we should really let the operator select the numbers using the object pick box instead of making them type in numbers. The reason we chose to note that a number was picked using a layer system makes this sort of user interface quite easy. But anytime the user input is involved we need to be careful. We need to make sure we do the right thing, react the right way, and are ready for anything that is unexpected. This is another reason to make user selection graphical instead of based on the keyboard. The simpler the better as there are fewer places where an error might occur. A single pick of the number in the drawing will be much easier than typing in the value. Let's define the house rules for AutoKENO. The operator will select a series of up to ten numbers. Each number costs one unit (we will start with fifty to play. As the operator selects the numbers the layer will change from "0" to "PICK". The selection results in the number being picked and one unit being subtracted from the available play units. If selected a second time the number text will go from layer "PICK" back to "0". At the same time a credit of one unit will be applied.

7 Start by pseudo coding the module we want to program. Pseudo code is like real code, but a lot more readable. (TIP: It can be done in the VLIDE as comments in a new function. if no units, make it four selection count = 10 if available funds < 10 then Selection count = available units Loop until selection count reached or operator is done making selections In the loop we want the operator to select an object. Of course, we will need to make sure the object selected is valid! If it is then we will change the layer. Check selection is Text and the right kind of text (number Checks okay, next look at the layer If Layer "0" then change to Layer "Pick" subtract one from selection count else If Layer "Pick" then change to Layer "0" add one back to selection count end both ifs Operator Selection and Testing -> Select From Card (defun Select_From_Card ( / CNT EN EL CNTBASIS LYR (setq CNT 10 (if (> CNT AvailableFunds (setq CNT AvailableFunds (setq CNTBASIS CNT (while (> CNT 0 (setq EN (car (entsel "\npick up to 10 numbers: " (if EN (progn (setq EL (entget EN (cond ((/= (cdr (assoc 0 EL "TEXT" (prompt " Please select a TEXT object." ((zerop (atoi (cdr (assoc 1 EL (prompt " Please select a proper TEXT object." ((/= (setq LYR (strcase (cdr (assoc 8 EL "0" (prompt " Object not on layer 0" (if (= LYR "PICK" previously selected! (progn (setq CNT (1+ CNT AvailableFunds (1+ AvailableFunds (prompt " - deselected." (entmod (subst (cons 8 "0"

8 (assoc 8 EL EL (T (prompt " Registering selection." (setq CNT (1- CNT AvailableFunds (1- AvailableFunds (entmod (subst '(8. "PICK" (assoc 8 EL EL end T end COND end PROGN (setq CNT (- CNT nothing or enter - exit the function. end IF (+ CNTBASIS CNT AUTO-KENO We now have completed drawing the card by adding objects to a clean drawing and then allowing the operator to make selections on the card. Next consideration involves randomly selecting 20 numbers as the Keno play. Amongst the things to think about are the display of selections, keeping track of the selections, and the more critical question of how to produce a random number. How to get a random number? Visual LISP does not provide a random number generator. I know when I first heard of a random number generator, I thought it was pretty silly. I mean, why generate a random number? When my equations were incorrect I got plenty! It was not until later in my computer programming education that I came to learn about creating simulations using random numbers. One can create a model of something and then feed it random numbers with constraints to see how it reacts. Given enough iteration the results can be amazingly accurate in modeling complex reality situations. Another place where random numbers are quite useful is games. But our question is "Can we create a random number generator?" The answer is yes, by using the system date and then pausing long enough for the seconds to change enough to grab the sub-second value. Repeat 1000 times to allow enough time to pass. (defun RANDOM ( / CE (repeat 1000 (setq CE (getvar "CDATE" YYYYMMDD.HHMMSSss CE (- CE (fix CE CE (* CE CE (- CE (fix CE CE (fix (rem (* CE There is a "Better" way Although VL has no random number, VBA does! The RND function in VBA creates a

9 random number given a seed number to get it started. So now the question is how to connect to VBA from VL. Related to that question is how to move data between the two environments. The easiest method of sending data between VL and VBA is to use system variables. Each system variable is supposed to house temporary data for applications to use. There are five each for integers, real numbers, and strings. UserI1 through UserI5 UserR1 through UserR5 UserS1 through UserS5 Loading VBA projects using VL is accomplished using (VL-VBALOAD. Provide the file name of the VBA project (DVB extension and Visual LISP will load the VBA project into memory. It is assumed you know what you are doing with the VBA project of course. Once a VBA project is loaded you call up the Macros by name using (VL-VBARUN. The name of the macro is supplied as the sole parameter. Nothing is returned immediately from (VL-VBARUN that you can use. And it is important to realize that when you start running a VBA macro it will run SIMULTANEOUSLY with your Visual LISP macro. As a result there is a chance you will be looking into the system variables BEFORE the VBA macro has completed the task. The speed of the application is what controls the way you need to handle this situation. You could go into a waiting loop of some sort. But we just need to create a RANDOM number macro in VBA. That is a fairly fast computation. A VBA Booster VBA Source Code The project source code for generating a random number and placing it in the USERI1 system variable is presented at left. If you do not "speak" VBA do not panic, it is pretty simple stuff. The macro we will be calling is RandomVLCall. It uses the RND( internal function after setting a new seed. The random number is multiplied by 100 and then rounded off to an integer with FIX. This will return a value between 0 and 99. The value of NUMB (a function is sent to the "UserI1" system variable in AutoCAD using SetVariable. Now let's look at the Visual LISP side! Function Random (defun Random ( (if (null Random_VBALoaded

10 (vl-vbaload "/my documents/au2003/random.dvb" (setq Random_VBALoaded T (vl-vbarun "RandomVLCall" (getvar "UserI1" Using VBA with Visual LISP You can utilize the improved Dialog Box system of VBA or interface with other ActiveX based applications using VBA if you know the language. Sometimes a blending of Visual LISP and VBA can create a wonderful thing! It is also possible to utilize a DLL created in VB, C++, Delphi, or whatever can create a Microsoft object program. Using (VL-IMPORT-TYPE-LIBRARY you can import an entire ActiveX library into your Visual LISP application opening the door to some wonderful applications such as talking to Excel or Access or Word... Returning to the application We have solved the problem of generating a random number, now we need to return to the running of a card. To run a card we select 20 random numbers where each is unique (cannot repeat. After selecting the number with the random number generator we will mark the display using the following logic. If match, change to layer WIN If no match, change to layer USED Unique random number set To make sure we have unique random numbers we will keep a list of used numbers. If the number selected is a member in the list, then the number has already been used. A simple WHILE loop can be employed to keep checking for random numbers. (setq RR (1+ Random (while (member RR Used (setq RR (1+ (Random Pick a number Given just the random number, how to find the text entity? Since the text entity was generated programmatically we can always locate it programmatically. That is a luxury of having complete control over the drawing environment. Otherwise we may have built a list of numbers with the object reference for quick look up. (defun Where_On_Card (Num (setq Row (1+ (fix (/ (1- Num 10 Col (1- (rem Num 10 (if (minusp Col (setq Col 9 (list (+ (car BaseP (* Col CD (- (cadr BaseP (* Row RD

11 0.0 Playing the card The (Where_On_Card function returns a point based on a calculation. The problem is simply that a TEXT object will not always be at that exact location. Text objects in AutoCAD are based on font definitions and the exact location of the character elements may not be the location where the text was placed. Consider the letter "O". The bottom corner is where the text is placed but there are no pixels illuminated at that location. To locate the text object we will use (NENTSELP to select the object. (NENTSELP uses the pick box size (measured in pixels and searches that area for potential selections. In our program we will check the calculated location and then increase the search box if nothing is found. (setq Saved_PB (getvar "PICKBOX" (setq EN (nentselp PT (while (null EN (setvar "PICKBOX" (1+ (getvar "PICKBOX" (setq EN (nentselp PT Update the display Given the text object we can substitute the text size and layer in the entity list and then update the display using ENTMOD. (setq EL (entget (car EN (if (= (cdr (assoc 0 EL "TEXT" (progn (setq EL (subst (cons 40 (* 1.5 (cdr (assoc 40 EL (assoc 40 EL EL EL (subst (cons 8 (if (= (cdr (assoc 8 EL "0" "USED" "WIN" (assoc 8 EL EL (entmod EL Or using Object References (setq EN (vlax-ename->vla-object (car EN (if (= "AcDbText" (vla-get-objectname EN (progn (vla-put-height EN (* 1.5 (vla-get-height EN (vla-put-layer EN (if (= (strcat (vla-get-layer EN "0" "USED" "WIN"

12 Report the Results (defun Report_Keno_Results ( (setq SS1 (ssget "X" '((0. "TEXT"(8. "WIN" (alert (if SS1 (progn (setq AvailableFunds (+ AvailableFunds (nth (1- (sslength SS1 PayOff (vlax-put-property AvlMsg 'TextString (strcat "\nfunds remaining = " (itoa AvailableFunds (command "_REDRAW" (strcat "\nyou picked " (itoa (sslength SS1 " correctly adding " (itoa (nth (1- (sslength SS1 PayOff " to your available funds!" "\nno correct picks, sorry." The "Pay off" The pay off values are saved as a list. The Nth position corresponds to number correctly guessed minus one. (setq PayOff '( If the number correct is two (2, then subtract one and use NTH. The result would be a pay off of five (5. Our simple Version is Cool! And we can make it cooler! A program is NEVER finished. How about circling the selections when they are made by the operator? How about changing the available funds as they are selected? We want to add more when things change. Adding New Features There are two places to add new features based on changes. We can add them back where the original was created or modified. Or by using reactors. Reactors work well with changes in the drawing! So that is where we will focus our attention. Adding Reactors To add a reactor, we only need to first program the reactor actions and then set up the reactor linkage as the objects are created as the program runs.

13 There are several types of reactors in Visual LISP. We will only consider the two that relate to changes in the drawing database. Database Level reactors vlr-acdb-reactor ANY entity changes Object Level reactors vlr-object-reactor Specific entity changes Adding an Object Level reactor Vlr-object-reactor :vlr-modified :vlr-erased :vlr-copied... Others Change (Text_AT function by adding an object level reactor. (defun Text_AT (P1 TX / TxObj (setq TxObj (vla-addtext (LinkModelSpace TX (vlax-3d-point P1 (getvar "TEXTSIZE" (if Enable_reactor Add object level reactor (vlr-object-reactor (list TxObj nil '((:vlr-modified. KenoNumChange When adding a reactor Only add it once! You can add multiple reactors to an object and this can result in extreme confusion. Can link multiple objects to a single reactor. This is a way of grouping entities in AutoCAD beyond blocks and groups. Can link multiple events to objects. If you really need to keep track of what is going on with an object or group of objects you can. Need to write a function that handles the event call back. There will be two parameters to the function for the majority of reactor types. Object reactors have three parameters. The parameters will be the object reference of the linked object causing the callback, the object reference of the reactor, and in the case of the object reactors a list of parameters that will vary based on the event.

14 Adding a reactor Name of the function is provided in list to the VLR-xxx-REACTOR. You control the function name when you create the program source code. Now let us consider the nuances of programming an event callback function. Reactors need to be: Quick Clean Non-intrusive Programming or an Event Always check you have what you want. An event routine can be linked to multiple objects. If you simply verify that the object causing the event is the one you want to react to then you can save some headaches. Additionally you might want to employ flags to help let the event callback know when to do things and more important, when not to do things. The sequence of events is out of your control except when a BEGIN and END event series exist for a particular reactor. But you cannot anticipate when an exact event will take place. What this means is don't try to toss data between event functions expecting things to take place in a particular order. Beware of causing another event through the actions of your callback function. When working with entity object events you can modify other objects resulting in the callback function being called again (assuming that the entity object being modified is related to the original entity object by a reactor. Scanning for specific entities at the start of a callback can save extra processing time as the function returns quickest. Event termination is out of your control meaning that an event must finish on its own accord. There are times when you might want to stop an event such as the deletion of a critical entity object or an entity being moved to a location it should not be placed. Unfortunately your application will simply have to set some sort of flag indicating that clean up is needed at a later time or some related activity. Programming for an Event Careful planning will yield good results. This is common sense in most programming applications. You should think about when things will happen and try to anticipate in advance every possible reason your callback function will be invoked. Reactor programs need to be quick, clean, and efficient! Our Application Event When the Layer of a text object changes we want the function to react We have attached an object reactor named KenoNumChange to each text object in (TEXT_AT.

15 Pseudo coding of the reactor: Check if calling object is Text Get the layer name If the layer is PICK then The operator selected this object Get center point of the text Draw a circle about that point Somehow relate the text and the circle objects Relating the Text with the Circle As the new circle is added, we want to relate it to the text that was selected. It would be nice to build a link between the two at the entity object level however we cannot change the text object itself as it is the reacting object. Instead we need to establish a link between the two using another tool for customization: a dictionary. Dictionary A dictionary is a collection of non-graphic data in a drawing. Dictionaries are named by the application, which then uses keys to access data stored in the dictionary. (VLAX-LDATA-PUT Name Key Data (VLAX-LDATA-GET Name Key The Name is the name of the dictionary and can be anything you want. If a dictionary does not exist with the name provided and you are putting data in it, a new dictionary is created. The Key is a unique string that can be used to locate the data string. The GET function returns the "Data" string while the PUT function is used to place it in the dictionary. Create the circle entity (in this case we used ENTMAKE, VLA-ADDCIRCLE would work just as well. Get the Entity handle for the newly created circle. We used an entity list here. HDNL1 is set to the text entity object handle. (entmake (list '(0. "CIRCLE" '(8. "PICK" (cons 10 P1 (cons 40 RD (setq EN (entlast EL (entget EN (vlax-ldata-put "LINKS" HNDL1 (cdr (assoc 5 EL Store the data in the dictionary named "LINKS" using the handle of the text object as the key and the handle of the circle object as the data. This creates a linkage table so that when we know the handle of the text object we can get the related circle object. Finding the Center of the Text

16 (setq EN (vlax-vla-object->ename oobj EL (entget EN HNDL1 (cdr (assoc 5 EL TX (textbox EL P1 (mapcar '(lambda (p1 p2 p3 (+ p3 (/ (+ p1 p2 2.0 (car TX (cadr TX (cdr (assoc 10 EL RD (* 2.0 (getvar "TEXTSIZE" Get the entity data list and store it in EL. (Note the handle is retrieved into HNDL1 for later use as the text and circle are related as just described. The function (TextBox returns a list of two points given an entity list of a text object. These points are the top right and lower left limits of the text object. Average of text box limits added to base point of the text is the center. Since these are points, the best way to manipulate them is using a favorite of mine, MAPCAR. MAPCAR The power tool of list processing. For me it stands for Multiple Applications of CAR. Can be used to dig through a list or series of lists computing solutions for each list member and then returning a list as a result. Very handy for point manipulations! (mapcar + P1 P2 adds P1 and P2 points When more than just a simple function is to be evaluated, the LAMBDA expression can be used. Lambda is a temporary function and has a parameter list (like in DEFUN where each list member will be placed as the MAPCAR goes through the list. Back to the design Let's consider what we want our reactor to do. By looking at the layer we will do something. Layer PICK results in a new circle around the text Layer 0 removes the circle and link Layer WIN changes the layer of the circle too. We will update the available funds display at the same time. Layer "PICK" Reaction ((= LYR "PICK" Update funds (vlax-put-property AvlMsg 'textstring (strcat "Available funds = " (itoa AvailableFunds (setq EN (vlax-vla-object->ename oobj EL (entget EN

17 HNDL1 (cdr (assoc 5 EL Compute center TX (textbox EL P1 (mapcar '(lambda (p1 p2 p3 (+ p3 (/ (+ p1 p2 2.0 (car TX (cadr TX (cdr (assoc 10 EL RD (* 2.0 (getvar "TEXTSIZE" Add circle (entmake (list '(0. "CIRCLE" '(8. "PICK" (cons 10 P1 (cons 40 RD (setq EN (entlast EL (entget EN Add link entry (vlax-ldata-put "LINKS" HNDL1 (cdr (assoc 5 EL Layer "0" Reaction ((= LYR "0" Funds update (vlax-put-property AvlMsg 'Textstring (strcat "Available funds = " (itoa AvailableFunds Get the text handle (setq HNDL1 (vlax-get-property oobj "Handle" Get the circle link CirObj (vlax-ldata-get "LINKS" HNDL1 Kill the link entry in the dictionary (vlax-ldata-delete "LINKS" HNDL1 Erase the circle (entdel (handent CirObj Layer "WIN" Reaction ((= LYR "WIN" Get handle of text (setq HNDL1 (vlax-get-property oobj "Handle" Get link to circle CirObj (vlax-ldata-get "LINKS" HNDL1 CirObj (vlax-ename->vla-object (handent CirObj Update circle (vlax-put-property CirObj 'LAYER "WIN"

18 (vlax-put-property CirObj 'RADIUS (* 1.5 (vlax-get-property CirObj 'RADIUS Objects can be extended Reactors allow objects to be extended. Imagine if our application had many different places where the text was changed, we would have to change EACH and EVERY instance to update a feature as we have just done. Reactors are tools for making objects more powerful and extending their capacity. A Change of Example Let's move into our next example. In this case I selected something you can USE! The AutoKENO was fun and demonstrated many features of Visual LISP however it is not something that will help you next week when you are back at work. Our next example application utility does give you something you will find useful right away. Dynamic Dialog Boxes The idea is to create a dialog box on the fly each time program runs. Removes the need to keep DCL files around or keep track of them. This utility is handy for rudimentary dialogs and apps, and it can be used to prototype DCL files. And this example shows great list stuff! List Driven Dialog Box A list is used to supply the essential data to the dialog box generator. Each list member contains data about one of the tiles in the dialog box. Prompt or Label string Unique string used as Key Default value, a string or flag Strings for radio button options, each must be unique and will be used as a "Key". The utility function returns an association list. The prompt string is removed from each entry and the unique key string is used to access the data that follows in your program. List format: (( "Prompt" <"Key"> <"Default"> [<Toggle flag> <"Radio button" >...]... Dynamic Dialog Boxes

19 C_LIST is the important item Check for default settings where radio button rows are being used. Determine number of columns Get a folder name to stash the DCL file. TEST dialog box (setq data (dd "A program generated dialog box" '(("Field one" "F1" "1.23" ("Field two" "F2" "ABC" ("Field three" "F3" "1a2b" T ("Field four" "F4" "Choice 1" "Choice 2" "Choice 3" ("Text only Field Five" The Visual LISP code (defun DD (DPRMPT ;dialog box prompt C_LIST ;control list / TmpDir ;location of DCL file TMP ;input and output string KEY ;key name TAG ;tag value ITEM ;item in a loop RBUT ;radio button variable Tgls ;toggles CNT ;integer counter DIV ;divide up dialog into this many columns FH ;File handle (DD_SetUp (DD_Generate (setq C_LIST (DD_PrepRun (DD_RunDialog Set up the Variables used by the Dynamic Dialog Box generator Determine number of columns. DIV will be greater than the length of C_LIST for a single column. Otherwise it will half of the number of items in the list for two columns. This only comes into play if the number of elements in C_LIST exceeds 11. For radio rows, the default value is optional and assumed to be the first member of the radio group. This mapcar will look for situations where the default was not provided and add it to the individual sub-list member. (defun DD_SetUp ( (setq TmpDir (getvar "DWGPREFIX"

20 CNT 1 DIV (if (> (length C_LIST 11 (fix (/ (1+ (length C_LIST 2 (+ 2 (length C_LIST C_LIST (mapcar '(Lambda (Item if the following are all true (if (and (> (length ITEM 3 radio row? (= (type (cadddr ITEM 'STR (not NOT (apply 'OR any of the follow true? (mapcar third element equal radio option? '(lambda (T2 (= (caddr ITEM T2 (cdddr ITEM (append add default to start of list (list (car ITEM (cadr ITEM (caddr ITEM (cddr ITEM end append ITEM else just return item if not radio row end lambda C_LIST end mapcar and setq DD_Generate - Create the DCL file given the control list C_LIST containing prompts, tag or key names, and additional data for various tile types. Tile Types Sub-list format edit_box ("prompt" "tag" "default" text ("prompt" toggle ("prompt" "tag" <T or nil> radio_row of radio_buttons ("prompt" "tag" "default" "button1" "button2"... toggle and edit_box row ("prompt" "tag" "default" <T or nil> (defun DD_Generate ( Begin the dialog box definition (setq FH (open (strcat TmpDir "TEMP.DCL" "w" create temp DCL (write-line "DD : dialog {" FH (write-line (strcat "label = \42" DPRMPT "\42;" FH (if (< DIV (length C_LIST (progn (write-line ": row {" FH (write-line ": column {" FH (write-line "alignment = left;" FH (foreach ITEM C_LIST Is this a multiple column dialog box? (if (= (rem CNT DIV 0 (progn (write-line "}" FH (write-line ": column {" FH

21 (write-line "alignment = right;" FH (setq CNT (1+ CNT Limit prompt string to 30 characters fill in with dots. (if (> (length ITEM 1 (progn (setq TMP (substr (car ITEM 1 30 (while (< (strlen TMP 30 (setq TMP (strcat TMP "." Details for each tile based on length of ITEM (cond ((= (length ITEM 1 text box only (write-line ": text{value=" FH (write-line (strcat "\42" (car ITEM "\42;width=60;}" FH ((and (= (length ITEM 3 edit_box construction (= (type (caddr Item 'STR (write-line ": edit_box {" FH (write-line "edit_width = 12;" FH (write-line (strcat "label = \42" TMP "\42;" FH (write-line (strcat "key = \42" (cadr ITEM "\42;" FH (write-line "}" FH ((= (length Item 3 toggle box (write-line ": toggle {" FH (write-line (strcat "label=\42" TMP "\42;" FH (write-line (strcat "key=\42" (cadr Item "\42;" FH (write-line "}" FH (setq Tgls (cons (list (cadr Item (caddr Item Tgls ((/= (type (cadddr ITEM 'STR toggle/edit_box combo (write-line ": boxed_row {" FH (write-line ": toggle {" FH (write-line (strcat "label=\42" TMP "\42;" FH (write-line (strcat "key=\42tgl-" (cadr ITEM "\42;}" FH (write-line ": edit_box {" FH (write-line "edit_width = 12;" FH (write-line (strcat "key = \42" (cadr ITEM "\42;}" FH (write-line "}" FH ('t else it is radio row (write-line ": radio_row {" FH (write-line (strcat "label = \42" TMP "\42;" FH (setq TMP (caddr ITEM ;get default (foreach RBUT (cdddr ITEM

22 (write-line ": radio_button {" FH (write-line (strcat "key=\42" RBUT "\42;" FH (write-line (strcat "label=\42" RBUT "\42;" FH (write-line "}" FH (write-line "}" FH (if (< DIV (length C_LIST (progn (write-line "}" FH (write-line "}" FH (write-line "ok_cancel;" FH (write-line "}" FH (setq FH (close FH Prepare control data list for run of the dialog box by removing prompts and text only entries. Returns the modified control list (defun DD_PrepRun ( / TMP ITEM (foreach ITEM C_LIST (if (> (length ITEM 1 (setq TMP (cons (cdr ITEM TMP (reverse TMP Run the dialog box created earlier. (defun DD_RunDialog ( (setq FH (load_dialog (strcat TmpDir "TEMP.DCL" (if (new_dialog "DD" FH (progn (foreach ITEM C_LIST (cond ((and (= (length ITEM 2 (= (type (cadr Item 'STR edit_box (action_tile (car ITEM "(DD_1 $key $value" (set_tile (car ITEM (cadr ITEM ((= (length Item 2 toggle box (action_tile (car ITEM "(DD_1a $key $value" (set_tile (car ITEM (if (cadr Item "1" "0" ((/= (type (caddr Item 'STR toggle/edit box combo (action_tile (car ITEM "(DD_1 $key $value" (set_tile (car ITEM (cadr ITEM (if (caddr Item (progn (set_tile (strcat "TGL-" (car Item "1"

23 (mode_tile (car Item 0 (progn (set_tile (strcat "TGL-" (car Item "0" (mode_tile (car Item 1 (action_tile (strcat "TGL-" (car Item "(DD_2 $key $value" (t radio row (foreach RBUT (cddr ITEM (action_tile RBUT (strcat "(DD_1 \"" (car ITEM "\" $key" (set_tile (cadr ITEM "1" (setq TMP nil trim out radio button options, add toggle options. (foreach ITEM C_LIST (if (and (> (length Item 2 (/= (type (caddr Item 'STR (setq TMP (cons (list (strcat "TGL-" (car ITEM (if (caddr Item "1" "0" TMP (setq TMP (cons (list (car ITEM (cadr ITEM TMP (setq C_LIST (reverse TMP (if (= (start_dialog 1 C_LIST return C_LIST contents Generic call back functions (DD_1 key value - edit box and radio button handling (DD_1a key value - toggle box (DD_2 key value - toggle with edit box handling Substitute data in C_LIST for the key. KY is the value that will be found in C_LIST. For edit boxes the KY value is the key/tag name. For radio buttons the value of KY is the radio group key name and VAL is the key name of the button selected. (defun DD_1 (KY VAL (setq C_LIST (subst (list KY VAL (assoc KY C_LIST C_LIST Substitute data in C_LIST for the key KY. This version is for toggles. If the VAL value is "1" then T is used, nil otherwise.

24 (defun DD_1a (KY VAL (setq C_LIST (subst (list KY (if (= VAL "1" 'T nil (assoc KY C_LIST C_LIST Substitute data in C_LIST for the key KY (toggle control and turns the tile for the associated text on and off. (defun DD_2 (KY VAL handle toggles (if (= VAL "1" toggle on (mode_tile (substr KY 5 0 turn it on (mode_tile (substr KY 5 1 off (DD_1 KY VAL Another Example Function The following code is another DCL file generator for list boxes. Just supply a list and a title and this function will return the operator's selection from the list. (defun DD_LGET ( Lname input data list Title string title of dialog Many multiple select flag / DCL_ID dialog handle NumbSel Numbers Selected FH File Handle RET Returning data list Cnt Counter (setq DCL_ID (make_list_dialog 60 Title Many (if (and DCL_ID (new_dialog "DLIST" DCL_ID (progn (setq NumbSel "" (start_list "LIST" (mapcar 'add_list Lname (end_list (action_tile "LIST" "(setq NumbSel $value" (start_dialog (if (/= NumbSel "" (progn (setq NumbSel (read (strcat "(" NumbSel "" CN 0 (while (< (length RET (length NumbSel (if (member CN NumbSel (setq RET (cons (nth CN Lname RET

25 (setq CN (1+ CN (setq RET (reverse RET (if DCL_ID (unload_dialog DCL_ID (if Many RET (car RET (defun MAKE_LIST_DIALOG ( Wdt text field Width Title dialog box title text Multi 'T if multiple select / FH File handle TmpDir Temporary directory Open the file TEMP.DCL in write mode over writing whatever is already there. (setq TmpDir (getvar "DwgPrefix" FH (open (strcat TmpDir "TEMP.DCL" "w" Ouptut the Dialog box contents for a list box by the name of DLIST. (write-line "DLIST : dialog {" FH (write-line (strcat "label=\"" Title "\";" FH (write-line (strcat ": list_box{key=\"list\"; width=" (itoa Wdt ";" FH (if Multi (write-line "multiple_select=true;" FH (write-line "}" FH (write-line "ok_only;" FH (write-line "}" FH (setq FH (close FH (load_dialog (strcat TmpDir "TEMP.DCL" Thank you! Please remember to fill out your evaluation card if you liked the class. Visit me on the

Speaker Name: Bill Kramer. Course: CP42-2 A Visual LISP Wizard's Into to Reactor Magic. Course Description

Speaker Name: Bill Kramer. Course: CP42-2 A Visual LISP Wizard's Into to Reactor Magic. Course Description Speaker Name: Bill Kramer Course: CP42-2 A Visual LISP Wizard's Into to Reactor Magic Course Description Visual LISP reactors are the tools by which event-driven applications are created. If you want to

More information

Speaker Name: Bill Kramer. Course: CP33-2 A Visual LISP Wizard's Intro to Object Magic. Course Description

Speaker Name: Bill Kramer. Course: CP33-2 A Visual LISP Wizard's Intro to Object Magic. Course Description Speaker Name: Bill Kramer Course: CP33-2 A Visual LISP Wizard's Intro to Object Magic Course Description This course introduces the use of objects in Visual LISP and demonstrates how they can be created

More information

Chapter 29 Introduction to Dialog Control Language (DCL)

Chapter 29 Introduction to Dialog Control Language (DCL) CHAPTER Introduction to Dialog Control Language (DCL Learning Objectives After completing this chapter, you will be able to: Describe the types of files that control dialog boxes. Define the components

More information

Course Title: Mastering the Visual LISP Integrated Development Environment (IDE)

Course Title: Mastering the Visual LISP Integrated Development Environment (IDE) Las Vegas, Nevada, December 3 6, 2002 Speaker Name: R. Robert Bell Course Title: Mastering the Visual LISP Integrated Development Environment (IDE) Course ID: CP42-1 Course Outline: The introduction of

More information

Beyond AutoLISP Basics

Beyond AutoLISP Basics CHAPTER Beyond AutoLISP Basics Learning Objectives After completing this chapter, you will be able to: Identify ways to provide for user input. Retrieve and use system variable values in AutoLISP programs.

More information

Speaker Name: Darren J. Young / Course Title: Introduction to Visual LISP's vl- functions. Course ID: CP42-3

Speaker Name: Darren J. Young / Course Title: Introduction to Visual LISP's vl- functions. Course ID: CP42-3 Las Vegas, Nevada, December 3 6, 2002 Speaker Name: Darren J. Young / dyoung@mcwi.com Course Title: Introduction to Visual LISP's vl- functions Course ID: CP42-3 Course Outline: This course presents long-time

More information

Intro. Scheme Basics. scm> 5 5. scm>

Intro. Scheme Basics. scm> 5 5. scm> Intro Let s take some time to talk about LISP. It stands for LISt Processing a way of coding using only lists! It sounds pretty radical, and it is. There are lots of cool things to know about LISP; if

More information

AutoLISP - Beyond the Crash Course Robert Green Robert Green Consulting Group

AutoLISP - Beyond the Crash Course Robert Green Robert Green Consulting Group AutoLISP - Beyond the Crash Course Robert Green Robert Green Consulting Group CP111-1 So you ve started using AutoLISP/Visual LISP but now you want to gain more functionality and build more elegant routines?

More information

Discover the DATA behind the Drawing Using A+CAD. Permission to copy

Discover the DATA behind the Drawing Using A+CAD. Permission to copy Discover the DATA behind the Drawing Using A+CAD Permission to copy The CAD Academy Did you ever wonder how the entities you draw on the screen look in the database? Understanding how CAD stores data makes

More information

An Overview of VBA in AutoCAD 2006

An Overview of VBA in AutoCAD 2006 11/29/2005-5:00 pm - 6:30 pm Room:Swan 2 (Swan Walt Disney World Swan and Dolphin Resort Orlando, Florida An Overview of VBA in AutoCAD 2006 Phil Kreiker - Looking Glass Microproducts CP22-2 This course

More information

Chapter 28 Beyond AutoLISP Basics. Learning Objectives

Chapter 28 Beyond AutoLISP Basics. Learning Objectives Chapter Beyond AutoLISP Basics Learning Objectives After completing this chapter, you will be able to: Identify ways to provide for user input. Retrieve and use system variable values in AutoLISP programs.

More information

Blockbusters: Unleashing the Power of Dynamic Blocks Revealed!

Blockbusters: Unleashing the Power of Dynamic Blocks Revealed! Blockbusters: Unleashing the Power of Dynamic Blocks Revealed! Matt Murphy - ACADventures GD201-3P Discover the full potential of Dynamic Blocks in AutoCAD. Learn how each parameter and action behaves

More information

Putting the fun in functional programming

Putting the fun in functional programming CM20167 Topic 4: Map, Lambda, Filter Guy McCusker 1W2.1 Outline 1 Introduction to higher-order functions 2 Map 3 Lambda 4 Filter Guy McCusker (1W2.1 CM20167 Topic 4 2 / 42 Putting the fun in functional

More information

1 of 5 5/11/2006 12:10 AM CS 61A Spring 2006 Midterm 2 solutions 1. Box and pointer. Note: Please draw actual boxes, as in the book and the lectures, not XX and X/ as in these ASCII-art solutions. Also,

More information

*.lsp Commands: + - * / setq setvar getvar getpoint defun command getstring appload vlide

*.lsp Commands: + - * / setq setvar getvar getpoint defun command getstring appload vlide *.lsp Commands: + - * / setq setvar getvar getpoint defun command getstring appload vlide Autolisp is version of an old programming language (circa 1960) called LISP (List Processor) Autolisp programs

More information

Las Vegas, Nevada, December 3 6, Speaker Name: dave espinosa-aguilar. Course Title: Fundamentals of AutoLISP.

Las Vegas, Nevada, December 3 6, Speaker Name: dave espinosa-aguilar. Course Title: Fundamentals of AutoLISP. Las Vegas, Nevada, December 3 6, 2002 Speaker Name: dave espinosa-aguilar Course Title: Fundamentals of AutoLISP Course ID: CP11-2 Course Outline: AutoLISP has been around for a long time and has always

More information

Lecture Notes on Lisp A Brief Introduction

Lecture Notes on Lisp A Brief Introduction Why Lisp? Lecture Notes on Lisp A Brief Introduction Because it s the most widely used AI programming language Because Prof Peng likes using it Because it s good for writing production software (Graham

More information

Excel Basics Rice Digital Media Commons Guide Written for Microsoft Excel 2010 Windows Edition by Eric Miller

Excel Basics Rice Digital Media Commons Guide Written for Microsoft Excel 2010 Windows Edition by Eric Miller Excel Basics Rice Digital Media Commons Guide Written for Microsoft Excel 2010 Windows Edition by Eric Miller Table of Contents Introduction!... 1 Part 1: Entering Data!... 2 1.a: Typing!... 2 1.b: Editing

More information

CIS4/681 { Articial Intelligence 2 > (insert-sort '( )) ( ) 2 More Complicated Recursion So far everything we have dened requires

CIS4/681 { Articial Intelligence 2 > (insert-sort '( )) ( ) 2 More Complicated Recursion So far everything we have dened requires 1 A couple of Functions 1 Let's take another example of a simple lisp function { one that does insertion sort. Let us assume that this sort function takes as input a list of numbers and sorts them in ascending

More information

An Explicit-Continuation Metacircular Evaluator

An Explicit-Continuation Metacircular Evaluator Computer Science (1)21b (Spring Term, 2018) Structure and Interpretation of Computer Programs An Explicit-Continuation Metacircular Evaluator The vanilla metacircular evaluator gives a lot of information

More information

AutoLISP Tricks for CAD Managers Speaker: Robert Green

AutoLISP Tricks for CAD Managers Speaker: Robert Green December 2-5, 2003 MGM Grand Hotel Las Vegas AutoLISP Tricks for CAD Managers Speaker: Robert Green CM42-1 You already know that AutoLISP is a powerful programming language that can make AutoCAD do great

More information

AutoLISP for CAD Managers Robert Green Robert Green Consulting Group

AutoLISP for CAD Managers Robert Green Robert Green Consulting Group Robert Green Robert Green Consulting Group CM305-1L AutoLISP/Visual LISP is a powerful way to extend the AutoCAD functionality, but many avoid using it because they think it's too hard to learn. This class

More information

ActiveX Tricks for Visual LISP and VBA R. Robert Bell MW Consulting Engineers Peter Jamtgaard Cordeck

ActiveX Tricks for Visual LISP and VBA R. Robert Bell MW Consulting Engineers Peter Jamtgaard Cordeck November 30 December 3, 2004 Las Vegas, Nevada ActiveX Tricks for Visual LISP and VBA R. Robert Bell MW Consulting Engineers Peter Jamtgaard Cordeck CP23-3 You can do some amazing things in AutoCAD using

More information

6.001 Notes: Section 15.1

6.001 Notes: Section 15.1 6.001 Notes: Section 15.1 Slide 15.1.1 Our goal over the next few lectures is to build an interpreter, which in a very basic sense is the ultimate in programming, since doing so will allow us to define

More information

Memory Addressing, Binary, and Hexadecimal Review

Memory Addressing, Binary, and Hexadecimal Review C++ By A EXAMPLE Memory Addressing, Binary, and Hexadecimal Review You do not have to understand the concepts in this appendix to become well-versed in C++. You can master C++, however, only if you spend

More information

CS61A Summer 2010 George Wang, Jonathan Kotker, Seshadri Mahalingam, Eric Tzeng, Steven Tang

CS61A Summer 2010 George Wang, Jonathan Kotker, Seshadri Mahalingam, Eric Tzeng, Steven Tang CS61A Notes Week 6B: Streams Streaming Along A stream is an element and a promise to evaluate the rest of the stream. You ve already seen multiple examples of this and its syntax in lecture and in the

More information

6.001: Structure and Interpretation of Computer Programs

6.001: Structure and Interpretation of Computer Programs 6.001: Structure and Interpretation of Computer Programs Symbols Quotation Relevant details of the reader Example of using symbols Alists Differentiation Data Types in Lisp/Scheme Conventional Numbers

More information

LISP. Everything in a computer is a string of binary digits, ones and zeros, which everyone calls bits.

LISP. Everything in a computer is a string of binary digits, ones and zeros, which everyone calls bits. LISP Everything in a computer is a string of binary digits, ones and zeros, which everyone calls bits. From one perspective, sequences of bits can be interpreted as a code for ordinary decimal digits,

More information

Let s Make a Front Panel using FrontCAD

Let s Make a Front Panel using FrontCAD Let s Make a Front Panel using FrontCAD By Jim Patchell FrontCad is meant to be a simple, easy to use CAD program for creating front panel designs and artwork. It is a free, open source program, with the

More information

Module 10A Lecture - 20 What is a function? Why use functions Example: power (base, n)

Module 10A Lecture - 20 What is a function? Why use functions Example: power (base, n) Programming, Data Structures and Algorithms Prof. Shankar Balachandran Department of Computer Science and Engineering Indian Institute of Technology, Madras Module 10A Lecture - 20 What is a function?

More information

The AutoLISP Platform for Computer Aided Design

The AutoLISP Platform for Computer Aided Design The AutoLISP Platform for Computer Aided Design Harold Carr Robert Holt Autodesk, Inc. 111 McInnis Parkway San Rafael, California 94903 harold.carr@autodesk.com rhh@autodesk.com Introduction Over fifteen

More information

AUGI Tips and Tricks GD12-2. Donnia Tabor-Hanson - MossCreek Designs

AUGI Tips and Tricks GD12-2. Donnia Tabor-Hanson - MossCreek Designs 11/28/2005-10:00 am - 11:30 am Room:S. Hemispheres (Salon II) (Dolphin) Walt Disney World Swan and Dolphin Resort Orlando, Florida AUGI Tips and Tricks Donnia Tabor-Hanson - MossCreek Designs GD12-2 Did

More information

The Anglemaker Program

The Anglemaker Program C h a p t e r 3 The Anglemaker Program In this chapter, you will learn the following to World Class standards: 1. Drawing and Labeling the Anglemaker Programming Sketch 2. Launching the Visual LISP Editor

More information

CSCI337 Organisation of Programming Languages LISP

CSCI337 Organisation of Programming Languages LISP Organisation of Programming Languages LISP Getting Started Starting Common Lisp $ clisp i i i i i i i ooooo o ooooooo ooooo ooooo I I I I I I I 8 8 8 8 8 o 8 8 I \ `+' / I 8 8 8 8 8 8 \ `-+-' / 8 8 8 ooooo

More information

4 Accessing Commands and Services Command Submission

4 Accessing Commands and Services Command Submission AutoLISP_DCL_Course. Total Duration : 60hrs AutoLISP_DCL_Course Curriculum Hrs. Using the AutoLISP Language AutoLISP Basics AutoLISP Expressions AutoLISP Function Syntax AutoLISP Data Types Integers Reals

More information

Good Habits for Coding in Visual LISP

Good Habits for Coding in Visual LISP R. Robert Bell Sparling CP319-1 The power of AutoCAD lies in its customization capabilities. Visual LISP is a powerful tool for expanding your options. Unhappily, it is easy to have a scatter-shot approach

More information

A Quick Introduction to Common Lisp

A Quick Introduction to Common Lisp CSC 244/444 Notes last updated ug. 30, 2016 Quick Introduction to Common Lisp Lisp is a functional language well-suited to symbolic I, based on the λ-calculus and with list structures as a very flexible

More information

Introduction to Scheme

Introduction to Scheme How do you describe them Introduction to Scheme Gul Agha CS 421 Fall 2006 A language is described by specifying its syntax and semantics Syntax: The rules for writing programs. We will use Context Free

More information

The first thing we ll need is some numbers. I m going to use the set of times and drug concentration levels in a patient s bloodstream given below.

The first thing we ll need is some numbers. I m going to use the set of times and drug concentration levels in a patient s bloodstream given below. Graphing in Excel featuring Excel 2007 1 A spreadsheet can be a powerful tool for analyzing and graphing data, but it works completely differently from the graphing calculator that you re used to. If you

More information

Announcement. Overview. LISP: A Quick Overview. Outline of Writing and Running Lisp.

Announcement. Overview. LISP: A Quick Overview. Outline of Writing and Running Lisp. Overview Announcement Announcement Lisp Basics CMUCL to be available on sun.cs. You may use GNU Common List (GCL http://www.gnu.org/software/gcl/ which is available on most Linux platforms. There is also

More information

MITOCW ocw f99-lec07_300k

MITOCW ocw f99-lec07_300k MITOCW ocw-18.06-f99-lec07_300k OK, here's linear algebra lecture seven. I've been talking about vector spaces and specially the null space of a matrix and the column space of a matrix. What's in those

More information

This chapter is intended to take you through the basic steps of using the Visual Basic

This chapter is intended to take you through the basic steps of using the Visual Basic CHAPTER 1 The Basics This chapter is intended to take you through the basic steps of using the Visual Basic Editor window and writing a simple piece of VBA code. It will show you how to use the Visual

More information

An introduction to Scheme

An introduction to Scheme An introduction to Scheme Introduction A powerful programming language is more than just a means for instructing a computer to perform tasks. The language also serves as a framework within which we organize

More information

STREAMS 10. Basics of Streams. Practice with Streams COMPUTER SCIENCE 61AS. 1. What is a stream?

STREAMS 10. Basics of Streams. Practice with Streams COMPUTER SCIENCE 61AS. 1. What is a stream? STREAMS 10 COMPUTER SCIENCE 61AS Basics of Streams 1. What is a stream? A stream is an element and a promise to evaluate the rest of the stream. Streams are a clever idea that allows one to use sequence

More information

(Refer Slide Time 3:31)

(Refer Slide Time 3:31) Digital Circuits and Systems Prof. S. Srinivasan Department of Electrical Engineering Indian Institute of Technology Madras Lecture - 5 Logic Simplification In the last lecture we talked about logic functions

More information

A Genetic Algorithm Implementation

A Genetic Algorithm Implementation A Genetic Algorithm Implementation Roy M. Turner (rturner@maine.edu) Spring 2017 Contents 1 Introduction 3 2 Header information 3 3 Class definitions 3 3.1 Individual..........................................

More information

Las Vegas, Nevada December 3-6, Course: Working with Custom menus in ADT

Las Vegas, Nevada December 3-6, Course: Working with Custom menus in ADT Las Vegas, Nevada December 3-6, 2002 Speaker Name: Bob Callori Course: Working with Custom menus in ADT Course Description Want to customize ADT so that the Design Center symbol library content appears

More information

AutoLISP Functions. The following is a catalog of the AutoLISP functions available in AutoCAD. The functions are listed alphabetically.

AutoLISP Functions. The following is a catalog of the AutoLISP functions available in AutoCAD. The functions are listed alphabetically. Page 1 of 376 The following is a catalog of the AutoLISP functions available in AutoCAD. The functions are listed alphabetically. In this chapter, each listing contains a brief description of the function's

More information

Copyright 2004, Mighty Computer Services

Copyright 2004, Mighty Computer Services EZ-GRAPH DATABASE PROGRAM MANUAL Copyright 2004, Mighty Computer Services The Table of Contents is located at the end of this document. I. Purpose EZ-Graph Database makes it easy to draw and maintain basic

More information

Clickteam Fusion 2.5 Creating a Debug System - Guide

Clickteam Fusion 2.5 Creating a Debug System - Guide INTRODUCTION In this guide, we will look at how to create your own 'debug' system in Fusion 2.5. Sometimes when you're developing and testing a game, you want to see some of the real-time values of certain

More information

Interface. 2. Interface Adobe InDesign CS2 H O T

Interface. 2. Interface Adobe InDesign CS2 H O T 2. Interface Adobe InDesign CS2 H O T 2 Interface The Welcome Screen Interface Overview The Toolbox Toolbox Fly-Out Menus InDesign Palettes Collapsing and Grouping Palettes Moving and Resizing Docked or

More information

Transcriber(s): Aboelnaga, Eman Verifier(s): Yedman, Madeline Date Transcribed: Fall 2010 Page: 1 of 9

Transcriber(s): Aboelnaga, Eman Verifier(s): Yedman, Madeline Date Transcribed: Fall 2010 Page: 1 of 9 Page: 1 of 9 0:00 1 R1 The color s not going to show a little bit, but okay. Okay. So, um, a plus b quantity cubed, you said, means Stephanie a plus b times a plus b times a plus b /R1 3 R1 Okay, so you

More information

Intro to Programming. Unit 7. What is Programming? What is Programming? Intro to Programming

Intro to Programming. Unit 7. What is Programming? What is Programming? Intro to Programming Intro to Programming Unit 7 Intro to Programming 1 What is Programming? 1. Programming Languages 2. Markup vs. Programming 1. Introduction 2. Print Statement 3. Strings 4. Types and Values 5. Math Externals

More information

regsim.scm ~/umb/cs450/ch5.base/ 1 11/11/13

regsim.scm ~/umb/cs450/ch5.base/ 1 11/11/13 1 File: regsim.scm Register machine simulator from section 5.2 of STRUCTURE AND INTERPRETATION OF COMPUTER PROGRAMS This file can be loaded into Scheme as a whole. Then you can define and simulate machines

More information

Quit Gambling with Huge Files! Scott McEachron DC CADD (Dallas, TX)

Quit Gambling with Huge Files! Scott McEachron DC CADD (Dallas, TX) November 30 December 3, 2004 Las Vegas, Nevada Quit Gambling with Huge Files! Scott McEachron DC CADD (Dallas, TX scottm@dccadd.com GI33-2 Ever import a 250MB ESRI Shape file or a 3GB aerial image? We'll

More information

1 of 10 5/11/2006 12:10 AM CS 61A Spring 2006 Midterm 3 solutions 1. Box and pointer. > (let ((x (list 1 2 3))) (set-car! (cdr x) (cddr x)) x) (1 (3) 3) +-------------+ V --------- -- ------ ---------

More information

Title and Modify Page Properties

Title and Modify Page Properties Dreamweaver After cropping out all of the pieces from Photoshop we are ready to begin putting the pieces back together in Dreamweaver. If we were to layout all of the pieces on a table we would have graphics

More information

Divisibility Rules and Their Explanations

Divisibility Rules and Their Explanations Divisibility Rules and Their Explanations Increase Your Number Sense These divisibility rules apply to determining the divisibility of a positive integer (1, 2, 3, ) by another positive integer or 0 (although

More information

Digital Mapping with OziExplorer / ozitarget

Digital Mapping with OziExplorer / ozitarget Going Digital 2 - Navigation with computers for the masses This is the 2nd instalment on using Ozi Explorer for digital mapping. This time around I am going to run through some of the most common questions

More information

C++ Reference NYU Digital Electronics Lab Fall 2016

C++ Reference NYU Digital Electronics Lab Fall 2016 C++ Reference NYU Digital Electronics Lab Fall 2016 Updated on August 24, 2016 This document outlines important information about the C++ programming language as it relates to NYU s Digital Electronics

More information

EXCEL BASICS: MICROSOFT OFFICE 2010

EXCEL BASICS: MICROSOFT OFFICE 2010 EXCEL BASICS: MICROSOFT OFFICE 2010 GETTING STARTED PAGE 02 Prerequisites What You Will Learn USING MICROSOFT EXCEL PAGE 03 Opening Microsoft Excel Microsoft Excel Features Keyboard Review Pointer Shapes

More information

One SAS To Rule Them All

One SAS To Rule Them All SAS Global Forum 2017 ABSTRACT Paper 1042 One SAS To Rule Them All William Gui Zupko II, Federal Law Enforcement Training Centers In order to display data visually, our audience preferred Excel s compared

More information

To get started with Visual Basic 2005, I recommend that you jump right in

To get started with Visual Basic 2005, I recommend that you jump right in In This Chapter Chapter 1 Wading into Visual Basic Seeing where VB fits in with.net Writing your first Visual Basic 2005 program Exploiting the newfound power of VB To get started with Visual Basic 2005,

More information

Sample midterm 1 #1. Problem 1 (What will Scheme print?).

Sample midterm 1 #1. Problem 1 (What will Scheme print?). Sample midterm 1 #1 Problem 1 (What will Scheme print?). What will Scheme print in response to the following expressions? If an expression produces an error message, you may just say error ; you don t

More information

Chapter 1 - What s in a program?

Chapter 1 - What s in a program? Chapter 1 - What s in a program? I. Student Learning Outcomes (SLOs) a. You should be able to use Input-Process-Output charts to define basic processes in a programming module. b. You should be able to

More information

Imperative, OO and Functional Languages A C program is

Imperative, OO and Functional Languages A C program is Imperative, OO and Functional Languages A C program is a web of assignment statements, interconnected by control constructs which describe the time sequence in which they are to be executed. In Java programming,

More information

AutoCAD VBA Programming

AutoCAD VBA Programming AutoCAD VBA Programming TOOLS AND TECHNIQUES John Gibband Bill Kramer Freeman fbooks San Francisco Table of Contents Introduction Chapter 1: The AutoCAD VBA Environment 1 AutoCAD Programming Solutions

More information

EXCEL BASICS: MICROSOFT OFFICE 2007

EXCEL BASICS: MICROSOFT OFFICE 2007 EXCEL BASICS: MICROSOFT OFFICE 2007 GETTING STARTED PAGE 02 Prerequisites What You Will Learn USING MICROSOFT EXCEL PAGE 03 Opening Microsoft Excel Microsoft Excel Features Keyboard Review Pointer Shapes

More information

Data abstraction, revisited

Data abstraction, revisited Data abstraction, revisited Design tradeoffs: Speed vs robustness modularity ease of maintenance Table abstract data type: 3 versions No implementation of an ADT is necessarily "best" Abstract data types

More information

PAIRS AND LISTS 6. GEORGE WANG Department of Electrical Engineering and Computer Sciences University of California, Berkeley

PAIRS AND LISTS 6. GEORGE WANG Department of Electrical Engineering and Computer Sciences University of California, Berkeley PAIRS AND LISTS 6 GEORGE WANG gswang.cs61a@gmail.com Department of Electrical Engineering and Computer Sciences University of California, Berkeley June 29, 2010 1 Pairs 1.1 Overview To represent data types

More information

DOING MORE WITH EXCEL: MICROSOFT OFFICE 2013

DOING MORE WITH EXCEL: MICROSOFT OFFICE 2013 DOING MORE WITH EXCEL: MICROSOFT OFFICE 2013 GETTING STARTED PAGE 02 Prerequisites What You Will Learn MORE TASKS IN MICROSOFT EXCEL PAGE 03 Cutting, Copying, and Pasting Data Basic Formulas Filling Data

More information

Discussion 4. Data Abstraction and Sequences

Discussion 4. Data Abstraction and Sequences Discussion 4 Data Abstraction and Sequences Data Abstraction: The idea of data abstraction is to conceal the representation of some data and to instead reveal a standard interface that is more aligned

More information

XP: Backup Your Important Files for Safety

XP: Backup Your Important Files for Safety XP: Backup Your Important Files for Safety X 380 / 1 Protect Your Personal Files Against Accidental Loss with XP s Backup Wizard Your computer contains a great many important files, but when it comes to

More information

Hi everyone. I hope everyone had a good Fourth of July. Today we're going to be covering graph search. Now, whenever we bring up graph algorithms, we

Hi everyone. I hope everyone had a good Fourth of July. Today we're going to be covering graph search. Now, whenever we bring up graph algorithms, we Hi everyone. I hope everyone had a good Fourth of July. Today we're going to be covering graph search. Now, whenever we bring up graph algorithms, we have to talk about the way in which we represent the

More information

Chapter 1. Getting Started

Chapter 1. Getting Started Chapter 1. Hey, Logy, whatcha doing? What s it look like I m doing. I m cleaning the windows so we can get started on our new adventure. Can t you leave the housekeeping until later. We ve got Logo work

More information

Figure 1-1. When we finish Part 2, our server will be ready to have workstations join the domain and start sharing files. Now here we go!

Figure 1-1. When we finish Part 2, our server will be ready to have workstations join the domain and start sharing files. Now here we go! 1 of 18 9/6/2008 4:05 AM Configuring Windows Server 2003 for a Small Business Network, Part 2 Written by Cortex Wednesday, 16 August 2006 Welcome to Part 2 of the "Configuring Windows Server 2003 for a

More information

Lecture #2 Kenneth W. Flynn RPI CS

Lecture #2 Kenneth W. Flynn RPI CS Outline Programming in Lisp Lecture #2 Kenneth W. Flynn RPI CS Items from last time Recursion, briefly How to run Lisp I/O, Variables and other miscellany Lists Arrays Other data structures Jin Li lij3@rpi.edu

More information

(Python) Chapter 3: Repetition

(Python) Chapter 3: Repetition (Python) Chapter 3: Repetition 3.1 while loop Motivation Using our current set of tools, repeating a simple statement many times is tedious. The only item we can currently repeat easily is printing the

More information

Quicksort. Alternative Strategies for Dividing Lists. Fundamentals of Computer Science I (CS F)

Quicksort. Alternative Strategies for Dividing Lists. Fundamentals of Computer Science I (CS F) Fundamentals of Computer Science I (CS151.01 2006F) Quicksort Summary: In a recent reading, you explored merge sort, a comparatively efficient algorithm for sorting lists or vectors. In this reading, we

More information

CS61A Notes Disc 11: Streams Streaming Along

CS61A Notes Disc 11: Streams Streaming Along CS61A Notes Disc 11: Streams Streaming Along syntax in lecture and in the book, so I will not dwell on that. Suffice it to say, streams is one of the most mysterious topics in CS61A, trust than whatever

More information

Common LISP-Introduction

Common LISP-Introduction Common LISP-Introduction 1. The primary data structure in LISP is called the s-expression (symbolic expression). There are two basic types of s-expressions: atoms and lists. 2. The LISP language is normally

More information

Outlook Web Access. In the next step, enter your address and password to gain access to your Outlook Web Access account.

Outlook Web Access. In the next step, enter your  address and password to gain access to your Outlook Web Access account. Outlook Web Access To access your mail, open Internet Explorer and type in the address http://www.scs.sk.ca/exchange as seen below. (Other browsers will work but there is some loss of functionality) In

More information

Scripting Tutorial - Lesson 2

Scripting Tutorial - Lesson 2 Home TI-Nspire Authoring TI-Nspire Scripting HQ Scripting Tutorial - Lesson 2 Scripting Tutorial - Lesson 2 Download supporting files for this tutorial Texas Instruments TI-Nspire Scripting Support Page

More information

Week - 01 Lecture - 04 Downloading and installing Python

Week - 01 Lecture - 04 Downloading and installing Python Programming, Data Structures and Algorithms in Python Prof. Madhavan Mukund Department of Computer Science and Engineering Indian Institute of Technology, Madras Week - 01 Lecture - 04 Downloading and

More information

MITOCW watch?v=0jljzrnhwoi

MITOCW watch?v=0jljzrnhwoi MITOCW watch?v=0jljzrnhwoi The following content is provided under a Creative Commons license. Your support will help MIT OpenCourseWare continue to offer high quality educational resources for free. To

More information

;;; Determines if e is a primitive by looking it up in the primitive environment. ;;; Define indentation and output routines for the output for

;;; Determines if e is a primitive by looking it up in the primitive environment. ;;; Define indentation and output routines for the output for Page 1/11 (require (lib "trace")) Allow tracing to be turned on and off (define tracing #f) Define a string to hold the error messages created during syntax checking (define error msg ""); Used for fancy

More information

Symbolic Programming. Dr. Zoran Duric () Symbolic Programming 1/ 89 August 28, / 89

Symbolic Programming. Dr. Zoran Duric () Symbolic Programming 1/ 89 August 28, / 89 Symbolic Programming Symbols: +, -, 1, 2 etc. Symbolic expressions: (+ 1 2), (+ (* 3 4) 2) Symbolic programs are programs that manipulate symbolic expressions. Symbolic manipulation: you do it all the

More information

Look at the outermost list first, evaluate each of its arguments, and use the results as arguments to the outermost operator.

Look at the outermost list first, evaluate each of its arguments, and use the results as arguments to the outermost operator. LISP NOTES #1 LISP Acronymed from List Processing, or from Lots of Irritating Silly Parentheses ;) It was developed by John MacCarthy and his group in late 1950s. Starting LISP screen shortcut or by command

More information

COMS 4115: Programming Languages and Translators. SBML: Shen Bi Ma Liang. Chinese Character: Project Proposal

COMS 4115: Programming Languages and Translators. SBML: Shen Bi Ma Liang. Chinese Character: Project Proposal COMS 4115: Programming Languages and Translators SBML: Shen Bi Ma Liang Chinese Character: English Translation: Magic Pen Boy Project Proposal Bin Liu (bl2329@columbia.edu) Yiding Cheng (yc2434@columbia.edu)

More information

EPISODE 23: HOW TO GET STARTED WITH MAILCHIMP

EPISODE 23: HOW TO GET STARTED WITH MAILCHIMP EPISODE 23: HOW TO GET STARTED WITH MAILCHIMP! 1 of! 26 HOW TO GET STARTED WITH MAILCHIMP Want to play a fun game? Every time you hear the phrase email list take a drink. You ll be passed out in no time.

More information

LOOPS. Repetition using the while statement

LOOPS. Repetition using the while statement 1 LOOPS Loops are an extremely useful feature in any programming language. They allow you to direct the computer to execute certain statements more than once. In Python, there are two kinds of loops: while

More information

MITOCW watch?v=se4p7ivcune

MITOCW watch?v=se4p7ivcune MITOCW watch?v=se4p7ivcune The following content is provided under a Creative Commons license. Your support will help MIT OpenCourseWare continue to offer high quality educational resources for free. To

More information

Lisp Basic Example Test Questions

Lisp Basic Example Test Questions 2009 November 30 Lisp Basic Example Test Questions 1. Assume the following forms have been typed into the interpreter and evaluated in the given sequence. ( defun a ( y ) ( reverse y ) ) ( setq a (1 2

More information

Perform editing operations such as erase, move, and trim on the objects in a drawing.

Perform editing operations such as erase, move, and trim on the objects in a drawing. Modifying Perform editing operations such as erase, move, and trim on the objects in a drawing. The most common of these tools are located on the Modify panel of the Home tab. Take a minute to look through

More information

Basics of Computational Geometry

Basics of Computational Geometry Basics of Computational Geometry Nadeem Mohsin October 12, 2013 1 Contents This handout covers the basic concepts of computational geometry. Rather than exhaustively covering all the algorithms, it deals

More information

Summer 2017 Discussion 10: July 25, Introduction. 2 Primitives and Define

Summer 2017 Discussion 10: July 25, Introduction. 2 Primitives and Define CS 6A Scheme Summer 207 Discussion 0: July 25, 207 Introduction In the next part of the course, we will be working with the Scheme programming language. In addition to learning how to write Scheme programs,

More information

We created a few different effects and animations using this technique as applied to clones.

We created a few different effects and animations using this technique as applied to clones. Contents Scratch Advanced: Tick technique and Clones... 1 The tick-technique!... 1 Part 1: The Game Time Loop... 1 Part 2: The setup... 2 Part 3: The sprites react to each game tick... 2 The Spinning Shape

More information

19 Machine Learning in Lisp

19 Machine Learning in Lisp 19 Machine Learning in Lisp Chapter Objectives Chapter Contents ID3 algorithm and inducing decision trees from lists of examples. A basic Lisp implementation of ID3 Demonstration on a simple credit assessment

More information

Depiction of program declaring a variable and then assigning it a value

Depiction of program declaring a variable and then assigning it a value Programming languages I have found, the easiest first computer language to learn is VBA, the macro programming language provided with Microsoft Office. All examples below, will All modern programming languages

More information

CS450: Structure of Higher Level Languages Spring 2018 Assignment 7 Due: Wednesday, April 18, 2018

CS450: Structure of Higher Level Languages Spring 2018 Assignment 7 Due: Wednesday, April 18, 2018 CS450: Structure of Higher Level Languages Spring 2018 Assignment 7 Due: Wednesday, April 18, 2018 Taken from assignments by Profs. Carl Offner and Ethan Bolker Part 1 - Modifying The Metacircular Evaluator

More information