Archive for the ‘Architectural Design’ Category
This useful AutoCAD article is written by Barry R Bowen. If you like his writing please feel free to subscribe to his articles with link found below.
AutoLISP was first implemented in AutoCAD v2.15, in the form of "Variables and Expressions." There are many ways to increase your productivity when using AutoCAD and writing your own AutoLISP programs can be an easy one to implement. This feature, built right inside AutoCAD, offers an amazing amount of utility without requiring any programming experience.
Variables and expressions provide the ability to create parametric menu macros and scripts. This article will discuss some of the AutoLISP expressions and how they can be used at the AutoCAD command line.
All AutoLISP expressions are enclosed in parentheses. A valid expression must begin with an open parenthesis and every open parenthesis must be balanced by a closing parenthesis. Otherwise, the AutoCAD LISP interpreter (that portion of AutoCAD that evaluates and executes the AutoLISP functions) will respond with an error message. If you ever see the response "1>" or "(_>" after trying an AutoLISP expression, AutoCAD is telling you that you omitted one or more closing parenthesis.
At its simplest, you can perform addition, subtraction, multiplication, and division using simple numbers and arithmetic operators directly from the AutoCAD command line:
Command: (+ 1 2 3)
6
Command: (* 2.5 2)
5.000000
Command: (+ (* 3 2) 4)
10
In AutoLISP, the operator precedes the values being operated upon, much like Reverse notation of the early Hewlett Packard calculators. Notice also that AutoLISP evaluates from the innermost parentheses outward. You can use an AutoLISP expression to provide the response in the middle of an AutoCAD Command prompt:
Command: CIRCLE
Specify center point for circle or [3P/2P/Ttr (tan tan radius)]: 5,5
Specify radius of circle or [Diameter]: (/ 10.0 2.0)
In the beginning, these examples might not appear very useful, but AutoLISP is a powerful programming language built within AutoCAD, that brings supercomputer power to your drafting needs. With AutoLISP any repetitive task can usually be automated to reduce time or improve accuracy.
Barry R Bowen has been an AutoCAD user since the first version arrived on the scene. Barry has written AutoLISP programming articles for CADalyst and Cadence magazines and has been an AutoCAD/AutoLISP instructor in the continuing education programs at Memphis State University and State Technical Institute in Memphis.
Barry is the Vice Chief Manager of SoftDraft LLC which has been an AutoCAD Registered Application Developer for over twelve years. SoftDraft, LLC develops low cost Architectural/Engineering/Construction software applications for 2D and 3D, which work inside all versions of AutoCAD®. Most software applications feature an intuitive graphical user dialog interface, which results in a short learning curve and no expensive training classes to attend.
http://softdraft.info/autolisp/
Article Source: http://EzineArticles.com/?expert=Barry_R_Bowen




