(defun gp:getPointInput ()
"Function gp:getPointInput will get user drawing input"
;; For now, return T, as if the function worked correctly.
It is a good practice when creating AutoLISP programs to emulate the behavior of AutoCAD. For this reason, instead of asking the user to indicate the width by selecting a point in the drawing in respect to the centerline of a linear shape, your program should ask for a selection of the half-width.
Once the gp:getPointInput function is complete, the variables, as well as the values assigned to them, will no longer exist. Therefore, you will store user-supplied values in local variables. Here's what the function might look like:
(defun gp:getPointInput (/ StartPt EndPt HalfWidth)
(if (setq StartPt (getpoint "\nStart point of path: "))
(if (setq EndPt (getpoint StartPt "\nEndpoint of path: "))
(if (setq HalfWidth (getdist EndPt "\nhalf-width of path: "))
The local variables are declared following the slash character, in the defun statement that begins the function. The first call to getpoint prompts the user to indicate a start point. The endpoint is then acquired in relation to the chosen start point. While selecting the endpoint, the user will observe a rubber-band line extending from the start point. Similarly, while setting the half-width value, the user will view another rubber-band line, this time representing distance, emanating from the endpoint.
- Type the gp:getPointInput code into the VLISP Console window.
- With the Console window cursor following the last parenthesis of the block of code (or on the next line below it), press ENTER and you will replace any previously loaded version of the gp:getPointInput function.
- Execute the function from the Console window by entering (gp:getPointInput) at the Console prompt.
- Pick points when prompted, and enter a half-width value.