(defun c:Erase_All_Lines_Simple ()
(Alert "This command will Automatically Erase All Lines within the drawing.")
(ssget "x" '((0 . "LINE")))
(initcommandversion 2)
(command "erase" "p" "")
(Alert "All lines are now Erased from this drawing.")
(princ))
(defun c:Erase_All_Lines_Advanced ()
(ssget "x" '((0 . "LINE")))
(initcommandversion 2)
(command "erase" "p" "")
(princ))
Command: Erase_All_Lines
User Command Mode [Basic/Advance]<Basic>:A
User Mode set to: Advance
Command:
Command: Erase_All_Lines
User Command Mode [Basic/Advance]<Basic>:*Cancel* <<--- This would change to Advanced instead of <Basic>?
; error: Function cancelled
Command:
(defun C:Erase_All_Lines ()
(initget "Advance Basic")
(if (setq rep (getkword "\nUser Command Mode [Basic/Advance]<Basic>:"))
(Progn
(setenv "Mode" rep)
(prompt (strcat "User Mode set to: " rep))
)
(progn
(setenv "Mode" "Basic")
(prompt "\nUser Mode set to: Basic")
)
)
(c:Erase_All_Lines_Main_Program)
(princ)
)
(defun c:Erase_All_Lines_Main_Program ()
(or (setq rep (getenv "Mode")) (setq rep "Basic")) ;this will default to Basic if CMD-Mode hasn't been run yet.
(if (eq rep "Basic")
(Alert "This command will Automatically Erase All Lines within the drawing.")
)
(if (setq ss (ssget "X" '((0 . "LINE") (410 . "Model"))))
(foreach line (vl-remove-if 'listp (mapcar 'cadr (ssnamex SS)))
(entdel line)
)
)
(if (eq rep "Basic")
(Alert "All lines are now Erased from this drawing.
\nUse \"Advanced\" to disable these prompts")
)
(princ)
)
Would there be a way to have the prompt at the command line show and remember the option that was shown?
User Command Mode [Basic/Advance]<Basic>:*Cancel* <<--- This would change to Advanced instead of <Basic>?
..but i cannot seem to get the lines to erase for the little demo.
(if (not AH:Butts)(load "Multi Radio buttons.lsp"))
(if (= but nil)(setq but 1))
(setq ans (ah:butts but "h" '("Advanced or Basic " "Basic" "advanced"))) ; ans holds the button picked value