AutoLISP Developer's Guide
Documentation Home
Introduction
AutoLISP and Visual LISP
What Visual LISP Offers
Working with Visual LISP and AutoCAD
Using Visual LISP Documentation
Related Documents
Using the Visual LISP Environment
Getting Started
Starting Visual LISP
Exploring the Visual LISP User Interface
Introducing the Visual LISP Text Editor
Other Visual LISP Windows
Touring the Visual LISP Menus
Variable Menu Contents
Visual LISP Menu Summary
Understanding the Console Window
Understanding the Visual LISP Text Editor
Loading and Running AutoLISP Programs
Running Selected Lines of Code
Using Extended AutoLISP Functions
Exiting Visual LISP
Developing Programs with Visual LISP
Getting Organized
Using the Console Window
Understanding Console Behavior
Using the Console Window History
Interrupting Commands and Clearing the Console Input Area
Using the Console Window with Multiple Drawings
Using the Console Shortcut Menu
Logging Console Window Activity
Using the Text Editor
Editing a File
Undoing Your Last Change
Creating Automatic Backup Files
Restoring from a Backup File
Editing an Existing File
Using the Text Editor Shortcut Menu
Using Keyboard Shortcuts in the Text Editor
Correcting Text
Selecting Text
Navigation Shortcuts
Indenting Shortcuts
Moving and Copying Text
Searching for Text
Choosing Search Options
Repeating an Earlier Search
Replacing Text
Bookmarking Text
Using Console and Editor Coding Aids
Understanding Visual LISP Color Coding
Using the Apropos Feature
Using the Results of an Apropos Search
Letting Visual LISP Help You Complete Words
Completing a Word by Matching
Completing a Word by Apropos
Getting Help for AutoLISP Functions
Formatting Code with Visual LISP
Understanding Visual LISP Formatting Styles
Plane Style
Wide Style
Narrow Style
Column Style
Applying Formatting Options
Close Parenthesis Style
Insert Form-Closing Comment
Preserve Existing Line Breaks
Split Comments
Long List Format Style
Setting Case for Symbols
Applying Visual LISP Comment Styles
Saving and Restoring Formatting Options
Formatter Restrictions
Formatting Shortcut Keys
Checking for Syntax Errors
Checking the Balance of Parentheses
Using Color Coding to Detect Syntax Errors
Using the Check Command to Look for Syntax Errors
Finding the Location of the Syntax Error in Your Program
Debugging Programs
Introducing Visual LISP Debugging Features
Learning by Example
Stepping through the Debugging Example
Setting a Breakpoint to Interrupt Program Execution
Stepping through the Program
Monitoring the Evaluation Results of an Expression
Continuing Program Execution
Running in Animate Mode
Using the Visual LISP Debugging Features
Starting a Debugging Session
Understanding Break Loops
Continuable Break Loops
Non-Continuable Break Loops
Using Breakpoints
Changing Breakpoint Highlight Colors
Disabling Breakpoints Temporarily
Listing and Viewing the Breakpoints in Your Program
Life Cycle of a Breakpoint
Using Visual LISP Data Inspection Tools
Using the Watch Window
Using the Watch Toolbar
Using the Watch Item Shortcut Menu
Understanding the Trace Stack Window
Stack Element Lists
Viewing the Current Trace Stack
Displaying Information on a Trace Stack Element
Using the Frame Binding Window
Understanding Keyword Frames
Understanding Special Function Call Frames
Viewing an Error Trace Stack
Using the Symbol Service Dialog Box
Using the Symbol Service Toolbar
Understanding Symbol Flags
Using Inspect Windows
Using the Inspect Window
Understanding Object Element List Formats
Common Inspect Commands
Copying Inspect Objects to the *obj* IDE Global Variable
Handling Errors in the Inspect Command
Closing All Inspect Windows
Viewing AutoCAD Drawing Entities
Viewing Entities in the Drawing Database
Viewing Symbol Tables in the Drawing Database
Viewing Blocks in the Drawing Database
Viewing Selected Objects in a Drawing
Viewing Extended Data
Building Applications
Compiling and Linking Programs
Using the Compiler
Compiling a Program from a File
Choosing a Compiler Mode
Identifying the Input File
Naming an Output File
Walking through a Compile Example
Loading and Running Compiled Programs
Loading Extended AutoLISP Functions
Linking Function Calls
Making Application Modules
Creating a New Application
Understanding the Output from Make Application
Loading and Running Visual LISP Applicationsbuilding applications:making application modules:loading and running VLISP applications
Changing Application Options
Rebuilding an Application
Updating an Application
Designing for a Multiple Document Environment
Understanding Namespaces
Running an Application in Its Own Namespace
Accessing External ObjectARX Functions from a Separate-Namespace VLX
Making Functions Available to Documents
Making Separate-Namespace Functions Available to Other VLX Applications
Referencing Variables in Document Namespaces
Sharing Data Between Namespaces
Handling Errors in an MDI Environment
Handling Errors in a VLX Application Running in Its Own Namespace
Limitations on Using AutoLISP in an MDI Environment
Maintaining Visual LISP Applications
Managing Multiple LISP Files
Understanding Visual LISP Projects
LISP, FAS, and Other File Types
Defining a Project
Assigning Project Properties
Selecting the Files to Include in a Project
Identifying the Path Name of Project Files
Changing the Order in Which Visual LISP Loads Files
Choosing Compiler Build Options
Using the Project Window to Work with Project Files
Selecting Multiple Project Members
Loading Project Files
Compiling and Recompiling Project Files
Editing Project Files
Saving and Closing the Projectclosing:projects
Working with Existing Projects
Opening a Project
Finding a String in Project Source Files
Including a Project in a Visual LISP Application
Optimizing Application Code
Defining Build Options
Choosing a Compilation Mode
Analyzing for Optimization Correctness
Choosing a Link Mode
Understanding Safe Optimization
Optimization Conditions Bypassed by Safe Optimization
Safe Optimization Warning Messages
Compiler Checking of Optimizing Conditions
Working with ActiveX
Using ActiveX Objects with AutoLISP
Understanding the AutoCAD Object Model
Object Properties
Object Methods
Collections of Objects
Accessing AutoCAD Objects
Using the Inspect Tool to View Object Properties
Moving Forward from the Application Object
Summarizing the Process
Performance Considerations
Using Visual LISP Functions with ActiveX Methods
Determining the Visual LISP Function You Need
Determining How to Call a Function
Converting AutoLISP Data Types to ActiveX Data Types
Working with Variants
Working with Safearrays
Using Safearrays with Variants
Converting Other AutoLISP Data Types for ActiveX Methods
Viewing and Updating Object Properties
Reading Object Properties
Updating Object Properties
Determining Whether an Object Is Available for Updating
Using ActiveX Methods That Return Values in Arguments
Listing an Object's Properties and Methods
Determining If a Method or Property Applies to an Object
Working with Collection Objects
Retrieving Member Objects in a Collection
Releasing Objects and Freeing Memory
Converting Object References
Converting between Enames and VLA-objects
Obtaining One Object Identifier from Another
Handling Errors Returned by ActiveX Methods
Using ActiveX to Interact with Other Applications
Importing a Type Library
Coding Hints for Using vlax-import-type-library
Establishing a Connection to an Application
Coding a Sample Application
Using ActiveX without Importing a Type Library
Calling an ActiveX Method with vlax-invoke-methodvlax-invoke-method functioncalling ActiveX methodsActiveX:methodsActiveX:interacting with other applications:calling ActiveX methods with vlax-invoke-method
Obtaining an ActiveX Property with vlax-get-property
Updating an ActiveX Property with vlax-put-property
Advanced Topics
Attaching Reactors to AutoCAD Drawings
Understanding Reactor Types and Events
Reactor Callback Events
Defining Callback Functions
Defining Object Reactor Callback Functions
Creating Reactors
Using Object Reactors
Attaching Data to Reactor Objects
Working with Reactors in Multiple Namespaces
Querying, Modifying, and Removing Reactors
Inspecting Reactors
Querying Reactors Using Function Calls
Modifying Reactors
Removing Reactors
Transient versus Persistent Reactors
Opening a Drawing Containing Persistent Reactors
Reactor Use Guidelines
Using the AutoLISP Language
AutoLISP Basics
AutoLISP Expressions
AutoLISP Function Syntax
AutoLISP Data Types
Integers
Reals
Strings
Lists
Selection Sets
Entity Names
VLA-objects
File Descriptors
Symbols and Variables
Protected Symbols
AutoLISP Program Files
Formatting AutoLISP Code
Spaces in AutoLISP Code
Comments in AutoLISP Program Files
Visual LISP Comment Styles
Color Coding
AutoLISP Variables
Displaying the Value of a Variable
Nil Variables
Predefined Variables
Number Handling
String Handling
Basic Output Functions
Displaying Messages
Exiting Quietly
Control Characters in Strings
Wild-Card Matching
Equality and Conditional
List Handling
Point Lists
Dotted Pairs
Symbol and Function Handling
Using defun to Define a Function
Compatibility of defun with Previous Versions of AutoCAD
C:XXX Functions
Adding Commands
Redefining AutoCAD Commands
Local Variables in Functions
Local Variables versus Global Variables
Example Using Local Variables
Functions with Arguments
Special Forms
Error Handling in AutoLISP
Using the *error* Function
Catching Errors and Continuing Program Execution
Using AutoLISP to Communicate with AutoCAD
Accessing Commands and Services
Command Submission
Foreign Language Support
Pausing for User Input
Passing Pick Points to AutoCAD Commands
Undoing Commands Issued with the command Function
System and Environment Variables
Configuration Control
Display Control
Controlling Menus
Control of Graphics and Text Windows
Control of Low-Level Graphics
Getting User Input
The getxxx Functions
Control of User-Input Function Conditions
Input Options for User-Input Functions
Keyword Options
Arbitrary Keyboard Input
Input Validation
Geometric Utilities
Object Snap
Text Extents
Conversions
String Conversions
Angular Conversion
ASCII Code Conversion
Unit Conversion
Converting from Inches to Meters
The Unit Definition File
Coordinate System Transformations
Point Transformations
File Handling
File Search
Accessing Drawing Properties
Accessing Help Files
Device Access and Control
Accessing User Input
Calibrating Tablets
Using AutoLISP to Manipulate AutoCAD Objects
Selection Set Handling
Selection Set Filter Lists
Wild-Card Patterns in Filter Lists
Filtering for Extended Data
Relational Tests
Logical Grouping of Filter Tests
Selection Set Manipulation
Passing Selection Sets between AutoLISP and ObjectARX Applications
Object Handling
Entity Name Functions
Entity Handles and Their Uses
Entity Context and Coordinate Transform Data
Entity Access Functions
Entity Data Functions
Deleting an Entity
Obtaining Entity Information
Modifying an Entity
Adding an Entity to a Drawing
Creating Complex Entities
Working with Blocks
Anonymous Blocks
Entity Data Functions and the Graphics Screen
Old-Style Polylines and Lightweight Polylines
Processing Curve-Fit and Spline-Fit Polylines
Non-Graphic Object Handling
Symbol Table Objects
Dictionary Objects
Extended Data - xdata
Organization of Extended Data
Registration of an Application
Retrieval of Extended Data
Attachment of Extended Data to an Entity
Management of Extended Data Memory Use
Handles in Extended Data
Xrecord Objects
Symbol Table and Dictionary Access
Symbol Tables
Dictionary Entries
Accessing AutoCAD Groups
Working with Programmable Dialog Boxes
Designing Dialog Boxes
Dialog Box Components
Using DCL to Define Dialog Boxes
The base.dcl and acad.dcl Files
Referencing DCL Files
DCL Syntax
Tile Definitions
Tile References
Attributes and Attribute Values
Comments in DCL Files
Displaying Dialog Boxes with Visual LISP
Preview Error Handling
Semantic Auditing of DCL Files
Adjusting the Layout of Dialog Boxes
Distributing Tiles in a Cluster
Adjusting the Space between Tiles
Adjusting Space at the Right Side or Bottom
Fixing the Spacing Around a Boxed Row or Column
Customizing Exit Button Text
Design Guidelines
Aesthetics and Ergonomics
Consistent Design and Clear Language
User Control
Forgiving Errors
Providing Help
Users with Disabilities
Using Capitalization
Avoiding Abbreviations
Layout
Size and Placement
Disabling Tiles
Nesting Dialog Boxes
Closing a Dialog Box for User Selection
Providing Defaults
Handling Keyboard Input
International Language Considerations
Guidelines for Predefined Tiles and Clusters
Buttons
Clusters
Edit Boxes
Image Buttons and Image Tiles
List Boxes
Radio Buttons, Radio Rows, and Radio Columns
Sliders
Text
Toggles
Error Handling in Dialog Boxes
Error Tiles
Alert Boxes
Managing Dialog Boxes
Controlling Dialog Boxes with AutoLISP Programs
Quick Overview
Functions Restricted When a Dialog Box Is Open
Action Expressions and Callbacks
Action Expressions
Callback Reasons
Default and DCL Actions
Handling Tiles
Initializing Modes and Values
Changing Modes and Values at Callback Time
Handling Radio Clusters
Handling Sliders
Handling Edit Boxes
Nesting Dialog Boxes
Functions for Hiding Dialog Boxes
Requesting a Password
List Boxes and Pop-Up Lists
List Operations
Processing List Elements
Image Tiles and Buttons
Creating Images
Handling Image Buttons
Application-Specific Data
DCL Error Handling
Setting the Auditing Level to Affect Error Messages
Dialog Box Function Summary
Function Sequence
The Sample Block Definition Dialog Box
Programmable Dialog Box Reference
Tile Attributes
Attribute Types
Restricted Attributes
User-Defined Attributes
Synopsis of Predefined Attributes
DCL Attribute Catalog
action
alignment
allow_accept
aspect_ratio
big_increment
children_alignment
children_fixed_height
children_fixed_width
color
edit_limit
edit_width
fixed_height
fixed_width
fixed_width_font
height
initial_focus
is_bold
is_cancel
is_default
is_enabled
is_tab_stop
key
label
layout
list
max_value
min_value
mnemonic
multiple_select
password_char
small_increment
tabs
tab_truncate
value
width
Functional Synopsis of DCL Tiles
Predefined Active Tiles
Tile Clusters
Decorative and Informative Tiles
Text Clusters
Dialog Box Exit Buttons and Error Tiles
Restricted Tiles
DCL Tile Catalog
boxed_column
boxed_radio_column
boxed_radio_row
boxed_row
button
column
concatenation
dialog
edit_box
errtile
image
image_button
list_box
ok_only
ok_cancel
ok_cancel_help
ok_cancel_help_errtile
ok_cancel_help_info
paragraph
popup_list
radio_button
radio_column
radio_row
row
slider
text
text_part
toggle
spacer
spacer_0
spacer_1
Programmable Dialog Box Function Synopsis
Dialog Box Opening and Closing Functions
Tile- and Attribute-Handling Functions
List Box and Pop-Up List-Handling Functions
Image Tile-Handling Functions
Application-Specific Data-Handling Function
Appendixes
AutoLISP Function Synopsis
Category Summary
Basic Functions
Application-Handling Functions
Arithmetic Functions
Equality and Conditional Functions
Error-Handling Functions
Function-Handling Functions
List Manipulation Functions
String-Handling Functions
Symbol-Handling Functions
Utility Functions
Conversion Functions
Device Access Functions
Display Control Functions
File-Handling Functions
Geometric Functions
Query and Command Functions
User Input Functions
Selection Set, Object, and Symbol Table Functions
Extended Data-Handling Functions
Object-Handling Functions
Selection Set Manipulation Functions
Symbol Table and Dictionary-Handling Functions
Memory Management Functions
Visual LISP Extensions to AutoLISP
ActiveX Collection Manipulation Functions
ActiveX Data Conversion Functions
ActiveX Method Invocation Functions
ActiveX Object-Handling Functions
ActiveX Property-Handling Functions
Curve Measurement FunctionsAutoLISP:curve measurement functionsAutoLISP:Visual LISP extended functions:curve measurement functions
Dictionary Functions
Functions for Handling Drawing Objects
Reactor Functions
VLX Namespace Functions
Namespace Communication Functions
Windows Registry Functions
Visual LISP Environment and Formatting Options
Window Attributes Options
Syntax Coloring
Configure Current
Set Current Window to Prototype
Set All Windows to Prototype
Font
Environment Options
General Options Dialog Box
General Tab (General Options Dialog Box)
Diagnostic Tab (General Options Dialog Box)
Visual LISP Format Options
Base Formatting Options in the Format Options Dialog Box
Additional Formatting Options in the Format Options Dialog Box
Page Format Options in the Page Setup Dialog Box
Justification and Substitution Codes in the Page Setup Dialog Box
Save Settings (Tools Menu)
AutoLISP Error Codes
Error Codes
Documentation Home