📄 gpreact.lsp
字号:
;;; ;
;;; GPREACT.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 6. Use this file ;
;;; to check your work, or to start off Lesson 7 with the code as it ;
;;; appears in the tutorial. ;
;;;--------------------------------------------------------------------;
;;;--------------------------------------------------------------------;
;;; General Notes: ;
;;;--------------------------------------------------------------------;
;;; After the execution of these reactor functions, you might ;
;;; experience difficulty in returning to Visual Lisp. If this does ;
;;; happen, type VLide at the AutoCAD command prompt and focus will ;
;;; be returned to Visual Lisp. ;
;;;--------------------------------------------------------------------;
;;; There are three types of reactors which we will be using: ;
;;; 1. an object reactor ;
;;; 2. a command reactor ;
;;; 3. a drawing reactor ;
;;; We will define two functions that will notify us when the user ;
;;; has modified or changed the garden path. ;
;;;--------------------------------------------------------------------;
;;; Object Reactor ;
;;;----------------------|---------------------|-----------------------;
;;; Event |Function to call | Description ;
;;;----------------------|---------------------|-----------------------;
;;; :vlr-modified |gp:outline-changed | Function called ;
;;; | | when object declared ;
;;; | | in owners is modified ;
;;;----------------------|---------------------|-----------------------;
;;; :vlr-erased |gp:outline-erased | Function called ;
;;; | | when object is erased ;
;;;----------------------|---------------------|-----------------------;
;;; ;
;;; Command Reactor ;
;;;----------------------|---------------------|-----------------------;
;;; Event |Function to call | Description ;
;;;----------------------|---------------------|-----------------------;
;;; :vlr-commandWillStart|gp:command-will-start| Function called when ;
;;; | | a command is typed ;
;;; | | at the command prompt ;
;;;----------------------|---------------------|-----------------------;
;;; :vlr-commandEnded |gp:command-ended | Function called when ;
;;; | | a command has ended ;
;;;----------------------|---------------------|-----------------------;
;;; ;
;;; Drawing Reactor ;
;;;----------------------|---------------------|-----------------------;
;;; Event |Function to call | Description ;
;;;----------------------|---------------------|-----------------------;
;;; :vlr-beginClose |gp:clean-all-reactors| Function to clean all ;
;;; | | existing reactors ;
;;; | | before ACAD exits ;
;;;--------------------------------------------------------------------;
;;; Since reactor events occur in sequence (commandWillStart occuring ;
;;; before the object modified reactor, for example), we need a few ;
;;; global variables to keep track of what changes are occuring to the ;
;;; path. The following globals are used: ;
;;; *polyToChange* ;
;;; *reactorsToRemove* ;
;;;--------------------------------------------------------------------;
;;;--------------------------------------------------------------------;
;;; Function: gp:command-will-start ;
;;;--------------------------------------------------------------------;
;;; Description: This is a reactor to any command starting ;
;;;--------------------------------------------------------------------;
;;; This is the function where we figure out what *will* be happening ;
;;; to the garden path (not what *is* happening). Reset the global ;
;;; variables *polyToChange* and *reactorsToRemove* so that ;
;;; subsequent reactor events will perform the correct actions. ;
;;; (This is necessary since this function may be called more than ;
;;; once, and the *polyToChange* pointer could be pointing to a ;
;;; polyline other than the one the user just selected for editing!) ;
;;; Also, reset the *reactorsToRemove* global, for the same reason. ;
;;;--------------------------------------------------------------------;
;;; THIS FUNCTION IS CURRENTLY IN A STUBBED-OUT STATE!!! ;
;;;--------------------------------------------------------------------;
(defun gp:command-will-start (reactor command-list)
;; Reset the global variable
(setq *polyToChange* nil
*reactorsToRemove* nil
) ;_ end of setq
;; Print to the console to see the results of the incoming data
(terpri)
(princ (list 'gp:command-will-start reactor command-list))
(terpri)
(princ (setq reactorData (vlr-data reactor)))
(alert
(strcat
(format-reactor-message 'gp:command-will-start)
"\n\tThis reactor-callback function's responsibility will be to:\n"
"\n\tReset any of the global variables used within reactor functions"
"\n\tto an initial nil state. It will also note what AutoCAD command"
"\n\thas been issued and respond accordingly.\n"
"\n\tAssociated Actions:"
"\n\tIf a U, UNDO, STRETCH, MOVE, ROTATE, or SCALE command is being"
"\n\tstarted, break the associativity between the tiles and the "
"\n\tpolyline boundary."
) ;_ end of strcat
) ;_ end of alert
(princ)
) ;_ end of defun
;;;--------------------------------------------------------------------;
;;; Function: gp:outline-erased ;
;;;--------------------------------------------------------------------;
;;; Description: This reactor function is triggered when the path ;
;;; outline is being erased. If this happens, we need to;
;;; 1) Erase all of the tiles (the user is taking ;
;;; care of the rest of the work) ;
;;; 2) Set a global variable that stores the ;
;;; reactor assigned to this polyline, so that ;
;;; it can be removed when command-ended fires ;
;;;--------------------------------------------------------------------;
;;; THIS FUNCTION IS CURRENTLY IN A STUBBED-OUT STATE!!! ;
;;;--------------------------------------------------------------------;
(defun gp:outline-erased (outlinePoly reactor parameterList)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -