- Has the defun statement changed? That is, does the function still take the same number of arguments?
- Does the function return something different?
In the case of gp:getDialogInput, the answer to both questions is yes. The function now accepts the parameter of the path width (to set the default tile size and spacing). And instead of returning T, which is the value the stubbed-out version of the function returned, gp:getDialogInput now returns an association list containing four new values.
Both changes affect the code that calls the function and the code that handles the return values from the functions. Replace your previous version of the C:GPath function in gpmain.lsp with the following code:
(defun C:GPath (/ gp_PathData gp_dialogResults)
;; Ask the user for input: first for path location and
;; direction, then for path parameters. Continue only if you
;; have valid input. Store the data in gp_PathData.
(if (setq gp_PathData (gp:getPointInput))
(if (setq gp_dialogResults (gp:getDialogInput (cdr(assoc 40
;; Now take the results of gp:getPointInput and append this
;; to the added information supplied by gp:getDialogInput.
(setq gp_PathData (append gp_PathData gp_DialogResults))
;; At this point, you have all the input from the user.
;; Draw the outline, storing the resulting polyline
;; "pointer" in the variable called PolylineName.
(setq PolylineName (gp:drawOutline gp_PathData))
) ;_ end of progn
(princ "\nFunction cancelled.")
) ;_ end of if
(princ "\nIncomplete information to draw a boundary.")
) ;_ end of if
(princ) ; exit quietly
) ;_ end of defun
- When the gp:getDialogInput function is invoked, the path width is passed to it. This is done by extracting the value associated with the key 40 index of the gp_PathData association list.
- The association list returned by gp:getPointInput is assigned to a variable called gp_dialogResults. If this variable has a value, its content needs to be appended to the association list values already stored in gp_PathData.
There are additional changes in the code resulting from the replacement of placeholders in the stubbed-out version. The easiest thing to do is copy this code from the online tutorial and paste it into your file.