📄 gpreact.lsp
字号:
;; Store the reactor assigned to this entity to the global
;; *reactorsToRemove* so that it can be removed later
(setq *reactorsToRemove*
(append *reactorsToRemove* (list reactor))
) ;_ end of setq
;; Print to the console to see the results of the incoming data
(terpri)
(princ
(list 'gp:outline-erased outlinePoly reactor parameterList)
) ;_ end of princ
(terpri)
(princ (setq reactorData (vlr-data reactor)))
(alert
(strcat
(format-reactor-message 'gp:outline-erased)
"\nThis reactor-callback function's responsibility will be to:\n"
"\n\tBuild upon a list that records pointers to any reactors for"
"\n\tany polyline or polylines being erased by the user. This is "
"\n\tdone so the reactors can be removed once the erase command "
"\n\thas ended."
) ;_ end of strcat
) ;_ end of alert
(princ)
) ;_ end of defun
;;;--------------------------------------------------------------------;
;;; Function: gp:outline-changed ;
;;;--------------------------------------------------------------------;
;;; Description: This reactor function is fired if the path outline ;
;;; is changed. If this happens we need to: ;
;;; 1) Erase the tiles ;
;;; 2) Remove the tile information from the reactor ;
;;; data (information stored to the reactor) ;
;;; 3) Save a pointer to the polyline for further ;
;;; processing when the command-ended reactor ;
;;; fires. ;
;;;--------------------------------------------------------------------;
;;; THIS FUNCTION IS CURRENTLY IN A STUBBED-OUT STATE!!! ;
;;;--------------------------------------------------------------------;
(defun gp:outline-changed
(outlinePoly reactor parameterList / tile tiles reactorData)
;; Set up the global variable that stores the pointer to the
;; polyline (as described in the description above)
(setq *polyToChange* outlinePoly)
;; Print to the console to see the results of the incoming data
(terpri)
(princ
(list 'gp:outline-changed outlinePoly reactor parameterList)
) ;_ end of princ
(terpri)
(princ (setq reactorData (vlr-data reactor)))
(alert
(strcat
(format-reactor-message 'gp:outline-changed)
"\n\tThis reactor-callback function's responsibility will be to:\n"
"\n\tAct upon the notification that the outline has been modified."
"\n\tAssociated Actions:"
"\n\t\t1. Erase the tiles"
"\n\t\t2. Remove any associativity to field 100"
"\n\t\t (the field that holds a list of tile objects)"
"\n\t\t3. Save the Reactor and Polyline for further processing"
"\n\t\t once the command now in progress has ended."
) ;_ end of strcat
) ;_ end of alert
(princ)
) ;_ end of defun
;;;--------------------------------------------------------------------;
;;; Function: gp:command-ended ;
;;;--------------------------------------------------------------------;
;;; Description: This reactor function is called at the end of any ;
;;; command. ;
;;;--------------------------------------------------------------------;
;;; This is where the majority of work is done. Once the command ;
;;; that the user is performing has ended, we can get to work. (We ;
;;; cannot modify entities while they are being modified by AutoCAD ;
;;; itself, so we have to wait until we get a notification that the ;
;;; command in progress is complete, and we can have access to the ;
;;; entities.) ;
;;;--------------------------------------------------------------------;
;;; THIS FUNCTION IS CURRENTLY IN A STUBBED-OUT STATE!!! ;
;;;--------------------------------------------------------------------;
(defun gp:command-ended (reactor command-list)
;; Print to the console to see the results of the incoming data
(terpri)
(princ (list 'gp:command-ended reactor command-list))
(terpri)
(if *polyToChange*
(progn
(princ "\nPolyline being modified is ")
(princ *polyToChange*)
) ;_ end of progn
) ;_ end of if
(if *reactorsToRemove*
(progn
(princ "\nReactors that need to be removed: ")
(princ *reactorsToRemove*)
) ;_ end of progn
) ;_ end of if
(terpri)
(princ (setq reactorData (vlr-data reactor)))
(alert
(strcat
(format-reactor-message 'gp:command-ended)
"\nThis reactor-callback function's responsibility will be to:\n"
"\n\tNote what AutoCAD command has ended and respond accordingly."
"\n\tAssociated Actions:"
"\n\t\t1. If the polyline has been erased, remove associated reactors"
"\n\t\t2. If the associatvity has been lost, then erase application"
"\n\t\t data from the reactor."
"\n\t\t3. If the outline has not lost associativity and has been "
"\n\t\t stretched using Grips, then straighten it up."
) ;_ end of strcat
) ;_ end of alert
(princ)
) ;_ end of defun
;;;--------------------------------------------------------------------;
;;; Function: format-reactor-message ;
;;;--------------------------------------------------------------------;
;;; Description: This is a temporary function used to format the ;
;;; messages that appear in the stubbed-out reactor ;
;;; callback function alerts. ;
;;; It uses the vl-symbol-name function to convert the ;
;;; reactorFunction symbol into a string, and returns ;
;;; this as a formatted message presentable for the ;
;;; alert dialog box. ;
;;;--------------------------------------------------------------------;
(defun format-reactor-message (reactorFunction)
(strcat "****************************| Callback function: "
(vl-symbol-name reactorFunction)
" |***************************\n"
) ;_ end of strcat
) ;_ end of defun
;;;--------------------------------------------------------------------;
;;; Function: gp:clean-all-reactors ;
;;;--------------------------------------------------------------------;
;;; Description: Used to clean all reactors before exiting AutoCAD. ;
;;; This is a Very Important Function! ;
;;;--------------------------------------------------------------------;
(defun gp:clean-all-reactors (reactor command-list)
(terpri)
(princ (list 'gp:clean-all-reactors reactor command-list))
(terpri)
(princ (setq reactorData (vlr-data reactor)))
(terpri)
(princ (list command-list " has been issued"))
(cleanReactors)
) ;_ end of defun
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -