Perhaps?
- (defun c:ReON (/ tmp str i) (or *nth (setq *nth 0)) (setq *dim_table* '( ;; ;; Layers . Styles ("DIM_LAYER1" . "DIM_STYL1") ("DIM_LAYER2" . "DIM_STYL2") ("DIM_LAYER3" . "DIM_STYL3") ;; ))(vl-load-com) (setq *doc (vla-get-ActiveDocument (vlax-get-acad-object))) (if (not *Dim:React*) (progn (setq *Dim:React* (vlr-command-reactor nil (list (cons :vlr-CommandWillStart 'StrComm) (cons :vlr-CommandEnded 'EndComm) (cons :vlr-CommandCancelled 'CanComm)))) (foreach x *dim_table* (if (not (tblsearch "LAYER" (car x))) (vla-add (vla-get-layers *doc) (car x))) (if (not (tblsearch "DIMSTYLE" (cdr x))) (vla-add (vla-get-Dimstyles *doc) (cdr x)))) (princ "\n"))) (setq i 1 str (strcat (itoa i) (chr 46) (cdar *dim_table*))) (foreach x (cdr *dim_table*) (setq i (1+ i) str (strcat str (chr 32) (itoa i) (chr 46) (cdr x)))) (initget (+ 2 4)) (or (not (setq tmp (getint (strcat "\nSpecify Config: " str " : ")))) (setq *nth (1- tmp))) (princ))(defun StrComm (React Args / pos) (setq old#lay (getvar "CLAYER") old#sty (getvar "DIMSTYLE")) (if (or (wcmatch (strcase (car Args)) "*DIM*") (eq "QLEADER" (strcase (car Args)))) (progn (setq pos (nth *nth *dim_table*)) (vl-catch-all-apply (function (lambda ( ) (vla-put-ActiveDimstyle *doc (vla-item (vla-get-Dimstyles *doc) (cdr pos)))))) (setvar "CLAYER" (car pos)))) (princ))(defun EndComm (React Args) (if (and old#lay old#sty (wcmatch (strcase (car Args)) "DIM*")) (progn (vl-catch-all-apply (function (lambda ( ) (vla-put-ActiveDimstyle *doc (vla-item (vla-get-Dimstyles *doc) old#sty))))) (setvar "CLAYER" old#lay))) (princ))(defun CanComm (React Args) (if (and old#lay old#sty (wcmatch (strcase (car Args)) "DIM*")) (progn (vl-catch-all-apply (function (lambda ( ) (vla-put-ActiveDimstyle *doc (vla-item (vla-get-Dimstyles *doc) old#sty))))) (setvar "CLAYER" old#lay))) (princ))(defun c:ReOFF (/ old#lay old#sty *doc *nth *dim_table*) (if *Dim:React* (progn (vlr-remove *Dim:React*) (setq *Dim:React* nil) (princ "\n"))) (princ))
|