Small Fish Posted October 11, 2010 Posted October 11, 2010 I would like to select a viewport widow scale it up/down and then zoom it up or down with the detail. So for example if I have a 1:10 scale and I would like to zoom it up to 1:5 the viewport size would be scaled by 2 and the viewport scale would be scaled from 1:10 to 1:5. Doing this separately is reasonably simple (programatically), however I would like to only select the viewport to scale up the detail rather than select viewport then go into the active window and zoom up the scale. Is there a way to zoom a viewport while only selecting the viewport window (in paperspace) and not have to go in the active window to zoom? thanks Quote
eyde Posted October 11, 2010 Posted October 11, 2010 Absolutely you can do this. Select your viewport unlock it and in the lower right corner of your screen you have a scale list. Select the scale you want it to be at then relock the view port and stretch the viewport to encompass the detail. That is all there is to it. Quote
alanjt Posted October 11, 2010 Posted October 11, 2010 You have the option from a toolbar or from the bottom status bar... Quote
alanjt Posted October 11, 2010 Posted October 11, 2010 or you can type it: Command: z ZOOM Specify corner of window, enter a scale factor (nX or nXP), or [All/Center/Dynamic/Extents/Previous/Scale/Window/Object] <real time>: [color=red][b]1/20xp[/b][/color] Quote
Small Fish Posted October 11, 2010 Author Posted October 11, 2010 Command: z ZOOM Specify corner of window, enter a scale factor (nX or nXP), or [All/Center/Dynamic/Extents/Previous/Scale/Window/Object] : 1/20xp I am still not sure how I can change the viewport scale while in paperspace. What you have above works fine while you are in an active viewport. I want to change the viewport scale while in paperspace....unless I am missing something. Quote
alanjt Posted October 11, 2010 Posted October 11, 2010 I am still not sure how I can change the viewport scale while in paperspace. What you have above works fine while you are in an active viewport.I want to change the viewport scale while in paperspace....unless I am missing something. Select the viewport and use one the the first two methods I posted (the ones in the pictures). Quote
eyde Posted October 11, 2010 Posted October 11, 2010 I am still not sure how I can change the viewport scale while in paperspace. What you have above works fine while you are in an active viewport.I want to change the viewport scale while in paperspace....unless I am missing something. Just select the viewport (highlight it) do not double click inside it into paperspace. The viewport need to be unlock however. Quote
alanjt Posted October 11, 2010 Posted October 11, 2010 If you were so inclined to do this with code, just edit the scale with (vla-put-customscale ). Quote
Small Fish Posted October 11, 2010 Author Posted October 11, 2010 (edited) okay -thanks ...so it can be done programatically.... here is my attempt the sticking point is viewport scale where I am going wrong? thanks (defun c:Sc (/ ss EntVpt VpScaleRatio scalevp NewVpScaleRatio ScaleRatio) (vl-load-com) (setq scalevp (getreal "\nChoose a scale : ")) (princ "\nSelect paperspace Viewport : ") (setq ss (ssget ":s" '((0 . "viewport")))) (if ss (progn (setq EntVpt (ssname ss 0) VptObj (vlax-ename->vla-object EntVpt ) VpScaleRatio(vla-get-customscale VptObj) );setq (setq NewVpScaleRatio (/ 1.0 scalevp);Edit:this line is now correct CenPtVport (vlax-get VptObj 'Center) ScaleRatio (/ NewVpScaleRatio VpScaleRatio ) );setq (command "scale" ss "" CenPtVport ScaleRatio) (vla-put-customscale VptObj (/ 1.0 scalevp) ));Edit:this line is now correct );progn );if );defun Edited October 12, 2010 by Small Fish corrected code Quote
alanjt Posted October 11, 2010 Posted October 11, 2010 I'm assuming by 'sticking point', you mean the scale is not what you are wanting. Set the customscale value with the value divided by 1 (eg. (/ 1. scalevp) ). I didn't add your object scaling, but here's an example: (defun c:Test (/ e s) (if (setq e (car (entsel "\nSelect viewport to change/view scale: "))) (if (eq "AcDbViewport" (vla-get-objectname (setq e (vlax-ename->vla-object e)))) (if (setq s (getreal (strcat "\nSpecify new scale (Current: 1\" = " (rtos (/ 1. (vla-get-customscale e)) 2) "'): " ) ) ) (vl-catch-all-apply (function vla-put-customscale) (list e (/ 1. s))) ) (princ "\nInvalid object!") ) ) (princ) ) Quote
Small Fish Posted October 11, 2010 Author Posted October 11, 2010 Set the customscale value with the value divided by 1 (eg. (/ 1. scalevp) ). Thanks a million Alan!! - thats where I was going wrong with my code (ugh!) Now I have it just how I want it cheers SF EDIT: thanks also for your example code Quote
alanjt Posted October 11, 2010 Posted October 11, 2010 Thanks a million Alan!! - thats where I was going wrong with my code (ugh!)Now I have it just how I want it cheers SF EDIT: thanks also for your example code You're very welcome. Quote
Small Fish Posted October 12, 2010 Author Posted October 12, 2010 Alan just one more question - I am trying to learn from your code..... what does this line do?: (vl-catch-all-apply (function vla-put-customscale) (list e (/ 1. s))) As I understand it passes a list of arguments to a specified function and traps any exceptions, but I am not sure what exceptions there would be? Quote
alanjt Posted October 12, 2010 Posted October 12, 2010 Alan just one more question - I am trying to learn from your code.....what does this line do?: (vl-catch-all-apply (function vla-put-customscale) (list e (/ 1. s))) As I understand it passes a list of arguments to a specified function and traps any exceptions, but I am not sure what exceptions there would be? The viewport could be locked (cause error) or the layer the viewport resides on could be locked (cause error). Quote
Small Fish Posted October 12, 2010 Author Posted October 12, 2010 The viewport could be locked (cause error) or the layer the viewport resides on could be locked (cause error). Alan- thanks Dude:) Quote
vnanhvu Posted October 2, 2012 Posted October 2, 2012 Hi Small Fish. Your lisp is very good. I first little glitch like to ask you. When i load your lisp, display error: ; error: extra right paren on input And when i cant use VLIDE convert Lsp to VLX ; error: extra right paren on input ; Compilation aborted: Fatal errors found. Thank you very much ! Quote
ReMark Posted October 2, 2012 Posted October 2, 2012 Haven't seen Small Fish since some time back in June of 2011. Hope you don't mind waiting for a reply. Quote
Small Fish Posted October 6, 2012 Author Posted October 6, 2012 hey here I am!! .... been house building.... nowhere near Acad! Amend (vla-put-customscale VptObj (/ 1.0 scalevp)) to (vla-put-customscale VptObj (/ 1.0 scalevp) It should be easy enough to find missing or additional parenthesis with the VLIDE SF 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.