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

Similar documents
Mastering the Visual LISP Integrated Development Environment

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

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

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

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

Good Habits for Coding in Visual LISP

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

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

AutoLISP Productivity Power

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

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

Beyond AutoLISP Basics

ntroduction Topics in this section Working in Visual LISP Tutorial Overview Please send us your comment about this page

Chapter 28 Beyond AutoLISP Basics. Learning Objectives

Blockbusters: Unleashing the Power of Dynamic Blocks Revealed!

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

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

The Anglemaker Program

Migration Made Easy! Speaker: Bud Schroeder, Autodesk Inc.

Lisp Basic Example Test Questions

AutoLISP Tricks for CAD Managers Speaker: Robert Green

Lambda Calculus and Lambda notation in Lisp II. Based on Prof. Gotshalks notes on Lambda Calculus and Chapter 9 in Wilensky.

Lisp. Versions of LISP

Chapter 29 Introduction to Dialog Control Language (DCL)

Code::Blocks Student Manual

Vanilla Lisp Shell (VLS)

Microsoft Office Excel 2007: Basic. Course Overview. Course Length: 1 Day. Course Overview

Gene Kim 9/9/2016 CSC 2/444 Lisp Tutorial

Documentation for LISP in BASIC

Permission to copy The CAD Academy

AutoLISP for CAD Managers Robert Green Robert Green Consulting Group

Lecture Notes on Lisp A Brief Introduction

VBScript: Math Functions

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

Modern Programming Languages. Lecture LISP Programming Language An Introduction

Scheme procedures can be used with the Scheme AIDE demonstration application or any other Scheme based application.

Recursion & Iteration

Productivity Tools Objectives

Code::Blocks Student Manual

Debugging in LISP. trace causes a trace to be printed for a function when it is called

TestOut Desktop Pro Plus - English 4.x.x. MOS Instructor Guide. Revised

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

The AutoLISP Platform for Computer Aided Design

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

ECDL Full Course Content

An Overview of VBA in AutoCAD 2006

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

COMPUTERIZED OFFICE SUPPORT PROGRAM

Microsoft Excel 2010 Level 1

Functional programming with Common Lisp

Las Vegas, Nevada, December 3 6, Speaker Name: Heidi Hewett. Course ID:

Functional Programming. Pure Functional Programming

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

5. Control Statements

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

Microsoft Office Excel 2010: Basic. Course Overview. Course Length: 1 Day. Course Overview

AutoLISP Module 6 Competency Test No.1

Flow of Control: Loops

Daylighting design project zone 2E: Genzyme Reception Nicole Vlado & James Forren

Streams, Delayed Evaluation and a Normal Order Interpreter. CS 550 Programming Languages Jeremy Johnson

Integrating Microsoft Access with AutoCAD VBA dave espinosa-aguilar Toxic Frog Multimedia

entity tomove over backward forward character C-b C-f word M-b M-f line C-p C-n go to line beginning (or end) C-a C-e sentence M-a M-e paragraph M- M-

Mapping Specification for DWG/DXF (MSD) AutoLISP Code Samples

Robert Green Robert Green Consulting

Excel 2007 Tutorials - Video File Attributes

CS251 Programming Languages Handout # 47 Prof. Lyn Turbak May 22, 2005 Wellesley College. Scheme

WebIntelligence. Creating Documents

Making Your Word Documents Accessible

Script... Programming for Dummies. R. Yoshi Honda. What are Script files (.scr)

Migrate Legacy Word Documentation into MadCap Flare. Matthew Ellison

Teacher Activity: page 1/9 Mathematical Expressions in Microsoft Word

Midterm Examination (Sample Solutions), Cmput 325

(defmacro while (condition &body body) `(iterate loop () (if,condition (loop)))))

Outline. Writing Functions and Subs. Review Immediate (1-line) Errors. Quiz Two on Thursday (2/23) Same Code Without Option Explicit

The New Office 2007 Interface and Shared Features

Project 2: Scheme Interpreter

Introduction to LISP. York University Department of Computer Science and Engineering. York University- CSE V.

Fundamentals of ADS. Environment: Windows /Visual C++ Introduction

Productivity Tools Objectives 1

The American University in Cairo. Academic Computing Services. Excel prepared by. Maha Amer

Introduction to Lisp

Strands & Standards COMPUTER TECHNOLOGY 2

CS 480. Lisp J. Kosecka George Mason University. Lisp Slides

The ABC's of the AutoCAD CUI

Excel 2010 Tutorials - Video File Attributes

Data Mining in Autocad with Data Extraction

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

PowerPoint 2002 Manual

Learning Map Excel 2007

Excel Tutorials - File Size & Duration

Bricscad V VLE LISP Function Summary

Excel Programming with VBA (Macro Programming) 24 hours Getting Started

download instant at

Imperative, OO and Functional Languages A C program is

Texting Gone Wild: Advanced Annotation Tips and Tricks for Fabrication CADmep

Sample Final Exam Questions

Nomas Training. Course Outlines

OpenOffice.org Writer

User-defined Functions. Conditional Expressions in Scheme

Drawing an Integrated Circuit Chip

Transcription:

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 the Visual LISP IDE in AutoCAD 2000 added some powerful tools for the Visual LISP (AutoLISP ) programmer. The VLIDE is not simply a pretty text editor with parenthesis checking, although that feature alone is of great benefit. Would you like to understand the other benefits the VLIDE delivers? This course will explain the following features: Programming Aids o Console o Inspect feature o Trace command and window o Symbol Service feature o Apropos feature o Project feature o Application Wizard Debugging Tools o Break on Error o Watch o Breakpoints/Stepping o Animate Formatting Options o Expression styles o Closing paren styles o List styles o Comment styles o Miscellaneous options

Mastering the Visual LISP Integrated Development Environment (IDE) Here is the code that will be used during the class: ; Trace.lsp v1.0 Demonstrates the Trace function. To be run from the console. (trace I:Double) (Test) View the trace window. (untrace I:Double) ; (defun I:Double (Number) (* Number 2)) (defun Test (/ Number) (setq Number 1) (repeat 10 (setq Number (I:Double Number))) (princ)) ; Symbol.lsp v1.0 Demonstrates changing a variable's value using the Symbol Service. Run the function once from the console. (Test 2) Observe the return value. Place a breakpoint at the beginning of the expression (* 2 inpnum). Run the function again. (Test 2) When you reach the breakpoint, use the Symbol Service to change inpnum to 4. ; (defun Test (inpnum) (* 2 inpnum)) The following code will be used to demonstrate the Project feature. ; EntSelF.lsp from AcadX.com ; (defun I:EntSelF (Msg ; selection prompt Filter ; filter list / EntN ; (entsel) list pbdist ; pickbox size in drawing units PtPick ; point of selection from (entsel) sspick) ; selection set (setvar "ErrNo" 0) ; clear ErrNo for loop (while (and (not (setq EntN (if Msg ; if selection prompt www.autodesk.com 2

Mastering the Visual LISP Integrated Development Environment (IDE) (entsel Msg) ; then (entsel) w/prompt (entsel)))) ; while no selection (or no exit) (/= 52 (getvar "ErrNo")))) ; if null response (cond (EntN ; if not exit (setq pbdist (abs ; return absolute number, get pixel ratio (/ (* (/ (getvar "PickBox") (cadr (getvar "ScreenSize"))) (getvar "ViewSize")) ; apply to viewsize (in units) (sin (* 0.25 pi)))) ; at 45 PtPick (cadr EntN)) ; get point of pick (if (setq sspick (ssget "_C" ; if entities in crossing (polar PtPick (* 1.25 pi) pbdist) ; lower left (polar PtPick (* 0.25 pi) pbdist) ; upper right Filter)) ; match filter, if any (cons (ssname sspick 0) (list PtPick)))))) ; then return first entity as (entsel) ; AttGet.lsp from AcadX.com ; (defun I:AttGet (Ent AttTag / DxfVal ; entity type Done) ; flag to exit loop (while (not Done) ; loop until done (cond ((and (= "ATTRIB" (setq DxfVal (cdr (assoc 0 Ent)))) ; if sub-entity is an attdef (= (cdr (assoc 2 Ent)) AttTag)) ; and matching attribute (setq Done T)) ; then exit loop ((= "SEQEND" DxfVal) ; if at end of block's entities (setq Done T ; then exit loop Ent nil))) ; clear entity data (if (not Done) ; if not done (setq Ent (entget (entnext (cdr (assoc -1 Ent))))))) ; then get next entity Ent) ; return entity data ; Sheet.lsp Displays the value of the Sheet# attribute. ; (defun C:Sheet (/ eblk eatt) (setq eblk (I:EntSelF "\nselect titleblock: " ; get titleblock '((2. "Title Block")))) ; filter for specific name (cond (eblk ; if titleblock selected (setq eatt (I:AttGet (entget (car eblk)) "SHEET#")) ; get value of Sheet# (alert (strcat "Sheet number: " (cdr (assoc 1 eatt)))))) ; display value (princ)) ; clean exit www.autodesk.com 3

Mastering the Visual LISP Integrated Development Environment (IDE) The following code is used to demonstrate the 5 commenting styles. ; Comment.lsp v1.0 Return the active document's name. Used to demonstrate the 5 commenting styles. ; (defun C:Test () ;;; returns a string (vla-get-name ; get name (vla-get-activedocument ;; ThisDrawing (vlax-get-acad-object)))) ;_ closes defun www.autodesk.com 4

Mastering the Visual LISP Integrated Development Environment (IDE) Speaker s Name: R. Robert Bell Course ID: CP42-1 Course Outline: This course will explain many of the features, tools, and options in the VLIDE. The student will have a better understanding of how the VLIDE is useful. Expectations You will learn about the VLIDE: Programming aids. Debugging tools. Formatting options. Who Is R. Robert Bell? Network Administrator for MW Consulting Engineers (A/E/C) since 1988. Writing code since 1983. AutoLISP since AutoCAD v2.5 Visual LISP since 1999 AUGI VBA Guild Moderator and self-admitted Autodesk newsgroup junkie. Member of AcadX.com, helping you customize AutoCAD. Image courtesy of Berke Breathed

Now, About You How many wrote most of their code in AutoLISP? What text editor did you use? How many have written lots of AutoLISP code since AutoCAD 2000, and are comfortable with the VLIDE? How many program in other languages, such as VB(A)? Programming Features of the VLIDE Console Inspect feature Trace command and window Symbol Service feature Apropos feature Project feature Application Wizard The Console Perform expressions Examine variables Recall previous actions with <Tab> Clear the window

The Inspect Feature Examine variables (usually during a breakpoint). Expression results. Copy object to *obj*. Drill-down for more information. The Trace Command and Window (trace func) (untrace func) Many prefer watches and breakpoints. (vl-bt), for the diehards. (defun *Error* (Err) (if (not (member Err '("console break" "Function cancelled" "quit / exit abort"))) (vl-bt)) (princ)) The Symbol Service Feature Permits you to see/change the value of a symbol. Add the symbol to the Watch Window. If the symbol is a USUBR, you can use Show Definition to display the code.

The Apropos Feature Searches the symbol table. Even sees symbols that are local to functions. Match by prefix option. Use WCMatch style filtering. Use the help button to see the help file for SUBRs. The Project Feature Use to manage the files for an application. Files are loaded in the order listed. Assign compile options for the project (FAS files). The Application Wizard The wizard makes compiling a Visual LISP application easy. The defaults are usually sufficient for average applications. Note: Contrary to documentation, VBA projects are not accessible.

Debugging Tools of the VLIDE Break on Error Watch Breakpoints/Stepping Animate The Watch Window You can watch: The value of a variable. The result of an expression. The last value/result. Using Breakpoints You may set breakpoints wherever you want. Use the <F9> key, or the toolbar button. Show the last break source. Debug on Entry into a function by Symbol Service. You may also deactivate breakpoints, instead of simply removing them.

Manually Stepping Thru Your Code Stepping is active when: Errors occur and Break on Error is set. Reaching an enabled breakpoint. Step options: Step into. Step over. Step out. Continue. Reset. Quit. The Animate Feature This will run your code, lineby-line, at a specified interval. Understanding the Formatting Options You may modify the options so that your code is formatted the way you like (in most cases). It is possible to format your code with the touch of a button.

Plane Style (for Expressions) (I:AttGet Ent AttTag) All the arguments are on the same line. All the arguments are separated by a single space. Affected by: Right Text Margin. Printing length must be less than Approximate Line Length. Wide Style (for Expressions) (I:AttGet Ent AttTag) First argument on the same line. Remaining arguments lined up below. Affected by: 1 st element (I:AttGet above) must be a SYM. Maximum Wide-Style Car Length for the SYM. Narrow Style (for Expressions) (I:AttGet Ent AttTag) All arguments on a new line. Affected by: Narrow Style Indentation determines number of spaces for the indent.

Column Style (for Expressions) (cond (test1 ; code ;) (test2 ; code ;) (test3 ; code ;)) All elements are positioned in a column. You will see this on quoted lists and (cond) expressions. Close At the Same Line Pros: Results in compact code. Cons: Must rely on paren checker to determine nesting. Moves argument/local variable parens right 1 space. (defun C:Test () (vla-get-name (vla-get-activedocument (vlax-get-acad-object)))) Close With Inner Indentation (defun C:Test () (vla-get-name (vla-get-activedocument (vlax-get-acad-object) Pros: ) Helps to see nesting level. ) ) Cons: Opening/closing parens do not line up. Unnecessarily long code.

Close With Outer Indentation Pros: Helps to see nesting level. Opening/closing parens line up. Cons: Unnecessarily long code. (defun C:Test () (vla-get-name (vla-get-activedocument (vlax-get-acad-object) ) ) ) Insert Form-Closing Comment (defun C:Test () (vla-get-name (vla-get-activedocument (vlax-get-acad-object) ) ;_ closes vla-get-activedocument ) ;_ closes vla-get-name ) ;_ closes defun Automatically adds a comment to lonely closing parens. Does not change if the statement is changed. Lots of deleting if you want to clean them up. Additional Format Options Preserve existing line breaks only if you love your current format. Split comments if your comments exceed right margin. Many like to force protected symbols to lowercase.

Long List Format Options Single-column (setq alist '(123 456 789 123 456 789 123 456 789)) 2-column (setq alist '(123 456 789 123 456 789 123 456 789)) Multi-column (setq alist '(123 456 789 123 456 789 123 456 789)) Fill-to-margin (setq alist '(123 456 789 123 456 789 123 456 789)) Page Setup Options (for Printing) Don t limit the amount of code that you can print on a page! Adjust your margins. Alter your font to a smaller size if you are only documenting. Header & footer codes are well documented. Window Attributes (Syntax Color) Top row of colors is the foreground color. Bottom row is the background color.

Syntax Colors Spaces String Symbols Integer Real Non-inline comments Inline comments Parens Unknown Variable/arguments Selected text Enabled breakpoints Disabled breakpoints Error messages in Build Output The 5 Commenting Styles ; Comment.lsp v1.0 Return the active document's name. ; (defun C:Test () ;;; returns a string (vla-get-name ; get name (vla-get-activedocument ;; ThisDrawing (vlax-get-acad-object)))) ;_ closes defun Wrap-up The VLIDE provides many features Programming aids Console Inspect Apropos Debugging tools Watch Breakpoints/Stepping Formatting options Close at the same line Multiple commenting styles

Questions Thank You Thank you for attending this course! Please don t forget to fill out the evaluation forms. Course name: Mastering the Visual LISP Integrated Development Environment (IDE) Course number: CP42-1 My Name: R. Robert Bell