Learning AutoLISP & Visual LISP

Learning AutoLISP & Visual LISP

2h 20mIntermediate2017-03-10

Authors

Josh Modglin

Josh Modglin

Technical Consultant

Course details

Due to its relative simplicity and historical integration within the AutoCAD environment, LISP is a natural first programming language for CAD managers. In this course, Josh Modglin walks through the fundamentals of LISP for AutoCAD, so that you can start using this language to simplify tedious tasks and ease the implementation of standardization. Josh explains what LISP is, the differences between AutoLISP and Visual LISP, how to write it, as well as how to create objects and store information that you can use later. Plus, throughout the course, he shares coding best practices that can help you work efficiently with this functional language.

Learning objectives
Reviewing LISP formatting
Creating a defined function
Getting and setting variables
Using an if condition function
Using a cond condition function
Working with strings and lists
Getting data from users
Working with loops, selection sets, and geometry
Creating and editing graphic entities
Reviewing Visual LISP director functions
Reading and writing to the registry
Loading LISP files
Error trapping

Skills covered

Architectural DesignAutoCAD2D Drafting and DrawingBIMAutodesk3D ModelingVisualization and Real-TimeAECProduct and ManufacturingAnimation and Illustration

Concepts

Introduction

  • Welcome
  • Exercise files

LISP Formatting

  • History
  • Visual LISP IDE

LISP Functionality

  • Creating a defined function
  • Creating and using variables
  • Getting and setting variables
  • Using an if condition function
  • Using a cond condition function

Visual LISP Introduction

  • Function - vl-Load-Com
  • Function - vlax-get-acad-object
  • Function - vla-get-preferences
  • Function - vla-get-activedocument
  • Function and command - vl-cmdf

Working with Strings

  • Function - strcase
  • Function - strcat
  • Function - strlen
  • Function - substr
  • Visual LISP methods

Working with Lists

  • List and dotted pairs overview
  • Functions - nth and length
  • CDR, CAR, CADR, and more
  • Function - append
  • Function - subst
  • Visual LISP methods

Getting Data From Users

  • Function - getstring
  • Function - getpoint
  • Function - getdist
  • Function - getreal
  • Functions - getkword and initget
  • Functions - entsel and entget
  • Funtion - getfiled

Loops

  • Function - while
  • Function - repeat
  • Function - foreach

Selection Sets

  • Function - ssget
  • Functions - sslength and ssname
  • Selection set filters

Working with Geometry

  • Function - polar
  • Function - angle
  • Function - distance
  • Function - inters

Creating and Editing Graphic Entities

  • Functions - assoc and subst
  • Function - subst
  • Function - entmod
  • Function - entmake
  • Function - entdel
  • Visual LISP entity functions

Creating and Editing Non-Graphic Entities

  • Function - tblsearch
  • Function - tblobjname
  • Visual LISP methods

Storing Data

  • Function - namedobjdict
  • Visual LISP dictionary functions
  • Reading and writing to the registry

Loading LISPs and Error Trapping

  • Loading a LISP file
  • Using acad.lsp and acaddoc.lsp
  • Error trapping

Conclusion

  • Next steps
80,000 Toman