Recalling getpoint / getxxx after changing a variable

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello to all,
I'm facing a small problem of how to go about recalling a Getxxx function once a user definable variable has been changed.
What i'd like is the first point / prompt to be called again after the scale value has been changed by the user but I'm not entirely sure how to go about this.
My "SAMPLE" code below (which only partially works).
(NOTE: this is just me playing around with "initget" as I'm still a novice with AutoLISP).
(defun c:testfunc ( / *error* *BG:scale scale ans pt1 pt6 ) (defun *error* ( msg ) (if (not (wcmatch (strcase msg t) "*break,*cancel*,*exit*")) (princ (strcat "\nError: " msg)) ) (princ) ) ;; Set up global variable & default value. (if (null *BG:scale) (setq *BG:scale 100.0) ) ;; Print current scale at command line before specifying first point. (princ (strcat "\nScale = " (rtos *BG:scale))) (initget "Scale") (setq ans (getpoint "\nSpecify first point or [Scale]: ")) (cond ( (= 'list (type ans)) (setq pt1 ans) (setq pt6 (getpoint "\nSpecify second point: ")) ) ( (= "Scale" ans) (setq scale (getdist (strcat "\nSpecify new scale factor <" (rtos *BG:scale) ">: "))) (setq *BG:scale scale) ;; Then: assign new value. (setq scale *BG:scale) ;; Else: use default value. (setq pt6 (getpoint "\nSpecify second point: ")) ) ) (entmakex (list (cons 000 "LINE") (cons 010 pt1) ;; First new point. (cons 011 pt6) ;; Second new point. ) ) (princ) )
If the user chooses to change the scale in the code above, the second point is called after entering the scale value - not what I'm after. I'd like it to recall the first point again (showing the "scale" selection option again - much like an AutoCAD function).
Any susggestions / comments would be welcome. If you do modify the code, please explain with comments whats going on, just for my understanding.
Thanks,
Bevan