AUGIWorld Magazine November/December 2007 - (Page 20) AutoCAD Get Your Input Here AutoLISP® routines are great for automating repetitive tasks and creating new commands that allow you to streamline the dayto-day design workflow. Many of the tasks that you perform each day, while similar, probably vary slightly by project or drawing. To allow your AutoLISP routines to work for multiple tasks you need to be able to request input from the user. When you request input, you can ask for points, strings, and even numeric values. This article provides an overview for many of the different methods that you can use to get information from the user. You will learn to get points, distances, angles, strings, and numbers, pause for input, and learn how to handle dialog boxes. or by picking points in the drawing to calculate a distance between the two coordinates. Having the user specify points and enter coordinate values is one method of getting input with the GETDIST function, but the user can also enter a number. The GETDIST function works similar to the DIST command in AutoCAD. (setq DST (getdist “\nEnter a distance or pick two points: “)) Getangle and Getorient The GETANGLE and GETORIENT functions allow you to obtain an angle value instead of a distance or point value. When GETANGLE and GETORIENT are used, the user can enter an angle value or specify two coordinate values to calculate the angle between them. The difference between GETORIENT and GETANGLE is that GETORIENT is affected by the system variables ANGBASE and ANGDIR, whereas GETANGLE is only affected by the system variable ANGBASE. Like the GETPOINT function, you can optionally specify a base point and message to the user. (getangle “\nEnter an angle: “) Getting to the point When working with commands in AutoCAD® you typically will find yourself needing to provide a point in the drawing to start the creation of an object or to calculate an angle or distance. AutoLISP offers five different functions that allow you to get point, angle, or distance values; these functions are a subset of the Get* function family. Getpoint and Getcorner The GETPOINT function allows you to request a coordinate value by having the user enter it at the command prompt or by picking a point in the drawing. The GETPOINT function allows you the option of providing a message to the user and also allows you to specify a base point from which to specify the next point. Unlike GETPOINT, GETCORNER requires the use of a base point but the message to the user is still optional. The GETCORNER function allows you to specify the opposite corner from the base point, similar to drawing a rectangle or performing a crossing/window selection. (setq PT1 (getpoint “\nPick base point: “)) (setq PT2 (getcorner PT1 “\nPick opposite corner: “)) Note: The angle returned is always in radians, so in most cases you will need to convert it to decimal degrees. The expression (* (/ rad PI) 180) is what I use to convert radians to degrees; just replace rad with the angle in radians you want to convert or assign the value returned by GETANGLE or GETORIENT to the variable rad. More than just points Getting input from a user goes beyond just requesting coordinate points, distances, and angles. With some of the Get* functions you can get text strings, numeric values that are whole or decimal numbers, and keywords. Getdist The GETDIST function allows you to request a pair of coordinate values by having the user enter them at the command prompt 20 Getstring Text strings are used for a number of different things in AutoCAD from block names to attribute values to values that are simply used for table cells or text objects. The GETSTRING w w w. A U G I . c o m http://www.AUGI.com
Table of Contents Feed for the Digital Edition of AUGIWorld Magazine November/December 2007 AUGIWorld Magazine November/December 2007 Table of Contents The CAD Manager Education & Training Finance Training Google Earth: Now Showing in AutoCAD Civil 3D Get Your Input Here A Good First Impression, Part 2 Share and Share Alike Who's Using Revit MEP? Ready… Get Set… Properties! On the Back Page: The Brazilian Model AUGIWorld Magazine November/December 2007 AUGIWorld Magazine November/December 2007 - AUGIWorld Magazine November/December 2007 (Page Cover1) AUGIWorld Magazine November/December 2007 - AUGIWorld Magazine November/December 2007 (Page Cover2) AUGIWorld Magazine November/December 2007 - AUGIWorld Magazine November/December 2007 (Page 1) AUGIWorld Magazine November/December 2007 - Table of Contents (Page 2) AUGIWorld Magazine November/December 2007 - Table of Contents (Page 3) AUGIWorld Magazine November/December 2007 - The CAD Manager (Page 4) AUGIWorld Magazine November/December 2007 - The CAD Manager (Page 5) AUGIWorld Magazine November/December 2007 - Education & Training (Page 6) AUGIWorld Magazine November/December 2007 - Education & Training (Page 7) AUGIWorld Magazine November/December 2007 - Education & Training (Page 8) AUGIWorld Magazine November/December 2007 - Education & Training (Page 9) AUGIWorld Magazine November/December 2007 - Finance Training (Page 10) AUGIWorld Magazine November/December 2007 - Finance Training (Page 11) AUGIWorld Magazine November/December 2007 - Finance Training (Page 12) AUGIWorld Magazine November/December 2007 - Finance Training (Page 13) AUGIWorld Magazine November/December 2007 - Finance Training (Page 14) AUGIWorld Magazine November/December 2007 - Finance Training (Page 15) AUGIWorld Magazine November/December 2007 - Finance Training (Page 16) AUGIWorld Magazine November/December 2007 - Finance Training (Page 17) AUGIWorld Magazine November/December 2007 - Google Earth: Now Showing in AutoCAD Civil 3D (Page 18) AUGIWorld Magazine November/December 2007 - Google Earth: Now Showing in AutoCAD Civil 3D (Page 19) AUGIWorld Magazine November/December 2007 - Get Your Input Here (Page 20) AUGIWorld Magazine November/December 2007 - Get Your Input Here (Page 21) AUGIWorld Magazine November/December 2007 - Get Your Input Here (Page 22) AUGIWorld Magazine November/December 2007 - Get Your Input Here (Page 23) AUGIWorld Magazine November/December 2007 - A Good First Impression, Part 2 (Page 24) AUGIWorld Magazine November/December 2007 - A Good First Impression, Part 2 (Page 25) AUGIWorld Magazine November/December 2007 - A Good First Impression, Part 2 (Page 26) AUGIWorld Magazine November/December 2007 - A Good First Impression, Part 2 (Page 27) AUGIWorld Magazine November/December 2007 - Share and Share Alike (Page 28) AUGIWorld Magazine November/December 2007 - Share and Share Alike (Page 29) AUGIWorld Magazine November/December 2007 - Who's Using Revit MEP? (Page 30) AUGIWorld Magazine November/December 2007 - Who's Using Revit MEP? (Page 31) AUGIWorld Magazine November/December 2007 - Who's Using Revit MEP? (Page 32) AUGIWorld Magazine November/December 2007 - Who's Using Revit MEP? (Page 33) AUGIWorld Magazine November/December 2007 - Who's Using Revit MEP? (Page 34) AUGIWorld Magazine November/December 2007 - Who's Using Revit MEP? (Page 35) AUGIWorld Magazine November/December 2007 - Ready… Get Set… Properties! (Page 36) AUGIWorld Magazine November/December 2007 - Ready… Get Set… Properties! (Page 37) AUGIWorld Magazine November/December 2007 - Ready… Get Set… Properties! (Page 38) AUGIWorld Magazine November/December 2007 - Ready… Get Set… Properties! (Page 39) AUGIWorld Magazine November/December 2007 - Ready… Get Set… Properties! (Page 40) AUGIWorld Magazine November/December 2007 - Ready… Get Set… Properties! (Page 41) AUGIWorld Magazine November/December 2007 - Ready… Get Set… Properties! (Page 42) AUGIWorld Magazine November/December 2007 - Ready… Get Set… Properties! (Page 43) AUGIWorld Magazine November/December 2007 - On the Back Page: The Brazilian Model (Page 44) AUGIWorld Magazine November/December 2007 - On the Back Page: The Brazilian Model (Page Cover3) AUGIWorld Magazine November/December 2007 - On the Back Page: The Brazilian Model (Page Cover4)
For optimal viewing of this digital publication, please enable JavaScript and then refresh the page. If you would like to try to load the digital publication without using Flash Player detection, please click here.