rdx Posted August 8 Posted August 8 Dear All, Which is Better Method to switch the view please give the suggestion.. (vl-load-com) (defun c:VRS (/ fname fn x dclid lin) (setq fname (vl-filename-mktemp nil nil ".dcl")) (setq fn (open fname "w")) (foreach x '(" agtckz : dialog{" " label=\"View Management\";" " :row {" " :column{" " :button{key=\"1\";label=\"Save 1\";width=6;}" " :button{key=\"2\";label=\"Save 2\";width=6;}" " :button{key=\"3\";label=\"Save 3\";width=6;}" " :button{key=\"4\";label=\"Save 4\";width=6;}" " :button{key=\"5\";label=\"Save 5\";width=6;}" " :button{key=\"6\";label=\"Save 6\";width=6;}" " :button{key=\"7\";label=\"Save 7\";width=6;}" " :button{key=\"8\";label=\"Save 8\";width=6;}" " }" " :column{" " :button{key=\"9\";label=\"Show 1\";width=6;}" " :button{key=\"10\";label=\"Show 2\";width=6;}" " :button{key=\"11\";label=\"Show 3\";width=6;}" " :button{key=\"12\";label=\"Show 4\";width=6;}" " :button{key=\"13\";label=\"Show 5\";width=6;}" " :button{key=\"14\";label=\"Show 6\";width=6;}" " :button{key=\"15\";label=\"Show 7\";width=6;}" " :button{key=\"16\";label=\"Show 8\";width=6;}" " }" " }" " ok_cancel;" "}" ) ;end ;endlist (princ x fn) (write-line "" fn) ) ;end foreach (close fn) (setq fn (open fname "r")) (setq dclid (load_dialog fname)) (while (or (eq (substr (setq lin (vl-string-right-trim "\" fn)" (vl-string-left-trim "(write-line \"" (read-line fn) ) ) ) 1 2 ) "//" ) (eq (substr lin 1 (vl-string-search " " lin)) "") (not (eq (substr lin (+ (vl-string-search " " lin) 1) 9) " : dialog")) ) ) (new_dialog (substr lin 1 (vl-string-search " " lin)) dclid) (action_tile "1" "(done_dialog 1)") (action_tile "2" "(done_dialog 2)") (action_tile "3" "(done_dialog 3)") (action_tile "4" "(done_dialog 4)") (action_tile "5" "(done_dialog 5)") (action_tile "6" "(done_dialog 6)") (action_tile "7" "(done_dialog 7)") (action_tile "8" "(done_dialog 8)") (action_tile "9" "(done_dialog 9)") (action_tile "10" "(done_dialog 10)") (action_tile "11" "(done_dialog 11)") (action_tile "12" "(done_dialog 12)") (action_tile "13" "(done_dialog 13)") (action_tile "14" "(done_dialog 14)") (action_tile "15" "(done_dialog 15)") (action_tile "16" "(done_dialog 16)") (action_tile "cancel" "(done_dialog 0)") (setq re (start_dialog)) (cond ((= re 1) (c:v-1)) ((= re 2) (c:v-2)) ((= re 3) (c:v-3)) ((= re 4) (c:v-4)) ((= re 5) (c:v-5)) ((= re 6) (c:v-6)) ((= re 7) (c:v-7)) ((= re 8) (c:v-8)) ((= re 9) (c:R-1)) ((= re 10) (c:R-2)) ((= re 11) (c:R-3)) ((= re 12) (c:R-4)) ((= re 13) (c:R-5)) ((= re 14) (c:R-6)) ((= re 15) (c:R-7)) ((= re 16) (c:R-8)) ) ;end cond (unload_dialog dclid) (close fn) (vl-file-delete fname) (princ) );end defun ;;; WHICH ONE IS BEST ---------------------------------- (defun c:v-1 () (command "-view" "D" "s1") (command "-view" "S" "S1") (princ) ) (defun c:r-1 () (command "-view" "R" "S1") (princ) ) (defun c:v-2 () (command "-view" "D" "s2") (command "-view" "S" "S2") (princ) ) (defun c:r-2 () (command "-view" "R" "S2") (princ) ) (defun c:v-3 () (command "-view" "D" "s3") (command "-view" "S" "S3") (princ) ) (defun c:r-3 () (command "-view" "R" "S3") (princ) ) (defun c:v-4 () (command "-view" "D" "s4") (command "-view" "S" "S4") (princ) ) (defun c:r-4 () (command "-view" "R" "S4") (princ) ) (defun c:v-5 () (command "-view" "D" "s5") (command "-view" "S" "S5") (princ) ) (defun c:r-5 () (command "-view" "R" "S5") (princ) ) (defun c:v-6 () (command "-view" "D" "s6") (command "-view" "S" "S6") (princ) ) (defun c:r-6 () (command "-view" "R" "S6") (princ) ) (defun c:v-7 () (command "-view" "D" "s7") (command "-view" "S" "S7") (princ) ) (defun c:r-7 () (command "-view" "R" "S7") (princ) ) (defun c:v-8 () (command "-view" "D" "s8") (command "-view" "S" "S8") (princ) ) (defun c:r-8 () (command "-view" "R" "S8") (princ) ) OR ;;; Save View 1 (defun c:v-1 () (if (= 0 (setq *SK_1_tilemode* (getvar "tilemode"))) ;Record the current view state (setq *SK_1_cvport* (getvar "cvport")) ;Record the current view state ) (if (tblobjname "view" "S1") ;Find View S1 (command "-view" "D" "S1") ;Delete view S1 ) (command "-view" "S" "S1") ;Save View S1 (princ) ) ;;; Restore View 1 (defun c:r-1 () (if (= 1 *SK_1_tilemode*) (setvar "tilemode" 1) (progn (setvar "tilemode" 0) (setvar "cvport" *SK_1_cvport*) ) ) (command "-view" "R" "S1") ;Restore view S1 (princ) ) Quote
mhupp Posted August 9 Posted August 9 Quote ;;; WHICH ONE IS BEST ---------------------------------- Use variables to save current view location rather than command line. Don't have to delete the old view to save new location, won't have output to the command line and its faster. (defun C:V1 () (setq vc (getvar 'viewctr)) (setq sz (getvar 'viewsize)) (prompt "\nView Saved") ) (defun C:R1 () (vl-load-com) (setq Drawing (vla-get-activedocument (vlax-get-acad-object)))) (vla-zoomcenter Drawing VC SZ) (princ) ) This is another lisp I have that Zoom to the same place across multiple drawings. ;;----------------------------------------------------------------------------;; ;; Zoom Area Across Multiple Drawings (defun C:ZAD (/ a) (initget "Yes No") (setq a (cond ((getkword "\nRedefine Zoom Area? [Yes/No]: ")) ("No") ) ) (if (= "Yes" a) (progn (vl-cmdf "_.Zoom" "W" Pause Pause) (setq vc (getvar 'viewctr)) (setq SZ (getvar 'viewsize)) (vl-propagate 'vc) (vl-propagate 'sz) ) (if (or (= vc nil) (= sz nil)) (prompt "\nPlease Define Zoom Area") (vl-cmdf "_.Zoom" "C" VC SZ) ) ) (princ) ) 1 Quote
BIGAL Posted August 9 Posted August 9 Its not an answer to the question but does a 2 column radio button answer in just a few lines of code, it uses the library code Multi radio buttons 2 col, which it loads on demand. So just make 2 lists of what you want to see displayed in your dcl. Then use the cond etc. The code returns the displayed string or the button number selected a bit hidden but is there. There is sample code in the top of the code. Just a question why do you need 8 views ? Multi radio buttons 2col.lsp 1 Quote
rdx Posted August 9 Author Posted August 9 5 hours ago, BIGAL said: Its not an answer to the question but does a 2 column radio button answer in just a few lines of code, it uses the library code Multi radio buttons 2 col, which it loads on demand. So just make 2 lists of what you want to see displayed in your dcl. Then use the cond etc. The code returns the displayed string or the button number selected a bit hidden but is there. There is sample code in the top of the code. Just a question why do you need 8 views ? Multi radio buttons 2col.lsp 4.29 kB · 1 download Dear Sir, Thanks Quote
rdx Posted August 9 Author Posted August 9 6 hours ago, mhupp said: Use variables to save current view location rather than command line. Don't have to delete the old view to save new location, won't have output to the command line and its faster. (defun C:V1 () (setq vc (getvar 'viewctr)) (setq sz (getvar 'viewsize)) (prompt "\nView Saved") ) (defun C:R1 () (vl-load-com) (setq Drawing (vla-get-activedocument (vlax-get-acad-object)))) (vla-zoomcenter Drawing VC SZ) (princ) ) This is another lisp I have that Zoom to the same place across multiple drawings. ;;----------------------------------------------------------------------------;; ;; Zoom Area Across Multiple Drawings (defun C:ZAD (/ a) (initget "Yes No") (setq a (cond ((getkword "\nRedefine Zoom Area? [Yes/No]: ")) ("No") ) ) (if (= "Yes" a) (progn (vl-cmdf "_.Zoom" "W" Pause Pause) (setq vc (getvar 'viewctr)) (setq SZ (getvar 'viewsize)) (vl-propagate 'vc) (vl-propagate 'sz) ) (if (or (= vc nil) (= sz nil)) (prompt "\nPlease Define Zoom Area") (vl-cmdf "_.Zoom" "C" VC SZ) ) ) (princ) ) Dear Sir, Thanks Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.