pmadhwal7 Posted October 7, 2019 Posted October 7, 2019 (edited) Sir, I need help that I want a lsp which allow me to zoom in particular area in all layouts tabs at once. Edited October 7, 2019 by pmadhwal7 Quote
Tharwat Posted October 7, 2019 Posted October 7, 2019 An example. ;; Where the variables p1 & p2 are a list of coordinates (foreach l (layoutlist) (setvar 'CTAB l) (vlax-invoke (vlax-get-acad-object) 'ZoomWindow p1 p2) ) (vl-load-com) Quote
pmadhwal7 Posted October 8, 2019 Author Posted October 8, 2019 Sir example and error both are in attachment just like this I want to zoom in all layouts tabs in particular area.. Quote
Tharwat Posted October 8, 2019 Posted October 8, 2019 How did you feed the two points and ran the codes ? Quote
pmadhwal7 Posted October 8, 2019 Author Posted October 8, 2019 I just copy your code and paste it to lsp file extension and just ran this than the error occurred... Quote
Tharwat Posted October 8, 2019 Posted October 8, 2019 1 minute ago, pmadhwal7 said: I just copy your code and paste it to lsp file extension and just ran this than the error occurred... You need to feed the coordinates as I have mentioned in the first port. p1 & p2 eg: (setq p1 '(0. 0. 0.)) (setq p2 '(10.0 10.0 0.0)) (foreach l (layoutlist) (setvar 'CTAB l) (vlax-invoke (vlax-get-acad-object) 'ZoomWindow p1 p2) ) (vl-load-com) Quote
pmadhwal7 Posted October 8, 2019 Author Posted October 8, 2019 But sir their are lots of layouts tabs in my drawing and as per your method if I feed manually all the coordinates than better to go one by one in all layouts Quote
pmadhwal7 Posted October 8, 2019 Author Posted October 8, 2019 Sorry sir don't be angry I have and lsp which allow me to zoom extended in all layouts similarly I just want to zoom it in particular area I also retry your lsp but again error massage occurred.. Quote
Tharwat Posted October 8, 2019 Posted October 8, 2019 My replies have nothing to do anger, so here are a few questions for you to drag and push the idea to your world. - How do you make a zoom window in AutoCAD ? - Can you zoom window without picking two points? Quote
lrm Posted October 8, 2019 Posted October 8, 2019 Perhaps this will help. 1. Give the command appload and load zlayout.lsp 2. Give the command zlayout. Note, you will be view the same area of a layout for any one you choose. If you want to zoom to a different window than the one defined 0,0,0 to 1,1,0, then change the values for p1 and p2 to the lower left and upper right corners of the desired window. (defun c:zlayout (/) (setq p1 '(0. 0. 0.)) (setq p2 '(1.0 1.0 0.0)) (foreach l (layoutlist) (setvar 'CTAB l) (vlax-invoke (vlax-get-acad-object) 'ZoomWindow p1 p2) ) (vl-load-com) ) BTW, you can use the PrtScn keyboard button on your keyboard to copy the screen image to the clipboard. Alt-PrtScn will copy the image of the currently active application. Better yet, use the Windows 10 Snipping Tool. zlayout.lsp 1 Quote
CHLUCFENG Posted October 8, 2019 Posted October 8, 2019 May I offer an alternate solution for the user, using the code that Tharwat and lrm already started? (defun c:zlayout (/ sSize vSize vCtr LLC URC) (vl-load-com) (setvar "tilemode" 0) (vl-cmdf "pspace") (graphscr) (princ "\nZoom to the area you would like viewed on all tabs. Press <ENTER> when ready... " ) (getstring) (setq sSize (getvar "screensize") vSize (getvar "viewsize") vCtr (getvar "viewctr") ) (setq LLC (mapcar '- vCtr (list (* (* 0.5 vSize) (/ (car sSize) (cadr sSize))) (* 0.5 vSize) 0.0 ) ) ) (setq URC (mapcar '+ vCtr (list (* (* 0.5 vSize) (/ (car sSize) (cadr sSize))) (* 0.5 vSize) 0.0 ) ) ) (foreach l (layoutlist) (setvar 'CTAB l) (vlax-invoke (vlax-get-acad-object) 'ZoomWindow LLC URC) ) ) Run this code, get your zoom area on one sheet, then it will use the same zoom for all sheets. 1 Quote
CHLUCFENG Posted October 8, 2019 Posted October 8, 2019 I suppose I have it setup where any key will work, not just enter. This version will pause on each tab so you can check whatever is in the view prior to jumping to the next. (defun c:zlayout (/ sSize vSize vCtr LLC URC) (vl-load-com) (setvar "tilemode" 0) (vl-cmdf "pspace") (graphscr) (princ "\nZoom to the area you would like viewed on all tabs. Press any key when ready... " ) (getstring) (setq sSize (getvar "screensize") vSize (getvar "viewsize") vCtr (getvar "viewctr") ) (setq LLC (mapcar '- vCtr (list (* (* 0.5 vSize) (/ (car sSize) (cadr sSize))) (* 0.5 vSize) 0.0 ) ) ) (setq URC (mapcar '+ vCtr (list (* (* 0.5 vSize) (/ (car sSize) (cadr sSize))) (* 0.5 vSize) 0.0 ) ) ) (setvar "nomutt" 1) (foreach l (layoutlist) (setvar 'CTAB l) (vlax-invoke (vlax-get-acad-object) 'ZoomWindow LLC URC) (princ "\nPress any key to continue... " ) (getstring) ) (setvar "nomutt" 0) (princ) ) 1 Quote
pmadhwal7 Posted October 9, 2019 Author Posted October 9, 2019 11 hours ago, lrm said: Perhaps this will help. 1. Give the command appload and load zlayout.lsp 2. Give the command zlayout. Note, you will be view the same area of a layout for any one you choose. If you want to zoom to a different window than the one defined 0,0,0 to 1,1,0, then change the values for p1 and p2 to the lower left and upper right corners of the desired window. (defun c:zlayout (/) (setq p1 '(0. 0. 0.)) (setq p2 '(1.0 1.0 0.0)) (foreach l (layoutlist) (setvar 'CTAB l) (vlax-invoke (vlax-get-acad-object) 'ZoomWindow p1 p2) ) (vl-load-com) ) BTW, you can use the PrtScn keyboard button on your keyboard to copy the screen image to the clipboard. Alt-PrtScn will copy the image of the currently active application. Better yet, use the Windows 10 Snipping Tool. zlayout.lsp 197 B · 0 downloads working fine... Quote
pmadhwal7 Posted October 9, 2019 Author Posted October 9, 2019 10 hours ago, CHLUCFENG said: I suppose I have it setup where any key will work, not just enter. This version will pause on each tab so you can check whatever is in the view prior to jumping to the next. (defun c:zlayout (/ sSize vSize vCtr LLC URC) (vl-load-com) (setvar "tilemode" 0) (vl-cmdf "pspace") (graphscr) (princ "\nZoom to the area you would like viewed on all tabs. Press any key when ready... " ) (getstring) (setq sSize (getvar "screensize") vSize (getvar "viewsize") vCtr (getvar "viewctr") ) (setq LLC (mapcar '- vCtr (list (* (* 0.5 vSize) (/ (car sSize) (cadr sSize))) (* 0.5 vSize) 0.0 ) ) ) (setq URC (mapcar '+ vCtr (list (* (* 0.5 vSize) (/ (car sSize) (cadr sSize))) (* 0.5 vSize) 0.0 ) ) ) (setvar "nomutt" 1) (foreach l (layoutlist) (setvar 'CTAB l) (vlax-invoke (vlax-get-acad-object) 'ZoomWindow LLC URC) (princ "\nPress any key to continue... " ) (getstring) ) (setvar "nomutt" 0) (princ) ) this is also working fine...thanks a lot to all sir 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.