CAD Forum - tips, tricks, discussion and utilities for AutoCAD, Inventor, Revit and other Autodesk products [www.cadforum.cz] ARKANCE | CONTACT - CZ | SK | EN | DE
Over 1.096.000 registered users (EN+CZ). AutoCAD tips, Inventor tips, Revit tips. Try the new precise Engineering calculator. New AutoCAD 2026 commands and variables.

CAD tip CAD tip # 7840:

Question

CAD 
 %  platform  category 
A
Dialects of the LISP programming language are available in AutoCAD since its initial versions. AutoLISP in AutoCAD offers functions for interactive data entry, processing and access to the AutoCAD drawing database (DWG). VisualLISP (originally "Vital LISP") was added to AutoCAD in the versions R14 (as an add-on) and 2000 (integrated).

With VisualLISP you can do more than with the pure AutoLISP - you can edit, compile and debug your programs, use object (ActiveX) functions and reactors. VisualLISP contains the integrated editing and debugging environment (IDE).

An example of a typical program in AutoLISP:

(defun C:Circle2 ()
(setq pt (getpoint "\nCenter of the circle: "))
(setq r (getdist r "\nRadius: "))
(command "_CIRCLE" pt r)
(command "_CIRCLE" pt (/ r 2.0))
(prin1)
) 

To create drawing objects you can either call AutoCAD commands - (command), or directly create entities - (entmake), or use ActiveX functions (vla-add*).

With VisualLISP, .lsp programs can be compiled to .vlx and .fas files (code protection, better performance).

Before calling COM (ActiveX) objects in VisualLISP you need to load the COM support with the function (vl-load-com).

ACAD
100% *CAD
7.3.2011    13445×  
applies to: AutoCAD ·

See also:
Tip 14085:JavaScript API support in AutoCAD and AutoCAD LT.
Tip 13683:Limitations of the LISP language (AutoLISP, VisualLISP) in AutoCAD LT - what to watch out for
Tip 12701:What is the maximum length of a list in AutoCAD VisualLISP?
Tip 11914:Maze generator for AutoCAD.
Tip 10955:Evaluate VBScript functions from AutoLISP.


Back    All CAD Tips



Have we helped you? If you want to support the CAD Forum web service, consider buying one of our CAD applications, or our custom software development offerings, or donating via PayPal (see above). You may also add a link to your web - like this "fan" link: CAD Forum - tips, utilities, blocks for Autodesk products
CAD: 
OS: 
Categ: 
Text:
 FAQ
  



Featuring:
Save your floating licenses (NLS) consumed by inactive users - free unused licenses with
LogOff 2006 More info


Please use these tips at your own risk.
ARKANCE is not responsible for possible problems that may occur as a result of using any of these tips.
TOPlist