In Lesson 6, you hooked up callback function gp:command-will-start to the reactor event :vlr-commandWillStart. As it currently exists, the function displays some messages and initializes two global variables, *polyToChange* and *reactorsToRemove*, to nil.
;; Reset all four reactor globals to nil. (setq *lostAssociativity* nil *polyToChange* nil *reactorsToChange* nil *reactorsToRemove* nil)
(if (member (setq currentCommandName (car command-list)) '( "U" "UNDO" "STRETCH" "MOVE" "ROTATE" "SCALE" "BREAK" "GRIP_MOVE" "GRIP_ROTATE" "GRIP_SCALE" "GRIP_MIRROR") ) ;_ end of member (progn (setq *lostAssociativity* T) (princ "\nNOTE: The ") (princ currentCommandName) (princ " command will break a path's associativity .") ) ;_ end of progn ) ;_ end of if
This code checks to see if the user issued a command that breaks the associativity between the tiles and the path. If the user issued such a command, the program sets the *lostAssociativity* global variable and warns the user.
As you experiment with the garden path application, you may discover additional editing commands that can modify the garden path and cause the loss of associativity. Add these commands to the quoted list so that the user is aware of what will happen. When this function fires, the user has started a command but has not selected any entities to modify. The user could still cancel the command, leaving things unchanged.