;;; ;
;;; GPMAIN.LSP ;
;;; ;
;;; Copyright 1987, 1988, 1990, 1992, 1994, 1996, 1997, 1998 ;
;;; by Autodesk, Inc. All Rights Reserved. ;
;;; ;
;;; You are hereby granted permission to use, copy and modify this ;
;;; software without charge, provided you do so exclusively for ;
;;; your own use or for use by others in your organization in the ;
;;; performance of their normal duties, and provided further that ;
;;; the above copyright notice appears in all copies and both that ;
;;; copyright notice and the limited warranty and restricted rights ;
;;; notice below appear in all supporting documentation. ;
;;; ;
;;; Incorporation of any part of this software into other software, ;
;;; except when such incorporation is exclusively for your own use ;
;;; or for use by others in your organization in the performance of ;
;;; their normal duties, is prohibited without the prior written ;
;;; consent of Autodesk, Inc. ;
;;; ;
;;; Copying, modification and distribution of this software or any ;
;;; part thereof in any form except as expressly provided herein is ;
;;; prohibited without the prior written consent of Autodesk, Inc. ;
;;; ;
;;; AUTODESK PROVIDES THIS SOFTWARE "AS IS" AND WITH ALL FAULTS. ;
;;; AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF ;
;;; MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, ;
;;; INC. DOES NOT WARRANT THAT THE OPERATION OF THE SOFTWARE ;
;;; WILL BE UNINTERRUPTED OR ERROR FREE. ;
;;; ;
;;; Restricted Rights for US Government Users. This software ;
;;; and Documentation are provided with RESTRICTED RIGHTS for US ;
;;; US Government users. Use, duplication, or disclosure by the ;
;;; Government is subject to restrictions as set forth in FAR ;
;;; 12.212 (Commercial Computer Software-Restricted Rights) and ;
;;; DFAR 227.7202 (Rights in Technical Data and Computer Software), ;
;;; as applicable. Manufacturer is Autodesk, Inc., 111 McInnis ;
;;; Parkway, San Rafael, California 94903. ;
;;; ;
;;;--------------------------------------------------------------------;
;;; This file is from the Garden Path tutorial, and represents the ;
;;; state of the application at the end of Lesson 2. Use this file ;
;;; to check your work, or to start off Lesson 3 with the code as it ;
;;; appears in the tutorial. ;
;;;--------------------------------------------------------------------;
;;;--------------------------------------------------------------------;
;;; Function: gp:getPointInput ;
;;;--------------------------------------------------------------------;
;;; Description: This function will ask the user to select three ;
;;; points in the drawing, which will determine the ;
;;; path location, direction, and size. ;
;;;--------------------------------------------------------------------;
;;; If the user responds to the get functions with valid data, ;
;;; use startPt and endPt to determine the position, length, and ;
;;; angle at which the path is drawn. ;
;;;--------------------------------------------------------------------;
;;; The return value of this function will be a list consisting of: ;
;;; (10 . Starting Point) ;; A list of 3 reals (a point) denotes ;
;;; ;; the starting point of the garden path. ;
;;; (11 . Ending Point) ;; A list of 3 reals (a point) denotes ;
;;; ;; the ending point of the garden path. ;
;;; (40 . Width) ;; A real number denoting boundary width ;
;;; (41 . Length) ;; A real number denoting boundary length ;
;;; (50 . Path Angle) ;; A real number denoting the angle of the ;
;;; ;; path, in radians ;
;;;--------------------------------------------------------------------;
(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: "))
;; if you've made it this far, build the association list
;; as documented above. This will be the return value
;; from the function.
(list
(cons 10 StartPt)
(cons 11 EndPt)
(cons 40 (* HalfWidth 2.0))
(cons 50 (angle StartPt EndPt))
(cons 41 (distance StartPt EndPt))
)
)
)
)
)
;;;--------------------------------------------------------------------;
;;; Function: gp:getDialogInput ;
;;;--------------------------------------------------------------------;
;;; Description: This function will ask the user to determine the ;
;;; following path parameters: ;
;;; Tile size, Tile spacing ;
;;; Boundary polyline type ;
;;; Entity creation method ;
;;;--------------------------------------------------------------------;
(defun gp:getDialogInput ()
(alert
"Function gp:getDialogInput will get user choices via a dialog"
)
;; For now, return T, as if every task in the function worked correctly
T
) ;_ end of defun
;;;--------------------------------------------------------------------;
;;; Function: gp:drawOutline ;
;;;--------------------------------------------------------------------;
;;; Description: This function will draw the outline of the garden ;
;;; path. ;
;;;--------------------------------------------------------------------;
(defun gp:drawOutline ()
(alert
(strcat "This function will draw the outline of the polyline "
"\nand return a polyline entity name/pointer."
) ;_ end of strcat
) ;_ end of alert
;; For now, simply return a quoted symbol. Eventually, this function
;; will return an entity name or pointer
'SomeEname
) ;_ end of defun
;;;********************************************************************;
;;; Function: C:GPath The Main Garden Path Function ;
;;;--------------------------------------------------------------------;
;;; Description: This is the main garden path function. It is a C: ;
;;; function, meaning that it is turned into an AutoCAD ;
;;; command called GPATH. This function determines the ;
;;; overall flow of the Garden Path program ;
;;;********************************************************************;
;;; The gp_PathData variable is an association list of the form: ;
;;; (10 . Starting Point) -- A list of 3 reals (a point) denotes ;
;;; the starting point of the garden path ;
;;; (11 . Ending Point) -- A list of 3 reals (a point) denotes ;
;;; the ending point of the garden path ;
;;; (40 . Width) -- A real number denoting boundary width ;
;;; (41 . Length) -- A real number denoting boundary length ;
;;; (50 . Path Angle) -- A real number denoting the angle of the ;
;;; path, in radians ;
;;; (42 . Tile Size) -- A real number denoting the size ;
;;; (radius) of the garden path tiles ;
;;; (43 . Tile Offset) -- Spacing of tiles, border to border ;
;;; ( 3 . Object Creation Style) ;
;;; -- The object creation style indicates how ;
;;; the tiles are to be drawn. The ;
;;; expected value is a string and one ;
;;; one of three values (string case is :
;;; unimportant): ;
;;; "ActiveX" ;
;;; "Entmake" ;
;;; "Command" ;
;;; ( 4 . Polyline Border Style) ;
;;; -- The polyline border style determines ;
;;; the polyline type to be used for the ;
;;; path boundary. The expected value ;
;;; one of three values (string case is :
;;; unimportant): ;
;;; "Pline" ;
;;; "Light" ;
;;;********************************************************************;
(defun C:GPath (/ gp_PathData PolylineName)
;; 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 (gp:getDialogInput)
(progn
;; At this point, you have valid input from the user.
;; Draw the outline, storing the resulting polyline "pointer"
;; in the variable called PolylineName
(setq PolylineName (gp:drawOutline))
(princ "\nThe gp:drawOutline function returned (princ PolylineName)
(princ ">")
(Alert "Congratulations - your program is complete!")
) ;_ 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
;;; Display a message to let the user know the command name
(princ "\nType GPATH to draw a garden path.")
(princ)